gpio-au1000.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. /*
  2. * GPIO functions for Au1000, Au1500, Au1100, Au1550, Au1200
  3. *
  4. * Copyright (c) 2009 Manuel Lauss.
  5. *
  6. * Licensed under the terms outlined in the file COPYING.
  7. */
  8. #ifndef _ALCHEMY_GPIO_AU1000_H_
  9. #define _ALCHEMY_GPIO_AU1000_H_
  10. #include <asm/mach-au1x00/au1000.h>
  11. /* The default GPIO numberspace as documented in the Alchemy manuals.
  12. * GPIO0-31 from GPIO1 block, GPIO200-215 from GPIO2 block.
  13. */
  14. #define ALCHEMY_GPIO1_BASE 0
  15. #define ALCHEMY_GPIO2_BASE 200
  16. #define ALCHEMY_GPIO1_NUM 32
  17. #define ALCHEMY_GPIO2_NUM 16
  18. #define ALCHEMY_GPIO1_MAX (ALCHEMY_GPIO1_BASE + ALCHEMY_GPIO1_NUM - 1)
  19. #define ALCHEMY_GPIO2_MAX (ALCHEMY_GPIO2_BASE + ALCHEMY_GPIO2_NUM - 1)
  20. #define MAKE_IRQ(intc, off) (AU1000_INTC##intc##_INT_BASE + (off))
  21. static inline int au1000_gpio1_to_irq(int gpio)
  22. {
  23. return MAKE_IRQ(1, gpio - ALCHEMY_GPIO1_BASE);
  24. }
  25. static inline int au1000_gpio2_to_irq(int gpio)
  26. {
  27. return -ENXIO;
  28. }
  29. #ifdef CONFIG_SOC_AU1000
  30. static inline int au1000_irq_to_gpio(int irq)
  31. {
  32. if ((irq >= AU1000_GPIO_0) && (irq <= AU1000_GPIO_31))
  33. return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
  34. return -ENXIO;
  35. }
  36. #endif
  37. static inline int au1500_gpio1_to_irq(int gpio)
  38. {
  39. gpio -= ALCHEMY_GPIO1_BASE;
  40. switch (gpio) {
  41. case 0 ... 15:
  42. case 20:
  43. case 23 ... 28: return MAKE_IRQ(1, gpio);
  44. }
  45. return -ENXIO;
  46. }
  47. static inline int au1500_gpio2_to_irq(int gpio)
  48. {
  49. gpio -= ALCHEMY_GPIO2_BASE;
  50. switch (gpio) {
  51. case 0 ... 3: return MAKE_IRQ(1, 16 + gpio - 0);
  52. case 4 ... 5: return MAKE_IRQ(1, 21 + gpio - 4);
  53. case 6 ... 7: return MAKE_IRQ(1, 29 + gpio - 6);
  54. }
  55. return -ENXIO;
  56. }
  57. #ifdef CONFIG_SOC_AU1500
  58. static inline int au1500_irq_to_gpio(int irq)
  59. {
  60. switch (irq) {
  61. case AU1000_GPIO_0 ... AU1000_GPIO_15:
  62. case AU1500_GPIO_20:
  63. case AU1500_GPIO_23 ... AU1500_GPIO_28:
  64. return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
  65. case AU1500_GPIO_200 ... AU1500_GPIO_203:
  66. return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_200) + 0;
  67. case AU1500_GPIO_204 ... AU1500_GPIO_205:
  68. return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_204) + 4;
  69. case AU1500_GPIO_206 ... AU1500_GPIO_207:
  70. return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_206) + 6;
  71. case AU1500_GPIO_208_215:
  72. return ALCHEMY_GPIO2_BASE + 8;
  73. }
  74. return -ENXIO;
  75. }
  76. #endif
  77. static inline int au1100_gpio1_to_irq(int gpio)
  78. {
  79. return MAKE_IRQ(1, gpio - ALCHEMY_GPIO1_BASE);
  80. }
  81. static inline int au1100_gpio2_to_irq(int gpio)
  82. {
  83. gpio -= ALCHEMY_GPIO2_BASE;
  84. if ((gpio >= 8) && (gpio <= 15))
  85. return MAKE_IRQ(0, 29); /* shared GPIO208_215 */
  86. return -ENXIO;
  87. }
  88. #ifdef CONFIG_SOC_AU1100
  89. static inline int au1100_irq_to_gpio(int irq)
  90. {
  91. switch (irq) {
  92. case AU1000_GPIO_0 ... AU1000_GPIO_31:
  93. return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
  94. case AU1100_GPIO_208_215:
  95. return ALCHEMY_GPIO2_BASE + 8;
  96. }
  97. return -ENXIO;
  98. }
  99. #endif
  100. static inline int au1550_gpio1_to_irq(int gpio)
  101. {
  102. gpio -= ALCHEMY_GPIO1_BASE;
  103. switch (gpio) {
  104. case 0 ... 15:
  105. case 20 ... 28: return MAKE_IRQ(1, gpio);
  106. case 16 ... 17: return MAKE_IRQ(1, 18 + gpio - 16);
  107. }
  108. return -ENXIO;
  109. }
  110. static inline int au1550_gpio2_to_irq(int gpio)
  111. {
  112. gpio -= ALCHEMY_GPIO2_BASE;
  113. switch (gpio) {
  114. case 0: return MAKE_IRQ(1, 16);
  115. case 1 ... 5: return MAKE_IRQ(1, 17); /* shared GPIO201_205 */
  116. case 6 ... 7: return MAKE_IRQ(1, 29 + gpio - 6);
  117. case 8 ... 15: return MAKE_IRQ(1, 31); /* shared GPIO208_215 */
  118. }
  119. return -ENXIO;
  120. }
  121. #ifdef CONFIG_SOC_AU1550
  122. static inline int au1550_irq_to_gpio(int irq)
  123. {
  124. switch (irq) {
  125. case AU1000_GPIO_0 ... AU1000_GPIO_15:
  126. return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
  127. case AU1550_GPIO_200:
  128. case AU1500_GPIO_201_205:
  129. return ALCHEMY_GPIO2_BASE + (irq - AU1550_GPIO_200) + 0;
  130. case AU1500_GPIO_16 ... AU1500_GPIO_28:
  131. return ALCHEMY_GPIO1_BASE + (irq - AU1500_GPIO_16) + 16;
  132. case AU1500_GPIO_206 ... AU1500_GPIO_208_218:
  133. return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_206) + 6;
  134. }
  135. return -ENXIO;
  136. }
  137. #endif
  138. static inline int au1200_gpio1_to_irq(int gpio)
  139. {
  140. return MAKE_IRQ(1, gpio - ALCHEMY_GPIO1_BASE);
  141. }
  142. static inline int au1200_gpio2_to_irq(int gpio)
  143. {
  144. gpio -= ALCHEMY_GPIO2_BASE;
  145. switch (gpio) {
  146. case 0 ... 2: return MAKE_IRQ(0, 5 + gpio - 0);
  147. case 3: return MAKE_IRQ(0, 22);
  148. case 4 ... 7: return MAKE_IRQ(0, 24 + gpio - 4);
  149. case 8 ... 15: return MAKE_IRQ(0, 28); /* shared GPIO208_215 */
  150. }
  151. return -ENXIO;
  152. }
  153. #ifdef CONFIG_SOC_AU1200
  154. static inline int au1200_irq_to_gpio(int irq)
  155. {
  156. switch (irq) {
  157. case AU1000_GPIO_0 ... AU1000_GPIO_31:
  158. return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
  159. case AU1200_GPIO_200 ... AU1200_GPIO_202:
  160. return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO_200) + 0;
  161. case AU1200_GPIO_203:
  162. return ALCHEMY_GPIO2_BASE + 3;
  163. case AU1200_GPIO_204 ... AU1200_GPIO_208_215:
  164. return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO_204) + 4;
  165. }
  166. return -ENXIO;
  167. }
  168. #endif
  169. /*
  170. * GPIO1 block macros for common linux gpio functions.
  171. */
  172. static inline void alchemy_gpio1_set_value(int gpio, int v)
  173. {
  174. unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE);
  175. unsigned long r = v ? SYS_OUTPUTSET : SYS_OUTPUTCLR;
  176. au_writel(mask, r);
  177. au_sync();
  178. }
  179. static inline int alchemy_gpio1_get_value(int gpio)
  180. {
  181. unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE);
  182. return au_readl(SYS_PINSTATERD) & mask;
  183. }
  184. static inline int alchemy_gpio1_direction_input(int gpio)
  185. {
  186. unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE);
  187. au_writel(mask, SYS_TRIOUTCLR);
  188. au_sync();
  189. return 0;
  190. }
  191. static inline int alchemy_gpio1_direction_output(int gpio, int v)
  192. {
  193. /* hardware switches to "output" mode when one of the two
  194. * "set_value" registers is accessed.
  195. */
  196. alchemy_gpio1_set_value(gpio, v);
  197. return 0;
  198. }
  199. static inline int alchemy_gpio1_is_valid(int gpio)
  200. {
  201. return ((gpio >= ALCHEMY_GPIO1_BASE) && (gpio <= ALCHEMY_GPIO1_MAX));
  202. }
  203. static inline int alchemy_gpio1_to_irq(int gpio)
  204. {
  205. #if defined(CONFIG_SOC_AU1000)
  206. return au1000_gpio1_to_irq(gpio);
  207. #elif defined(CONFIG_SOC_AU1100)
  208. return au1100_gpio1_to_irq(gpio);
  209. #elif defined(CONFIG_SOC_AU1500)
  210. return au1500_gpio1_to_irq(gpio);
  211. #elif defined(CONFIG_SOC_AU1550)
  212. return au1550_gpio1_to_irq(gpio);
  213. #elif defined(CONFIG_SOC_AU1200)
  214. return au1200_gpio1_to_irq(gpio);
  215. #else
  216. return -ENXIO;
  217. #endif
  218. }
  219. /*
  220. * GPIO2 block macros for common linux GPIO functions. The 'gpio'
  221. * parameter must be in range of ALCHEMY_GPIO2_BASE..ALCHEMY_GPIO2_MAX.
  222. */
  223. static inline void __alchemy_gpio2_mod_dir(int gpio, int to_out)
  224. {
  225. unsigned long mask = 1 << (gpio - ALCHEMY_GPIO2_BASE);
  226. unsigned long d = au_readl(GPIO2_DIR);
  227. if (to_out)
  228. d |= mask;
  229. else
  230. d &= ~mask;
  231. au_writel(d, GPIO2_DIR);
  232. au_sync();
  233. }
  234. static inline void alchemy_gpio2_set_value(int gpio, int v)
  235. {
  236. unsigned long mask;
  237. mask = ((v) ? 0x00010001 : 0x00010000) << (gpio - ALCHEMY_GPIO2_BASE);
  238. au_writel(mask, GPIO2_OUTPUT);
  239. au_sync();
  240. }
  241. static inline int alchemy_gpio2_get_value(int gpio)
  242. {
  243. return au_readl(GPIO2_PINSTATE) & (1 << (gpio - ALCHEMY_GPIO2_BASE));
  244. }
  245. static inline int alchemy_gpio2_direction_input(int gpio)
  246. {
  247. unsigned long flags;
  248. local_irq_save(flags);
  249. __alchemy_gpio2_mod_dir(gpio, 0);
  250. local_irq_restore(flags);
  251. return 0;
  252. }
  253. static inline int alchemy_gpio2_direction_output(int gpio, int v)
  254. {
  255. unsigned long flags;
  256. alchemy_gpio2_set_value(gpio, v);
  257. local_irq_save(flags);
  258. __alchemy_gpio2_mod_dir(gpio, 1);
  259. local_irq_restore(flags);
  260. return 0;
  261. }
  262. static inline int alchemy_gpio2_is_valid(int gpio)
  263. {
  264. return ((gpio >= ALCHEMY_GPIO2_BASE) && (gpio <= ALCHEMY_GPIO2_MAX));
  265. }
  266. static inline int alchemy_gpio2_to_irq(int gpio)
  267. {
  268. #if defined(CONFIG_SOC_AU1000)
  269. return au1000_gpio2_to_irq(gpio);
  270. #elif defined(CONFIG_SOC_AU1100)
  271. return au1100_gpio2_to_irq(gpio);
  272. #elif defined(CONFIG_SOC_AU1500)
  273. return au1500_gpio2_to_irq(gpio);
  274. #elif defined(CONFIG_SOC_AU1550)
  275. return au1550_gpio2_to_irq(gpio);
  276. #elif defined(CONFIG_SOC_AU1200)
  277. return au1200_gpio2_to_irq(gpio);
  278. #else
  279. return -ENXIO;
  280. #endif
  281. }
  282. /**********************************************************************/
  283. /* On Au1000, Au1500 and Au1100 GPIOs won't work as inputs before
  284. * SYS_PININPUTEN is written to at least once. On Au1550/Au1200 this
  285. * register enables use of GPIOs as wake source.
  286. */
  287. static inline void alchemy_gpio1_input_enable(void)
  288. {
  289. au_writel(0, SYS_PININPUTEN); /* the write op is key */
  290. au_sync();
  291. }
  292. /* GPIO2 shared interrupts and control */
  293. static inline void __alchemy_gpio2_mod_int(int gpio2, int en)
  294. {
  295. unsigned long r = au_readl(GPIO2_INTENABLE);
  296. if (en)
  297. r |= 1 << gpio2;
  298. else
  299. r &= ~(1 << gpio2);
  300. au_writel(r, GPIO2_INTENABLE);
  301. au_sync();
  302. }
  303. /**
  304. * alchemy_gpio2_enable_int - Enable a GPIO2 pins' shared irq contribution.
  305. * @gpio2: The GPIO2 pin to activate (200...215).
  306. *
  307. * GPIO208-215 have one shared interrupt line to the INTC. They are
  308. * and'ed with a per-pin enable bit and finally or'ed together to form
  309. * a single irq request (useful for active-high sources).
  310. * With this function, a pins' individual contribution to the int request
  311. * can be enabled. As with all other GPIO-based interrupts, the INTC
  312. * must be programmed to accept the GPIO208_215 interrupt as well.
  313. *
  314. * NOTE: Calling this macro is only necessary for GPIO208-215; all other
  315. * GPIO2-based interrupts have their own request to the INTC. Please
  316. * consult your Alchemy databook for more information!
  317. *
  318. * NOTE: On the Au1550, GPIOs 201-205 also have a shared interrupt request
  319. * line to the INTC, GPIO201_205. This function can be used for those
  320. * as well.
  321. *
  322. * NOTE: 'gpio2' parameter must be in range of the GPIO2 numberspace
  323. * (200-215 by default). No sanity checks are made,
  324. */
  325. static inline void alchemy_gpio2_enable_int(int gpio2)
  326. {
  327. unsigned long flags;
  328. gpio2 -= ALCHEMY_GPIO2_BASE;
  329. #if defined(CONFIG_SOC_AU1100) || defined(CONFIG_SOC_AU1500)
  330. /* Au1100/Au1500 have GPIO208-215 enable bits at 0..7 */
  331. gpio2 -= 8;
  332. #endif
  333. local_irq_save(flags);
  334. __alchemy_gpio2_mod_int(gpio2, 1);
  335. local_irq_restore(flags);
  336. }
  337. /**
  338. * alchemy_gpio2_disable_int - Disable a GPIO2 pins' shared irq contribution.
  339. * @gpio2: The GPIO2 pin to activate (200...215).
  340. *
  341. * see function alchemy_gpio2_enable_int() for more information.
  342. */
  343. static inline void alchemy_gpio2_disable_int(int gpio2)
  344. {
  345. unsigned long flags;
  346. gpio2 -= ALCHEMY_GPIO2_BASE;
  347. #if defined(CONFIG_SOC_AU1100) || defined(CONFIG_SOC_AU1500)
  348. /* Au1100/Au1500 have GPIO208-215 enable bits at 0..7 */
  349. gpio2 -= 8;
  350. #endif
  351. local_irq_save(flags);
  352. __alchemy_gpio2_mod_int(gpio2, 0);
  353. local_irq_restore(flags);
  354. }
  355. /**
  356. * alchemy_gpio2_enable - Activate GPIO2 block.
  357. *
  358. * The GPIO2 block must be enabled excplicitly to work. On systems
  359. * where this isn't done by the bootloader, this macro can be used.
  360. */
  361. static inline void alchemy_gpio2_enable(void)
  362. {
  363. au_writel(3, GPIO2_ENABLE); /* reset, clock enabled */
  364. au_sync();
  365. au_writel(1, GPIO2_ENABLE); /* clock enabled */
  366. au_sync();
  367. }
  368. /**
  369. * alchemy_gpio2_disable - disable GPIO2 block.
  370. *
  371. * Disable and put GPIO2 block in low-power mode.
  372. */
  373. static inline void alchemy_gpio2_disable(void)
  374. {
  375. au_writel(2, GPIO2_ENABLE); /* reset, clock disabled */
  376. au_sync();
  377. }
  378. /**********************************************************************/
  379. /* wrappers for on-chip gpios; can be used before gpio chips have been
  380. * registered with gpiolib.
  381. */
  382. static inline int alchemy_gpio_direction_input(int gpio)
  383. {
  384. return (gpio >= ALCHEMY_GPIO2_BASE) ?
  385. alchemy_gpio2_direction_input(gpio) :
  386. alchemy_gpio1_direction_input(gpio);
  387. }
  388. static inline int alchemy_gpio_direction_output(int gpio, int v)
  389. {
  390. return (gpio >= ALCHEMY_GPIO2_BASE) ?
  391. alchemy_gpio2_direction_output(gpio, v) :
  392. alchemy_gpio1_direction_output(gpio, v);
  393. }
  394. static inline int alchemy_gpio_get_value(int gpio)
  395. {
  396. return (gpio >= ALCHEMY_GPIO2_BASE) ?
  397. alchemy_gpio2_get_value(gpio) :
  398. alchemy_gpio1_get_value(gpio);
  399. }
  400. static inline void alchemy_gpio_set_value(int gpio, int v)
  401. {
  402. if (gpio >= ALCHEMY_GPIO2_BASE)
  403. alchemy_gpio2_set_value(gpio, v);
  404. else
  405. alchemy_gpio1_set_value(gpio, v);
  406. }
  407. static inline int alchemy_gpio_is_valid(int gpio)
  408. {
  409. return (gpio >= ALCHEMY_GPIO2_BASE) ?
  410. alchemy_gpio2_is_valid(gpio) :
  411. alchemy_gpio1_is_valid(gpio);
  412. }
  413. static inline int alchemy_gpio_cansleep(int gpio)
  414. {
  415. return 0; /* Alchemy never gets tired */
  416. }
  417. static inline int alchemy_gpio_to_irq(int gpio)
  418. {
  419. return (gpio >= ALCHEMY_GPIO2_BASE) ?
  420. alchemy_gpio2_to_irq(gpio) :
  421. alchemy_gpio1_to_irq(gpio);
  422. }
  423. static inline int alchemy_irq_to_gpio(int irq)
  424. {
  425. #if defined(CONFIG_SOC_AU1000)
  426. return au1000_irq_to_gpio(irq);
  427. #elif defined(CONFIG_SOC_AU1100)
  428. return au1100_irq_to_gpio(irq);
  429. #elif defined(CONFIG_SOC_AU1500)
  430. return au1500_irq_to_gpio(irq);
  431. #elif defined(CONFIG_SOC_AU1550)
  432. return au1550_irq_to_gpio(irq);
  433. #elif defined(CONFIG_SOC_AU1200)
  434. return au1200_irq_to_gpio(irq);
  435. #else
  436. return -ENXIO;
  437. #endif
  438. }
  439. /**********************************************************************/
  440. /* Linux gpio framework integration.
  441. *
  442. * 4 use cases of Au1000-Au1200 GPIOS:
  443. *(1) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=y:
  444. * Board must register gpiochips.
  445. *(2) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=n:
  446. * 2 (1 for Au1000) gpio_chips are registered.
  447. *
  448. *(3) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=y:
  449. * the boards' gpio.h must provide the linux gpio wrapper functions,
  450. *
  451. *(4) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=n:
  452. * inlinable gpio functions are provided which enable access to the
  453. * Au1000 gpios only by using the numbers straight out of the data-
  454. * sheets.
  455. * Cases 1 and 3 are intended for boards which want to provide their own
  456. * GPIO namespace and -operations (i.e. for example you have 8 GPIOs
  457. * which are in part provided by spare Au1000 GPIO pins and in part by
  458. * an external FPGA but you still want them to be accssible in linux
  459. * as gpio0-7. The board can of course use the alchemy_gpioX_* functions
  460. * as required).
  461. */
  462. #ifndef CONFIG_GPIOLIB
  463. #ifndef CONFIG_ALCHEMY_GPIO_INDIRECT /* case (4) */
  464. static inline int gpio_direction_input(int gpio)
  465. {
  466. return alchemy_gpio_direction_input(gpio);
  467. }
  468. static inline int gpio_direction_output(int gpio, int v)
  469. {
  470. return alchemy_gpio_direction_output(gpio, v);
  471. }
  472. static inline int gpio_get_value(int gpio)
  473. {
  474. return alchemy_gpio_get_value(gpio);
  475. }
  476. static inline void gpio_set_value(int gpio, int v)
  477. {
  478. alchemy_gpio_set_value(gpio, v);
  479. }
  480. static inline int gpio_is_valid(int gpio)
  481. {
  482. return alchemy_gpio_is_valid(gpio);
  483. }
  484. static inline int gpio_cansleep(int gpio)
  485. {
  486. return alchemy_gpio_cansleep(gpio);
  487. }
  488. static inline int gpio_to_irq(int gpio)
  489. {
  490. return alchemy_gpio_to_irq(gpio);
  491. }
  492. static inline int irq_to_gpio(int irq)
  493. {
  494. return alchemy_irq_to_gpio(irq);
  495. }
  496. static inline int gpio_request(unsigned gpio, const char *label)
  497. {
  498. return 0;
  499. }
  500. static inline void gpio_free(unsigned gpio)
  501. {
  502. }
  503. #endif /* !CONFIG_ALCHEMY_GPIO_INDIRECT */
  504. #else /* CONFIG GPIOLIB */
  505. /* using gpiolib to provide up to 2 gpio_chips for on-chip gpios */
  506. #ifndef CONFIG_ALCHEMY_GPIO_INDIRECT /* case (2) */
  507. /* get everything through gpiolib */
  508. #define gpio_to_irq __gpio_to_irq
  509. #define gpio_get_value __gpio_get_value
  510. #define gpio_set_value __gpio_set_value
  511. #define gpio_cansleep __gpio_cansleep
  512. #define irq_to_gpio alchemy_irq_to_gpio
  513. #include <asm-generic/gpio.h>
  514. #endif /* !CONFIG_ALCHEMY_GPIO_INDIRECT */
  515. #endif /* !CONFIG_GPIOLIB */
  516. #endif /* _ALCHEMY_GPIO_AU1000_H_ */