pinctrl-sun8i-h3.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. /*
  2. * Allwinner H3 SoCs pinctrl driver.
  3. *
  4. * Copyright (C) 2015 Jens Kuske <jenskuske@gmail.com>
  5. *
  6. * Based on pinctrl-sun8i-a23.c, which is:
  7. * Copyright (C) 2014 Chen-Yu Tsai <wens@csie.org>
  8. * Copyright (C) 2014 Maxime Ripard <maxime.ripard@free-electrons.com>
  9. *
  10. * This file is licensed under the terms of the GNU General Public
  11. * License version 2. This program is licensed "as is" without any
  12. * warranty of any kind, whether express or implied.
  13. */
  14. #include <linux/module.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/of.h>
  17. #include <linux/of_device.h>
  18. #include <linux/pinctrl/pinctrl.h>
  19. #include "pinctrl-sunxi.h"
  20. static const struct sunxi_desc_pin sun8i_h3_pins[] = {
  21. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 0),
  22. SUNXI_FUNCTION(0x0, "gpio_in"),
  23. SUNXI_FUNCTION(0x1, "gpio_out"),
  24. SUNXI_FUNCTION(0x2, "uart2"), /* TX */
  25. SUNXI_FUNCTION(0x3, "jtag"), /* MS */
  26. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 0)), /* PA_EINT0 */
  27. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 1),
  28. SUNXI_FUNCTION(0x0, "gpio_in"),
  29. SUNXI_FUNCTION(0x1, "gpio_out"),
  30. SUNXI_FUNCTION(0x2, "uart2"), /* RX */
  31. SUNXI_FUNCTION(0x3, "jtag"), /* CK */
  32. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 1)), /* PA_EINT1 */
  33. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 2),
  34. SUNXI_FUNCTION(0x0, "gpio_in"),
  35. SUNXI_FUNCTION(0x1, "gpio_out"),
  36. SUNXI_FUNCTION(0x2, "uart2"), /* RTS */
  37. SUNXI_FUNCTION(0x3, "jtag"), /* DO */
  38. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 2)), /* PA_EINT2 */
  39. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 3),
  40. SUNXI_FUNCTION(0x0, "gpio_in"),
  41. SUNXI_FUNCTION(0x1, "gpio_out"),
  42. SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
  43. SUNXI_FUNCTION(0x3, "jtag"), /* DI */
  44. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 3)), /* PA_EINT3 */
  45. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 4),
  46. SUNXI_FUNCTION(0x0, "gpio_in"),
  47. SUNXI_FUNCTION(0x1, "gpio_out"),
  48. SUNXI_FUNCTION(0x2, "uart0"), /* TX */
  49. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 4)), /* PA_EINT4 */
  50. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 5),
  51. SUNXI_FUNCTION(0x0, "gpio_in"),
  52. SUNXI_FUNCTION(0x1, "gpio_out"),
  53. SUNXI_FUNCTION(0x2, "uart0"), /* RX */
  54. SUNXI_FUNCTION(0x3, "pwm0"),
  55. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 5)), /* PA_EINT5 */
  56. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 6),
  57. SUNXI_FUNCTION(0x0, "gpio_in"),
  58. SUNXI_FUNCTION(0x1, "gpio_out"),
  59. SUNXI_FUNCTION(0x2, "sim"), /* PWREN */
  60. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)), /* PA_EINT6 */
  61. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 7),
  62. SUNXI_FUNCTION(0x0, "gpio_in"),
  63. SUNXI_FUNCTION(0x1, "gpio_out"),
  64. SUNXI_FUNCTION(0x2, "sim"), /* CLK */
  65. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 7)), /* PA_EINT7 */
  66. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 8),
  67. SUNXI_FUNCTION(0x0, "gpio_in"),
  68. SUNXI_FUNCTION(0x1, "gpio_out"),
  69. SUNXI_FUNCTION(0x2, "sim"), /* DATA */
  70. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 8)), /* PA_EINT8 */
  71. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 9),
  72. SUNXI_FUNCTION(0x0, "gpio_in"),
  73. SUNXI_FUNCTION(0x1, "gpio_out"),
  74. SUNXI_FUNCTION(0x2, "sim"), /* RST */
  75. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 9)), /* PA_EINT9 */
  76. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 10),
  77. SUNXI_FUNCTION(0x0, "gpio_in"),
  78. SUNXI_FUNCTION(0x1, "gpio_out"),
  79. SUNXI_FUNCTION(0x2, "sim"), /* DET */
  80. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 10)), /* PA_EINT10 */
  81. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 11),
  82. SUNXI_FUNCTION(0x0, "gpio_in"),
  83. SUNXI_FUNCTION(0x1, "gpio_out"),
  84. SUNXI_FUNCTION(0x2, "i2c0"), /* SCK */
  85. SUNXI_FUNCTION(0x3, "di"), /* TX */
  86. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 11)), /* PA_EINT11 */
  87. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 12),
  88. SUNXI_FUNCTION(0x0, "gpio_in"),
  89. SUNXI_FUNCTION(0x1, "gpio_out"),
  90. SUNXI_FUNCTION(0x2, "i2c0"), /* SDA */
  91. SUNXI_FUNCTION(0x3, "di"), /* RX */
  92. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 12)), /* PA_EINT12 */
  93. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 13),
  94. SUNXI_FUNCTION(0x0, "gpio_in"),
  95. SUNXI_FUNCTION(0x1, "gpio_out"),
  96. SUNXI_FUNCTION(0x2, "spi1"), /* CS */
  97. SUNXI_FUNCTION(0x3, "uart3"), /* TX */
  98. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 13)), /* PA_EINT13 */
  99. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 14),
  100. SUNXI_FUNCTION(0x0, "gpio_in"),
  101. SUNXI_FUNCTION(0x1, "gpio_out"),
  102. SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
  103. SUNXI_FUNCTION(0x3, "uart3"), /* RX */
  104. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 14)), /* PA_EINT14 */
  105. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 15),
  106. SUNXI_FUNCTION(0x0, "gpio_in"),
  107. SUNXI_FUNCTION(0x1, "gpio_out"),
  108. SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
  109. SUNXI_FUNCTION(0x3, "uart3"), /* RTS */
  110. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 15)), /* PA_EINT15 */
  111. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 16),
  112. SUNXI_FUNCTION(0x0, "gpio_in"),
  113. SUNXI_FUNCTION(0x1, "gpio_out"),
  114. SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
  115. SUNXI_FUNCTION(0x3, "uart3"), /* CTS */
  116. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 16)), /* PA_EINT16 */
  117. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 17),
  118. SUNXI_FUNCTION(0x0, "gpio_in"),
  119. SUNXI_FUNCTION(0x1, "gpio_out"),
  120. SUNXI_FUNCTION(0x2, "spdif"), /* OUT */
  121. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 17)), /* PA_EINT17 */
  122. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 18),
  123. SUNXI_FUNCTION(0x0, "gpio_in"),
  124. SUNXI_FUNCTION(0x1, "gpio_out"),
  125. SUNXI_FUNCTION(0x2, "i2s0"), /* SYNC */
  126. SUNXI_FUNCTION(0x3, "i2c1"), /* SCK */
  127. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 18)), /* PA_EINT18 */
  128. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 19),
  129. SUNXI_FUNCTION(0x0, "gpio_in"),
  130. SUNXI_FUNCTION(0x1, "gpio_out"),
  131. SUNXI_FUNCTION(0x2, "i2s0"), /* CLK */
  132. SUNXI_FUNCTION(0x3, "i2c1"), /* SDA */
  133. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 19)), /* PA_EINT19 */
  134. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 20),
  135. SUNXI_FUNCTION(0x0, "gpio_in"),
  136. SUNXI_FUNCTION(0x1, "gpio_out"),
  137. SUNXI_FUNCTION(0x2, "i2s0"), /* DOUT */
  138. SUNXI_FUNCTION(0x3, "sim"), /* VPPEN */
  139. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 20)), /* PA_EINT20 */
  140. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 21),
  141. SUNXI_FUNCTION(0x0, "gpio_in"),
  142. SUNXI_FUNCTION(0x1, "gpio_out"),
  143. SUNXI_FUNCTION(0x2, "i2s0"), /* DIN */
  144. SUNXI_FUNCTION(0x3, "sim"), /* VPPPP */
  145. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 21)), /* PA_EINT21 */
  146. /* Hole */
  147. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0),
  148. SUNXI_FUNCTION(0x0, "gpio_in"),
  149. SUNXI_FUNCTION(0x1, "gpio_out"),
  150. SUNXI_FUNCTION(0x2, "nand0"), /* WE */
  151. SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
  152. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1),
  153. SUNXI_FUNCTION(0x0, "gpio_in"),
  154. SUNXI_FUNCTION(0x1, "gpio_out"),
  155. SUNXI_FUNCTION(0x2, "nand0"), /* ALE */
  156. SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
  157. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2),
  158. SUNXI_FUNCTION(0x0, "gpio_in"),
  159. SUNXI_FUNCTION(0x1, "gpio_out"),
  160. SUNXI_FUNCTION(0x2, "nand0"), /* CLE */
  161. SUNXI_FUNCTION(0x3, "spi0")), /* CLK */
  162. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3),
  163. SUNXI_FUNCTION(0x0, "gpio_in"),
  164. SUNXI_FUNCTION(0x1, "gpio_out"),
  165. SUNXI_FUNCTION(0x2, "nand0"), /* CE1 */
  166. SUNXI_FUNCTION(0x3, "spi0")), /* CS */
  167. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4),
  168. SUNXI_FUNCTION(0x0, "gpio_in"),
  169. SUNXI_FUNCTION(0x1, "gpio_out"),
  170. SUNXI_FUNCTION(0x2, "nand0")), /* CE0 */
  171. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5),
  172. SUNXI_FUNCTION(0x0, "gpio_in"),
  173. SUNXI_FUNCTION(0x1, "gpio_out"),
  174. SUNXI_FUNCTION(0x2, "nand0"), /* RE */
  175. SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
  176. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6),
  177. SUNXI_FUNCTION(0x0, "gpio_in"),
  178. SUNXI_FUNCTION(0x1, "gpio_out"),
  179. SUNXI_FUNCTION(0x2, "nand0"), /* RB0 */
  180. SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
  181. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7),
  182. SUNXI_FUNCTION(0x0, "gpio_in"),
  183. SUNXI_FUNCTION(0x1, "gpio_out"),
  184. SUNXI_FUNCTION(0x2, "nand0")), /* RB1 */
  185. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8),
  186. SUNXI_FUNCTION(0x0, "gpio_in"),
  187. SUNXI_FUNCTION(0x1, "gpio_out"),
  188. SUNXI_FUNCTION(0x2, "nand0"), /* DQ0 */
  189. SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
  190. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9),
  191. SUNXI_FUNCTION(0x0, "gpio_in"),
  192. SUNXI_FUNCTION(0x1, "gpio_out"),
  193. SUNXI_FUNCTION(0x2, "nand0"), /* DQ1 */
  194. SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
  195. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10),
  196. SUNXI_FUNCTION(0x0, "gpio_in"),
  197. SUNXI_FUNCTION(0x1, "gpio_out"),
  198. SUNXI_FUNCTION(0x2, "nand0"), /* DQ2 */
  199. SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
  200. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 11),
  201. SUNXI_FUNCTION(0x0, "gpio_in"),
  202. SUNXI_FUNCTION(0x1, "gpio_out"),
  203. SUNXI_FUNCTION(0x2, "nand0"), /* DQ3 */
  204. SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
  205. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 12),
  206. SUNXI_FUNCTION(0x0, "gpio_in"),
  207. SUNXI_FUNCTION(0x1, "gpio_out"),
  208. SUNXI_FUNCTION(0x2, "nand0"), /* DQ4 */
  209. SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */
  210. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 13),
  211. SUNXI_FUNCTION(0x0, "gpio_in"),
  212. SUNXI_FUNCTION(0x1, "gpio_out"),
  213. SUNXI_FUNCTION(0x2, "nand0"), /* DQ5 */
  214. SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */
  215. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14),
  216. SUNXI_FUNCTION(0x0, "gpio_in"),
  217. SUNXI_FUNCTION(0x1, "gpio_out"),
  218. SUNXI_FUNCTION(0x2, "nand0"), /* DQ6 */
  219. SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
  220. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15),
  221. SUNXI_FUNCTION(0x0, "gpio_in"),
  222. SUNXI_FUNCTION(0x1, "gpio_out"),
  223. SUNXI_FUNCTION(0x2, "nand0"), /* DQ7 */
  224. SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
  225. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16),
  226. SUNXI_FUNCTION(0x0, "gpio_in"),
  227. SUNXI_FUNCTION(0x1, "gpio_out"),
  228. SUNXI_FUNCTION(0x2, "nand0"), /* DQS */
  229. SUNXI_FUNCTION(0x3, "mmc2")), /* RST */
  230. /* Hole */
  231. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 0),
  232. SUNXI_FUNCTION(0x0, "gpio_in"),
  233. SUNXI_FUNCTION(0x1, "gpio_out"),
  234. SUNXI_FUNCTION(0x2, "emac")), /* RXD3 */
  235. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 1),
  236. SUNXI_FUNCTION(0x0, "gpio_in"),
  237. SUNXI_FUNCTION(0x1, "gpio_out"),
  238. SUNXI_FUNCTION(0x2, "emac")), /* RXD2 */
  239. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
  240. SUNXI_FUNCTION(0x0, "gpio_in"),
  241. SUNXI_FUNCTION(0x1, "gpio_out"),
  242. SUNXI_FUNCTION(0x2, "emac")), /* RXD1 */
  243. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3),
  244. SUNXI_FUNCTION(0x0, "gpio_in"),
  245. SUNXI_FUNCTION(0x1, "gpio_out"),
  246. SUNXI_FUNCTION(0x2, "emac")), /* RXD0 */
  247. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4),
  248. SUNXI_FUNCTION(0x0, "gpio_in"),
  249. SUNXI_FUNCTION(0x1, "gpio_out"),
  250. SUNXI_FUNCTION(0x2, "emac")), /* RXCK */
  251. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5),
  252. SUNXI_FUNCTION(0x0, "gpio_in"),
  253. SUNXI_FUNCTION(0x1, "gpio_out"),
  254. SUNXI_FUNCTION(0x2, "emac")), /* RXCTL/RXDV */
  255. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6),
  256. SUNXI_FUNCTION(0x0, "gpio_in"),
  257. SUNXI_FUNCTION(0x1, "gpio_out"),
  258. SUNXI_FUNCTION(0x2, "emac")), /* RXERR */
  259. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7),
  260. SUNXI_FUNCTION(0x0, "gpio_in"),
  261. SUNXI_FUNCTION(0x1, "gpio_out"),
  262. SUNXI_FUNCTION(0x2, "emac")), /* TXD3 */
  263. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 8),
  264. SUNXI_FUNCTION(0x0, "gpio_in"),
  265. SUNXI_FUNCTION(0x1, "gpio_out"),
  266. SUNXI_FUNCTION(0x2, "emac")), /* TXD2 */
  267. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 9),
  268. SUNXI_FUNCTION(0x0, "gpio_in"),
  269. SUNXI_FUNCTION(0x1, "gpio_out"),
  270. SUNXI_FUNCTION(0x2, "emac")), /* TXD1 */
  271. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 10),
  272. SUNXI_FUNCTION(0x0, "gpio_in"),
  273. SUNXI_FUNCTION(0x1, "gpio_out"),
  274. SUNXI_FUNCTION(0x2, "emac")), /* TXD0 */
  275. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 11),
  276. SUNXI_FUNCTION(0x0, "gpio_in"),
  277. SUNXI_FUNCTION(0x1, "gpio_out"),
  278. SUNXI_FUNCTION(0x2, "emac")), /* CRS */
  279. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 12),
  280. SUNXI_FUNCTION(0x0, "gpio_in"),
  281. SUNXI_FUNCTION(0x1, "gpio_out"),
  282. SUNXI_FUNCTION(0x2, "emac")), /* TXCK */
  283. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 13),
  284. SUNXI_FUNCTION(0x0, "gpio_in"),
  285. SUNXI_FUNCTION(0x1, "gpio_out"),
  286. SUNXI_FUNCTION(0x2, "emac")), /* TXCTL/TXEN */
  287. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 14),
  288. SUNXI_FUNCTION(0x0, "gpio_in"),
  289. SUNXI_FUNCTION(0x1, "gpio_out"),
  290. SUNXI_FUNCTION(0x2, "emac")), /* TXERR */
  291. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 15),
  292. SUNXI_FUNCTION(0x0, "gpio_in"),
  293. SUNXI_FUNCTION(0x1, "gpio_out"),
  294. SUNXI_FUNCTION(0x2, "emac")), /* CLKIN/COL */
  295. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 16),
  296. SUNXI_FUNCTION(0x0, "gpio_in"),
  297. SUNXI_FUNCTION(0x1, "gpio_out"),
  298. SUNXI_FUNCTION(0x2, "emac")), /* MDC */
  299. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 17),
  300. SUNXI_FUNCTION(0x0, "gpio_in"),
  301. SUNXI_FUNCTION(0x1, "gpio_out"),
  302. SUNXI_FUNCTION(0x2, "emac")), /* MDIO */
  303. /* Hole */
  304. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 0),
  305. SUNXI_FUNCTION(0x0, "gpio_in"),
  306. SUNXI_FUNCTION(0x1, "gpio_out"),
  307. SUNXI_FUNCTION(0x2, "csi"), /* PCLK */
  308. SUNXI_FUNCTION(0x3, "ts")), /* CLK */
  309. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 1),
  310. SUNXI_FUNCTION(0x0, "gpio_in"),
  311. SUNXI_FUNCTION(0x1, "gpio_out"),
  312. SUNXI_FUNCTION(0x2, "csi"), /* MCLK */
  313. SUNXI_FUNCTION(0x3, "ts")), /* ERR */
  314. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 2),
  315. SUNXI_FUNCTION(0x0, "gpio_in"),
  316. SUNXI_FUNCTION(0x1, "gpio_out"),
  317. SUNXI_FUNCTION(0x2, "csi"), /* HSYNC */
  318. SUNXI_FUNCTION(0x3, "ts")), /* SYNC */
  319. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 3),
  320. SUNXI_FUNCTION(0x0, "gpio_in"),
  321. SUNXI_FUNCTION(0x1, "gpio_out"),
  322. SUNXI_FUNCTION(0x2, "csi"), /* VSYNC */
  323. SUNXI_FUNCTION(0x3, "ts")), /* DVLD */
  324. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 4),
  325. SUNXI_FUNCTION(0x0, "gpio_in"),
  326. SUNXI_FUNCTION(0x1, "gpio_out"),
  327. SUNXI_FUNCTION(0x2, "csi"), /* D0 */
  328. SUNXI_FUNCTION(0x3, "ts")), /* D0 */
  329. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 5),
  330. SUNXI_FUNCTION(0x0, "gpio_in"),
  331. SUNXI_FUNCTION(0x1, "gpio_out"),
  332. SUNXI_FUNCTION(0x2, "csi"), /* D1 */
  333. SUNXI_FUNCTION(0x3, "ts")), /* D1 */
  334. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 6),
  335. SUNXI_FUNCTION(0x0, "gpio_in"),
  336. SUNXI_FUNCTION(0x1, "gpio_out"),
  337. SUNXI_FUNCTION(0x2, "csi"), /* D2 */
  338. SUNXI_FUNCTION(0x3, "ts")), /* D2 */
  339. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 7),
  340. SUNXI_FUNCTION(0x0, "gpio_in"),
  341. SUNXI_FUNCTION(0x1, "gpio_out"),
  342. SUNXI_FUNCTION(0x2, "csi"), /* D3 */
  343. SUNXI_FUNCTION(0x3, "ts")), /* D3 */
  344. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 8),
  345. SUNXI_FUNCTION(0x0, "gpio_in"),
  346. SUNXI_FUNCTION(0x1, "gpio_out"),
  347. SUNXI_FUNCTION(0x2, "csi"), /* D4 */
  348. SUNXI_FUNCTION(0x3, "ts")), /* D4 */
  349. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 9),
  350. SUNXI_FUNCTION(0x0, "gpio_in"),
  351. SUNXI_FUNCTION(0x1, "gpio_out"),
  352. SUNXI_FUNCTION(0x2, "csi"), /* D5 */
  353. SUNXI_FUNCTION(0x3, "ts")), /* D5 */
  354. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 10),
  355. SUNXI_FUNCTION(0x0, "gpio_in"),
  356. SUNXI_FUNCTION(0x1, "gpio_out"),
  357. SUNXI_FUNCTION(0x2, "csi"), /* D6 */
  358. SUNXI_FUNCTION(0x3, "ts")), /* D6 */
  359. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 11),
  360. SUNXI_FUNCTION(0x0, "gpio_in"),
  361. SUNXI_FUNCTION(0x1, "gpio_out"),
  362. SUNXI_FUNCTION(0x2, "csi"), /* D7 */
  363. SUNXI_FUNCTION(0x3, "ts")), /* D7 */
  364. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 12),
  365. SUNXI_FUNCTION(0x0, "gpio_in"),
  366. SUNXI_FUNCTION(0x1, "gpio_out"),
  367. SUNXI_FUNCTION(0x2, "csi"), /* SCK */
  368. SUNXI_FUNCTION(0x3, "i2c2")), /* SCK */
  369. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 13),
  370. SUNXI_FUNCTION(0x0, "gpio_in"),
  371. SUNXI_FUNCTION(0x1, "gpio_out"),
  372. SUNXI_FUNCTION(0x2, "csi"), /* SDA */
  373. SUNXI_FUNCTION(0x3, "i2c2")), /* SDA */
  374. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 14),
  375. SUNXI_FUNCTION(0x0, "gpio_in"),
  376. SUNXI_FUNCTION(0x1, "gpio_out")),
  377. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 15),
  378. SUNXI_FUNCTION(0x0, "gpio_in"),
  379. SUNXI_FUNCTION(0x1, "gpio_out")),
  380. /* Hole */
  381. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0),
  382. SUNXI_FUNCTION(0x0, "gpio_in"),
  383. SUNXI_FUNCTION(0x1, "gpio_out"),
  384. SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
  385. SUNXI_FUNCTION(0x3, "jtag")), /* MS */
  386. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1),
  387. SUNXI_FUNCTION(0x0, "gpio_in"),
  388. SUNXI_FUNCTION(0x1, "gpio_out"),
  389. SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
  390. SUNXI_FUNCTION(0x3, "jtag")), /* DI */
  391. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2),
  392. SUNXI_FUNCTION(0x0, "gpio_in"),
  393. SUNXI_FUNCTION(0x1, "gpio_out"),
  394. SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
  395. SUNXI_FUNCTION(0x3, "uart0")), /* TX */
  396. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3),
  397. SUNXI_FUNCTION(0x0, "gpio_in"),
  398. SUNXI_FUNCTION(0x1, "gpio_out"),
  399. SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
  400. SUNXI_FUNCTION(0x3, "jtag")), /* DO */
  401. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4),
  402. SUNXI_FUNCTION(0x0, "gpio_in"),
  403. SUNXI_FUNCTION(0x1, "gpio_out"),
  404. SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
  405. SUNXI_FUNCTION(0x3, "uart0")), /* RX */
  406. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5),
  407. SUNXI_FUNCTION(0x0, "gpio_in"),
  408. SUNXI_FUNCTION(0x1, "gpio_out"),
  409. SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
  410. SUNXI_FUNCTION(0x3, "jtag")), /* CK */
  411. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 6),
  412. SUNXI_FUNCTION(0x0, "gpio_in"),
  413. SUNXI_FUNCTION(0x1, "gpio_out")),
  414. /* Hole */
  415. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
  416. SUNXI_FUNCTION(0x0, "gpio_in"),
  417. SUNXI_FUNCTION(0x1, "gpio_out"),
  418. SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
  419. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 0)), /* PG_EINT0 */
  420. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
  421. SUNXI_FUNCTION(0x0, "gpio_in"),
  422. SUNXI_FUNCTION(0x1, "gpio_out"),
  423. SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
  424. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 1)), /* PG_EINT1 */
  425. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
  426. SUNXI_FUNCTION(0x0, "gpio_in"),
  427. SUNXI_FUNCTION(0x1, "gpio_out"),
  428. SUNXI_FUNCTION(0x2, "mmc1"), /* D0 */
  429. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 2)), /* PG_EINT2 */
  430. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
  431. SUNXI_FUNCTION(0x0, "gpio_in"),
  432. SUNXI_FUNCTION(0x1, "gpio_out"),
  433. SUNXI_FUNCTION(0x2, "mmc1"), /* D1 */
  434. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 3)), /* PG_EINT3 */
  435. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
  436. SUNXI_FUNCTION(0x0, "gpio_in"),
  437. SUNXI_FUNCTION(0x1, "gpio_out"),
  438. SUNXI_FUNCTION(0x2, "mmc1"), /* D2 */
  439. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 4)), /* PG_EINT4 */
  440. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
  441. SUNXI_FUNCTION(0x0, "gpio_in"),
  442. SUNXI_FUNCTION(0x1, "gpio_out"),
  443. SUNXI_FUNCTION(0x2, "mmc1"), /* D3 */
  444. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 5)), /* PG_EINT5 */
  445. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6),
  446. SUNXI_FUNCTION(0x0, "gpio_in"),
  447. SUNXI_FUNCTION(0x1, "gpio_out"),
  448. SUNXI_FUNCTION(0x2, "uart1"), /* TX */
  449. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 6)), /* PG_EINT6 */
  450. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7),
  451. SUNXI_FUNCTION(0x0, "gpio_in"),
  452. SUNXI_FUNCTION(0x1, "gpio_out"),
  453. SUNXI_FUNCTION(0x2, "uart1"), /* RX */
  454. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 7)), /* PG_EINT7 */
  455. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
  456. SUNXI_FUNCTION(0x0, "gpio_in"),
  457. SUNXI_FUNCTION(0x1, "gpio_out"),
  458. SUNXI_FUNCTION(0x2, "uart1"), /* RTS */
  459. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 8)), /* PG_EINT8 */
  460. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
  461. SUNXI_FUNCTION(0x0, "gpio_in"),
  462. SUNXI_FUNCTION(0x1, "gpio_out"),
  463. SUNXI_FUNCTION(0x2, "uart1"), /* CTS */
  464. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 9)), /* PG_EINT9 */
  465. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
  466. SUNXI_FUNCTION(0x0, "gpio_in"),
  467. SUNXI_FUNCTION(0x1, "gpio_out"),
  468. SUNXI_FUNCTION(0x2, "i2s1"), /* SYNC */
  469. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 10)), /* PG_EINT10 */
  470. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11),
  471. SUNXI_FUNCTION(0x0, "gpio_in"),
  472. SUNXI_FUNCTION(0x1, "gpio_out"),
  473. SUNXI_FUNCTION(0x2, "i2s1"), /* CLK */
  474. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 11)), /* PG_EINT11 */
  475. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),
  476. SUNXI_FUNCTION(0x0, "gpio_in"),
  477. SUNXI_FUNCTION(0x1, "gpio_out"),
  478. SUNXI_FUNCTION(0x2, "i2s1"), /* DOUT */
  479. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 12)), /* PG_EINT12 */
  480. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13),
  481. SUNXI_FUNCTION(0x0, "gpio_in"),
  482. SUNXI_FUNCTION(0x1, "gpio_out"),
  483. SUNXI_FUNCTION(0x2, "i2s1"), /* DIN */
  484. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 13)), /* PG_EINT13 */
  485. };
  486. static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = {
  487. .pins = sun8i_h3_pins,
  488. .npins = ARRAY_SIZE(sun8i_h3_pins),
  489. .irq_banks = 2,
  490. .irq_read_needs_mux = true
  491. };
  492. static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)
  493. {
  494. return sunxi_pinctrl_init(pdev,
  495. &sun8i_h3_pinctrl_data);
  496. }
  497. static const struct of_device_id sun8i_h3_pinctrl_match[] = {
  498. { .compatible = "allwinner,sun8i-h3-pinctrl", },
  499. {}
  500. };
  501. static struct platform_driver sun8i_h3_pinctrl_driver = {
  502. .probe = sun8i_h3_pinctrl_probe,
  503. .driver = {
  504. .name = "sun8i-h3-pinctrl",
  505. .of_match_table = sun8i_h3_pinctrl_match,
  506. },
  507. };
  508. builtin_platform_driver(sun8i_h3_pinctrl_driver);