gpio-au1000.h 15 KB

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