mt8193_gpio.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. #ifndef MT8193_GPIO_H
  2. #define MT8193_GPIO_H
  3. #include <generated/autoconf.h>
  4. #include <linux/mm.h>
  5. #include <linux/init.h>
  6. #include <linux/fb.h>
  7. #include <linux/delay.h>
  8. #include <linux/device.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/kthread.h>
  11. #include <linux/rtpm_prio.h>
  12. #include <linux/vmalloc.h>
  13. #include <asm/uaccess.h>
  14. #include <asm/atomic.h>
  15. #include <asm/cacheflush.h>
  16. #include <asm/io.h>
  17. #include <mach/irqs.h>
  18. #include <linux/miscdevice.h>
  19. #include <linux/fs.h>
  20. #include <linux/file.h>
  21. #include <linux/cdev.h>
  22. #include <asm/tlbflush.h>
  23. #include <asm/page.h>
  24. #include <linux/slab.h>
  25. #include <linux/module.h>
  26. #include "mt8193_pinmux.h"
  27. #define MT8193_GPIO_OUTPUT 1
  28. #define MT8193_GPIO_INPUT 0
  29. #define MT8193_GPIO_HIGH 1
  30. #define MT8193_GPIO_LOW 0
  31. enum MT8193_GPIO_PIN {
  32. GPIO_PIN_UNSUPPORTED = -1,
  33. GPIO_PIN_GPIO0,
  34. GPIO_PIN_GPIO1,
  35. GPIO_PIN_GPIO2,
  36. GPIO_PIN_GPIO3,
  37. GPIO_PIN_GPIO4,
  38. GPIO_PIN_GPIO5,
  39. GPIO_PIN_GPIO6,
  40. GPIO_PIN_GPIO7,
  41. GPIO_PIN_GPIO8,
  42. GPIO_PIN_GPIO9,
  43. GPIO_PIN_GPIO10,
  44. GPIO_PIN_GPIO11,
  45. GPIO_PIN_GPIO12,
  46. GPIO_PIN_GPIO13,
  47. GPIO_PIN_GPIO14,
  48. GPIO_PIN_GPIO15,
  49. GPIO_PIN_GPIO16,
  50. GPIO_PIN_GPIO17,
  51. GPIO_PIN_GPIO18,
  52. GPIO_PIN_GPIO19,
  53. GPIO_PIN_GPIO20,
  54. GPIO_PIN_GPIO21,
  55. GPIO_PIN_GPIO22,
  56. GPIO_PIN_GPIO23,
  57. GPIO_PIN_GPIO24,
  58. GPIO_PIN_GPIO25,
  59. GPIO_PIN_GPIO26,
  60. GPIO_PIN_GPIO27,
  61. GPIO_PIN_GPIO28,
  62. GPIO_PIN_GPIO29,
  63. GPIO_PIN_GPIO30,
  64. GPIO_PIN_GPIO31,
  65. GPIO_PIN_GPIO32,
  66. GPIO_PIN_GPIO33,
  67. GPIO_PIN_GPIO34,
  68. GPIO_PIN_GPIO35,
  69. GPIO_PIN_GPIO36,
  70. GPIO_PIN_GPIO37,
  71. GPIO_PIN_GPIO38,
  72. GPIO_PIN_GPIO39,
  73. GPIO_PIN_GPIO40,
  74. GPIO_PIN_GPIO41,
  75. GPIO_PIN_GPIO42,
  76. GPIO_PIN_GPIO43,
  77. GPIO_PIN_GPIO44,
  78. GPIO_PIN_GPIO45,
  79. GPIO_PIN_GPIO46,
  80. GPIO_PIN_GPIO47,
  81. GPIO_PIN_GPIO48,
  82. GPIO_PIN_GPIO49,
  83. GPIO_PIN_GPIO50,
  84. GPIO_PIN_GPIO51,
  85. GPIO_PIN_GPIO52,
  86. GPIO_PIN_GPIO53,
  87. GPIO_PIN_GPIO54,
  88. GPIO_PIN_GPIO55,
  89. GPIO_PIN_GPIO56,
  90. GPIO_PIN_GPIO57,
  91. GPIO_PIN_GPIO58,
  92. GPIO_PIN_GPIO59,
  93. GPIO_PIN_GPIO60,
  94. GPIO_PIN_GPIO61,
  95. GPIO_PIN_GPIO62,
  96. GPIO_PIN_GPIO63,
  97. GPIO_PIN_GPIO64,
  98. GPIO_PIN_GPIO65,
  99. GPIO_PIN_GPIO66,
  100. GPIO_PIN_GPIO67,
  101. GPIO_PIN_GPIO68,
  102. GPIO_PIN_GPIO69,
  103. GPIO_PIN_GPIO70,
  104. GPIO_PIN_GPIO71,
  105. GPIO_PIN_MAX
  106. };
  107. /* _au4GpioTbl[gpio num] is pad num */
  108. static const u32 _au4GpioTbl[GPIO_PIN_MAX] = {
  109. PIN_NFD6, /* gpio0 */
  110. PIN_NFD5,
  111. PIN_NFD4,
  112. PIN_NFD3,
  113. PIN_NFD2,
  114. PIN_NFD1,
  115. PIN_NFD0, /* gpio6 */
  116. PIN_G0, /* gpio 7 */
  117. PIN_B5,
  118. PIN_B4,
  119. PIN_B3,
  120. PIN_B2,
  121. PIN_B1,
  122. PIN_B0,
  123. PIN_DE,
  124. PIN_VCLK,
  125. PIN_HSYNC,
  126. PIN_VSYNC,
  127. PIN_CEC,
  128. PIN_HDMISCK,
  129. PIN_HDMISD,
  130. PIN_HTPLG,
  131. PIN_I2S_DATA,
  132. PIN_I2S_LRCK,
  133. PIN_I2S_BCK,
  134. PIN_DPI1CK,
  135. PIN_DPI1D7,
  136. PIN_DPI1D6,
  137. PIN_DPI1D5,
  138. PIN_DPI1D4,
  139. PIN_DPI1D3,
  140. PIN_DPI1D2,
  141. PIN_DPI1D1,
  142. PIN_DPI1D0,
  143. PIN_DPI0CK,
  144. PIN_DPI0HSYNC,
  145. PIN_DPI0VSYNC,
  146. PIN_DPI0D11,
  147. PIN_DPI0D10,
  148. PIN_DPI0D9,
  149. PIN_DPI0D8,
  150. PIN_DPI0D7,
  151. PIN_DPI0D6,
  152. PIN_DPI0D5,
  153. PIN_DPI0D4,
  154. PIN_DPI0D3,
  155. PIN_DPI0D2,
  156. PIN_DPI0D1,
  157. PIN_DPI0D0,
  158. PIN_SDA,
  159. PIN_SCL,
  160. PIN_NRNB,
  161. PIN_NCLE,
  162. PIN_NALE,
  163. PIN_NWEB,
  164. PIN_NREB,
  165. PIN_NLD7,
  166. PIN_NLD6,
  167. PIN_NLD5,
  168. PIN_NLD4,
  169. PIN_NLD3,
  170. PIN_NLD2,
  171. PIN_NLD1,
  172. PIN_NLD0, /* gpio 63 */
  173. PIN_INT, /* gpio 64*/
  174. PIN_NFRBN, /* gpio 65*/
  175. PIN_NFCLE,
  176. PIN_NFALE,
  177. PIN_NFWEN,
  178. PIN_NFREN,
  179. PIN_NFCEN,
  180. PIN_NFD7, /* gpio 71 */
  181. };
  182. extern int GPIO_Config(u32 u4GpioNum, u8 u1Mode, u8 u1Value);
  183. extern u8 GPIO_Input(u32 i4GpioNum);
  184. extern int GPIO_Output(u32 u4GpioNum, u32 u4High);
  185. #endif /* MT8193_H */