gpio-au1000.h 15 KB

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