pinctrl-sun8i-a23.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. /*
  2. * Allwinner A23 SoCs pinctrl driver.
  3. *
  4. * Copyright (C) 2014 Chen-Yu Tsai
  5. *
  6. * Chen-Yu Tsai <wens@csie.org>
  7. *
  8. * Copyright (C) 2014 Maxime Ripard
  9. *
  10. * Maxime Ripard <maxime.ripard@free-electrons.com>
  11. *
  12. * This file is licensed under the terms of the GNU General Public
  13. * License version 2. This program is licensed "as is" without any
  14. * warranty of any kind, whether express or implied.
  15. */
  16. #include <linux/module.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/of.h>
  19. #include <linux/of_device.h>
  20. #include <linux/pinctrl/pinctrl.h>
  21. #include "pinctrl-sunxi.h"
  22. static const struct sunxi_desc_pin sun8i_a23_pins[] = {
  23. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 0),
  24. SUNXI_FUNCTION(0x0, "gpio_in"),
  25. SUNXI_FUNCTION(0x1, "gpio_out"),
  26. SUNXI_FUNCTION(0x2, "spi1"), /* CS */
  27. SUNXI_FUNCTION(0x3, "jtag"), /* MS0 */
  28. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 0)), /* PA_EINT0 */
  29. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 1),
  30. SUNXI_FUNCTION(0x0, "gpio_in"),
  31. SUNXI_FUNCTION(0x1, "gpio_out"),
  32. SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
  33. SUNXI_FUNCTION(0x3, "jtag"), /* CKO */
  34. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 1)), /* PA_EINT1 */
  35. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 2),
  36. SUNXI_FUNCTION(0x0, "gpio_in"),
  37. SUNXI_FUNCTION(0x1, "gpio_out"),
  38. SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
  39. SUNXI_FUNCTION(0x3, "jtag"), /* DOO */
  40. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 2)), /* PA_EINT2 */
  41. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 3),
  42. SUNXI_FUNCTION(0x0, "gpio_in"),
  43. SUNXI_FUNCTION(0x1, "gpio_out"),
  44. SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
  45. SUNXI_FUNCTION(0x3, "jtag"), /* DIO */
  46. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 3)), /* PA_EINT3 */
  47. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 4),
  48. SUNXI_FUNCTION(0x0, "gpio_in"),
  49. SUNXI_FUNCTION(0x1, "gpio_out"),
  50. SUNXI_FUNCTION(0x2, "uart4"), /* TX */
  51. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 4)), /* PA_EINT4 */
  52. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 5),
  53. SUNXI_FUNCTION(0x0, "gpio_in"),
  54. SUNXI_FUNCTION(0x1, "gpio_out"),
  55. SUNXI_FUNCTION(0x2, "uart4"), /* RX */
  56. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 5)), /* PA_EINT5 */
  57. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 6),
  58. SUNXI_FUNCTION(0x0, "gpio_in"),
  59. SUNXI_FUNCTION(0x1, "gpio_out"),
  60. SUNXI_FUNCTION(0x2, "uart4"), /* RTS */
  61. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 6)), /* PA_EINT6 */
  62. SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 7),
  63. SUNXI_FUNCTION(0x0, "gpio_in"),
  64. SUNXI_FUNCTION(0x1, "gpio_out"),
  65. SUNXI_FUNCTION(0x2, "uart4"), /* CTS */
  66. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 7)), /* PA_EINT7 */
  67. /* Hole */
  68. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 0),
  69. SUNXI_FUNCTION(0x0, "gpio_in"),
  70. SUNXI_FUNCTION(0x1, "gpio_out"),
  71. SUNXI_FUNCTION(0x2, "uart2"), /* TX */
  72. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 0)), /* PB_EINT0 */
  73. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 1),
  74. SUNXI_FUNCTION(0x0, "gpio_in"),
  75. SUNXI_FUNCTION(0x1, "gpio_out"),
  76. SUNXI_FUNCTION(0x2, "uart2"), /* RX */
  77. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 1)), /* PB_EINT1 */
  78. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 2),
  79. SUNXI_FUNCTION(0x0, "gpio_in"),
  80. SUNXI_FUNCTION(0x1, "gpio_out"),
  81. SUNXI_FUNCTION(0x2, "uart2"), /* RTS */
  82. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 2)), /* PB_EINT2 */
  83. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 3),
  84. SUNXI_FUNCTION(0x0, "gpio_in"),
  85. SUNXI_FUNCTION(0x1, "gpio_out"),
  86. SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
  87. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 3)), /* PB_EINT3 */
  88. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 4),
  89. SUNXI_FUNCTION(0x0, "gpio_in"),
  90. SUNXI_FUNCTION(0x1, "gpio_out"),
  91. SUNXI_FUNCTION(0x2, "i2s0"), /* SYNC */
  92. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 4)), /* PB_EINT4 */
  93. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 5),
  94. SUNXI_FUNCTION(0x0, "gpio_in"),
  95. SUNXI_FUNCTION(0x1, "gpio_out"),
  96. SUNXI_FUNCTION(0x2, "i2s0"), /* DOUT */
  97. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 5)), /* PB_EINT5 */
  98. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 6),
  99. SUNXI_FUNCTION(0x0, "gpio_in"),
  100. SUNXI_FUNCTION(0x1, "gpio_out"),
  101. SUNXI_FUNCTION(0x2, "i2s0"), /* DIN */
  102. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 6)), /* PB_EINT6 */
  103. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 7),
  104. SUNXI_FUNCTION(0x0, "gpio_in"),
  105. SUNXI_FUNCTION(0x1, "gpio_out"),
  106. SUNXI_FUNCTION(0x3, "i2s0"), /* DI */
  107. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 7)), /* PB_EINT7 */
  108. /* Hole */
  109. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0),
  110. SUNXI_FUNCTION(0x0, "gpio_in"),
  111. SUNXI_FUNCTION(0x1, "gpio_out"),
  112. SUNXI_FUNCTION(0x2, "nand0"), /* WE */
  113. SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
  114. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1),
  115. SUNXI_FUNCTION(0x0, "gpio_in"),
  116. SUNXI_FUNCTION(0x1, "gpio_out"),
  117. SUNXI_FUNCTION(0x2, "nand0"), /* ALE */
  118. SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
  119. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2),
  120. SUNXI_FUNCTION(0x0, "gpio_in"),
  121. SUNXI_FUNCTION(0x1, "gpio_out"),
  122. SUNXI_FUNCTION(0x2, "nand0"), /* CLE */
  123. SUNXI_FUNCTION(0x3, "spi0")), /* CLK */
  124. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3),
  125. SUNXI_FUNCTION(0x0, "gpio_in"),
  126. SUNXI_FUNCTION(0x1, "gpio_out"),
  127. SUNXI_FUNCTION(0x2, "nand0"), /* CE1 */
  128. SUNXI_FUNCTION(0x3, "spi0")), /* CS */
  129. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4),
  130. SUNXI_FUNCTION(0x0, "gpio_in"),
  131. SUNXI_FUNCTION(0x1, "gpio_out"),
  132. SUNXI_FUNCTION(0x2, "nand0")), /* CE0 */
  133. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5),
  134. SUNXI_FUNCTION(0x0, "gpio_in"),
  135. SUNXI_FUNCTION(0x1, "gpio_out"),
  136. SUNXI_FUNCTION(0x2, "nand0"), /* RE */
  137. SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
  138. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6),
  139. SUNXI_FUNCTION(0x0, "gpio_in"),
  140. SUNXI_FUNCTION(0x1, "gpio_out"),
  141. SUNXI_FUNCTION(0x2, "nand0"), /* RB0 */
  142. SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
  143. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7),
  144. SUNXI_FUNCTION(0x0, "gpio_in"),
  145. SUNXI_FUNCTION(0x1, "gpio_out"),
  146. SUNXI_FUNCTION(0x2, "nand0")), /* RB1 */
  147. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8),
  148. SUNXI_FUNCTION(0x0, "gpio_in"),
  149. SUNXI_FUNCTION(0x1, "gpio_out"),
  150. SUNXI_FUNCTION(0x2, "nand0"), /* DQ0 */
  151. SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
  152. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9),
  153. SUNXI_FUNCTION(0x0, "gpio_in"),
  154. SUNXI_FUNCTION(0x1, "gpio_out"),
  155. SUNXI_FUNCTION(0x2, "nand0"), /* DQ1 */
  156. SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
  157. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10),
  158. SUNXI_FUNCTION(0x0, "gpio_in"),
  159. SUNXI_FUNCTION(0x1, "gpio_out"),
  160. SUNXI_FUNCTION(0x2, "nand0"), /* DQ2 */
  161. SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
  162. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 11),
  163. SUNXI_FUNCTION(0x0, "gpio_in"),
  164. SUNXI_FUNCTION(0x1, "gpio_out"),
  165. SUNXI_FUNCTION(0x2, "nand0"), /* DQ3 */
  166. SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
  167. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 12),
  168. SUNXI_FUNCTION(0x0, "gpio_in"),
  169. SUNXI_FUNCTION(0x1, "gpio_out"),
  170. SUNXI_FUNCTION(0x2, "nand0"), /* DQ4 */
  171. SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */
  172. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 13),
  173. SUNXI_FUNCTION(0x0, "gpio_in"),
  174. SUNXI_FUNCTION(0x1, "gpio_out"),
  175. SUNXI_FUNCTION(0x2, "nand0"), /* DQ5 */
  176. SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */
  177. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14),
  178. SUNXI_FUNCTION(0x0, "gpio_in"),
  179. SUNXI_FUNCTION(0x1, "gpio_out"),
  180. SUNXI_FUNCTION(0x2, "nand0"), /* DQ6 */
  181. SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
  182. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15),
  183. SUNXI_FUNCTION(0x0, "gpio_in"),
  184. SUNXI_FUNCTION(0x1, "gpio_out"),
  185. SUNXI_FUNCTION(0x2, "nand0"), /* DQ7 */
  186. SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
  187. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16),
  188. SUNXI_FUNCTION(0x0, "gpio_in"),
  189. SUNXI_FUNCTION(0x1, "gpio_out"),
  190. SUNXI_FUNCTION(0x2, "nand0"), /* DQS */
  191. SUNXI_FUNCTION(0x3, "mmc2")), /* RST */
  192. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 17),
  193. SUNXI_FUNCTION(0x0, "gpio_in"),
  194. SUNXI_FUNCTION(0x1, "gpio_out"),
  195. SUNXI_FUNCTION(0x2, "nand0")), /* CE2 */
  196. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 18),
  197. SUNXI_FUNCTION(0x0, "gpio_in"),
  198. SUNXI_FUNCTION(0x1, "gpio_out"),
  199. SUNXI_FUNCTION(0x2, "nand0")), /* CE3 */
  200. /* Hole */
  201. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 0),
  202. SUNXI_FUNCTION(0x0, "gpio_in"),
  203. SUNXI_FUNCTION(0x1, "gpio_out"),
  204. SUNXI_FUNCTION(0x2, "lcd0")), /* D0 */
  205. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 1),
  206. SUNXI_FUNCTION(0x0, "gpio_in"),
  207. SUNXI_FUNCTION(0x1, "gpio_out"),
  208. SUNXI_FUNCTION(0x2, "lcd0")), /* D1 */
  209. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
  210. SUNXI_FUNCTION(0x0, "gpio_in"),
  211. SUNXI_FUNCTION(0x1, "gpio_out"),
  212. SUNXI_FUNCTION(0x2, "lcd0"), /* D2 */
  213. SUNXI_FUNCTION(0x3, "mmc1")), /* CLK */
  214. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3),
  215. SUNXI_FUNCTION(0x0, "gpio_in"),
  216. SUNXI_FUNCTION(0x1, "gpio_out"),
  217. SUNXI_FUNCTION(0x2, "lcd0"), /* D3 */
  218. SUNXI_FUNCTION(0x3, "mmc1")), /* CMD */
  219. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4),
  220. SUNXI_FUNCTION(0x0, "gpio_in"),
  221. SUNXI_FUNCTION(0x1, "gpio_out"),
  222. SUNXI_FUNCTION(0x2, "lcd0"), /* D4 */
  223. SUNXI_FUNCTION(0x3, "mmc1")), /* D0 */
  224. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5),
  225. SUNXI_FUNCTION(0x0, "gpio_in"),
  226. SUNXI_FUNCTION(0x1, "gpio_out"),
  227. SUNXI_FUNCTION(0x2, "lcd0"), /* D5 */
  228. SUNXI_FUNCTION(0x3, "mmc1")), /* D1 */
  229. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6),
  230. SUNXI_FUNCTION(0x0, "gpio_in"),
  231. SUNXI_FUNCTION(0x1, "gpio_out"),
  232. SUNXI_FUNCTION(0x2, "lcd0"), /* D6 */
  233. SUNXI_FUNCTION(0x3, "mmc1")), /* D2 */
  234. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7),
  235. SUNXI_FUNCTION(0x0, "gpio_in"),
  236. SUNXI_FUNCTION(0x1, "gpio_out"),
  237. SUNXI_FUNCTION(0x2, "lcd0"), /* D7 */
  238. SUNXI_FUNCTION(0x3, "mmc1")), /* D3 */
  239. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 8),
  240. SUNXI_FUNCTION(0x0, "gpio_in"),
  241. SUNXI_FUNCTION(0x1, "gpio_out"),
  242. SUNXI_FUNCTION(0x2, "lcd0"), /* D8 */
  243. SUNXI_FUNCTION(0x3, "uart3")), /* TX */
  244. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 9),
  245. SUNXI_FUNCTION(0x0, "gpio_in"),
  246. SUNXI_FUNCTION(0x1, "gpio_out"),
  247. SUNXI_FUNCTION(0x2, "lcd0"), /* D9 */
  248. SUNXI_FUNCTION(0x3, "uart3")), /* RX */
  249. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 10),
  250. SUNXI_FUNCTION(0x0, "gpio_in"),
  251. SUNXI_FUNCTION(0x1, "gpio_out"),
  252. SUNXI_FUNCTION(0x2, "lcd0"), /* D10 */
  253. SUNXI_FUNCTION(0x3, "uart1")), /* TX */
  254. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 11),
  255. SUNXI_FUNCTION(0x0, "gpio_in"),
  256. SUNXI_FUNCTION(0x1, "gpio_out"),
  257. SUNXI_FUNCTION(0x2, "lcd0"), /* D11 */
  258. SUNXI_FUNCTION(0x3, "uart1")), /* RX */
  259. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 12),
  260. SUNXI_FUNCTION(0x0, "gpio_in"),
  261. SUNXI_FUNCTION(0x1, "gpio_out"),
  262. SUNXI_FUNCTION(0x2, "lcd0"), /* D12 */
  263. SUNXI_FUNCTION(0x3, "uart1")), /* RTS */
  264. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 13),
  265. SUNXI_FUNCTION(0x0, "gpio_in"),
  266. SUNXI_FUNCTION(0x1, "gpio_out"),
  267. SUNXI_FUNCTION(0x2, "lcd0"), /* D13 */
  268. SUNXI_FUNCTION(0x3, "uart1")), /* CTS */
  269. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 14),
  270. SUNXI_FUNCTION(0x0, "gpio_in"),
  271. SUNXI_FUNCTION(0x1, "gpio_out"),
  272. SUNXI_FUNCTION(0x2, "lcd0"), /* D14 */
  273. SUNXI_FUNCTION(0x3, "i2s1")), /* SYNC */
  274. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 15),
  275. SUNXI_FUNCTION(0x0, "gpio_in"),
  276. SUNXI_FUNCTION(0x1, "gpio_out"),
  277. SUNXI_FUNCTION(0x2, "lcd0"), /* D15 */
  278. SUNXI_FUNCTION(0x3, "i2s1")), /* CLK */
  279. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 16),
  280. SUNXI_FUNCTION(0x0, "gpio_in"),
  281. SUNXI_FUNCTION(0x1, "gpio_out"),
  282. SUNXI_FUNCTION(0x2, "lcd0"), /* D16 */
  283. SUNXI_FUNCTION(0x3, "i2s1")), /* DOUT */
  284. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 17),
  285. SUNXI_FUNCTION(0x0, "gpio_in"),
  286. SUNXI_FUNCTION(0x1, "gpio_out"),
  287. SUNXI_FUNCTION(0x2, "lcd0"), /* D17 */
  288. SUNXI_FUNCTION(0x3, "i2s1")), /* DIN */
  289. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 18),
  290. SUNXI_FUNCTION(0x0, "gpio_in"),
  291. SUNXI_FUNCTION(0x1, "gpio_out"),
  292. SUNXI_FUNCTION(0x2, "lcd0"), /* D18 */
  293. SUNXI_FUNCTION(0x3, "lvds0")), /* VN0 */
  294. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 19),
  295. SUNXI_FUNCTION(0x0, "gpio_in"),
  296. SUNXI_FUNCTION(0x1, "gpio_out"),
  297. SUNXI_FUNCTION(0x2, "lcd0"), /* D19 */
  298. SUNXI_FUNCTION(0x3, "lvds0")), /* VP0 */
  299. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 20),
  300. SUNXI_FUNCTION(0x0, "gpio_in"),
  301. SUNXI_FUNCTION(0x1, "gpio_out"),
  302. SUNXI_FUNCTION(0x2, "lcd0"), /* D20 */
  303. SUNXI_FUNCTION(0x3, "lvds0")), /* VP1 */
  304. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 21),
  305. SUNXI_FUNCTION(0x0, "gpio_in"),
  306. SUNXI_FUNCTION(0x1, "gpio_out"),
  307. SUNXI_FUNCTION(0x2, "lcd0"), /* D21 */
  308. SUNXI_FUNCTION(0x3, "lvds0")), /* VN1 */
  309. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 22),
  310. SUNXI_FUNCTION(0x0, "gpio_in"),
  311. SUNXI_FUNCTION(0x1, "gpio_out"),
  312. SUNXI_FUNCTION(0x2, "lcd0"), /* D22 */
  313. SUNXI_FUNCTION(0x3, "lvds0")), /* VP2 */
  314. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 23),
  315. SUNXI_FUNCTION(0x0, "gpio_in"),
  316. SUNXI_FUNCTION(0x1, "gpio_out"),
  317. SUNXI_FUNCTION(0x2, "lcd0"), /* D23 */
  318. SUNXI_FUNCTION(0x3, "lvds0")), /* VN2 */
  319. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 24),
  320. SUNXI_FUNCTION(0x0, "gpio_in"),
  321. SUNXI_FUNCTION(0x1, "gpio_out"),
  322. SUNXI_FUNCTION(0x2, "lcd0"), /* CLK */
  323. SUNXI_FUNCTION(0x3, "lvds0")), /* VPC */
  324. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 25),
  325. SUNXI_FUNCTION(0x0, "gpio_in"),
  326. SUNXI_FUNCTION(0x1, "gpio_out"),
  327. SUNXI_FUNCTION(0x2, "lcd0"), /* DE */
  328. SUNXI_FUNCTION(0x3, "lvds0")), /* VNC */
  329. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 26),
  330. SUNXI_FUNCTION(0x0, "gpio_in"),
  331. SUNXI_FUNCTION(0x1, "gpio_out"),
  332. SUNXI_FUNCTION(0x2, "lcd0"), /* HSYNC */
  333. SUNXI_FUNCTION(0x3, "lvds0")), /* VP3 */
  334. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 27),
  335. SUNXI_FUNCTION(0x0, "gpio_in"),
  336. SUNXI_FUNCTION(0x1, "gpio_out"),
  337. SUNXI_FUNCTION(0x2, "lcd0"), /* VSYNC */
  338. SUNXI_FUNCTION(0x3, "lvds0")), /* VN3 */
  339. /* Hole */
  340. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 0),
  341. SUNXI_FUNCTION(0x0, "gpio_in"),
  342. SUNXI_FUNCTION(0x1, "gpio_out"),
  343. SUNXI_FUNCTION(0x2, "csi")), /* PCLK */
  344. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 1),
  345. SUNXI_FUNCTION(0x0, "gpio_in"),
  346. SUNXI_FUNCTION(0x1, "gpio_out"),
  347. SUNXI_FUNCTION(0x2, "csi")), /* MCLK */
  348. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 2),
  349. SUNXI_FUNCTION(0x0, "gpio_in"),
  350. SUNXI_FUNCTION(0x1, "gpio_out"),
  351. SUNXI_FUNCTION(0x2, "csi")), /* HSYNC */
  352. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 3),
  353. SUNXI_FUNCTION(0x0, "gpio_in"),
  354. SUNXI_FUNCTION(0x1, "gpio_out"),
  355. SUNXI_FUNCTION(0x2, "csi")), /* VSYNC */
  356. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 4),
  357. SUNXI_FUNCTION(0x0, "gpio_in"),
  358. SUNXI_FUNCTION(0x1, "gpio_out"),
  359. SUNXI_FUNCTION(0x2, "csi")), /* D0 */
  360. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 5),
  361. SUNXI_FUNCTION(0x0, "gpio_in"),
  362. SUNXI_FUNCTION(0x1, "gpio_out"),
  363. SUNXI_FUNCTION(0x2, "csi")), /* D1 */
  364. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 6),
  365. SUNXI_FUNCTION(0x0, "gpio_in"),
  366. SUNXI_FUNCTION(0x1, "gpio_out"),
  367. SUNXI_FUNCTION(0x2, "csi")), /* D2 */
  368. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 7),
  369. SUNXI_FUNCTION(0x0, "gpio_in"),
  370. SUNXI_FUNCTION(0x1, "gpio_out"),
  371. SUNXI_FUNCTION(0x2, "csi")), /* D3 */
  372. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 8),
  373. SUNXI_FUNCTION(0x0, "gpio_in"),
  374. SUNXI_FUNCTION(0x1, "gpio_out"),
  375. SUNXI_FUNCTION(0x2, "csi")), /* D4 */
  376. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 9),
  377. SUNXI_FUNCTION(0x0, "gpio_in"),
  378. SUNXI_FUNCTION(0x1, "gpio_out"),
  379. SUNXI_FUNCTION(0x2, "csi")), /* D5 */
  380. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 10),
  381. SUNXI_FUNCTION(0x0, "gpio_in"),
  382. SUNXI_FUNCTION(0x1, "gpio_out"),
  383. SUNXI_FUNCTION(0x2, "csi")), /* D6 */
  384. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 11),
  385. SUNXI_FUNCTION(0x0, "gpio_in"),
  386. SUNXI_FUNCTION(0x1, "gpio_out"),
  387. SUNXI_FUNCTION(0x2, "csi")), /* D7 */
  388. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 12),
  389. SUNXI_FUNCTION(0x0, "gpio_in"),
  390. SUNXI_FUNCTION(0x1, "gpio_out"),
  391. SUNXI_FUNCTION(0x2, "csi"), /* SCK */
  392. SUNXI_FUNCTION(0x3, "i2c2")), /* SCK */
  393. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 13),
  394. SUNXI_FUNCTION(0x0, "gpio_in"),
  395. SUNXI_FUNCTION(0x1, "gpio_out"),
  396. SUNXI_FUNCTION(0x2, "csi"), /* SDA */
  397. SUNXI_FUNCTION(0x3, "i2c2")), /* SDA */
  398. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 14),
  399. SUNXI_FUNCTION(0x0, "gpio_in"),
  400. SUNXI_FUNCTION(0x1, "gpio_out")),
  401. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 15),
  402. SUNXI_FUNCTION(0x0, "gpio_in"),
  403. SUNXI_FUNCTION(0x1, "gpio_out")),
  404. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 16),
  405. SUNXI_FUNCTION(0x0, "gpio_in"),
  406. SUNXI_FUNCTION(0x1, "gpio_out")),
  407. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 17),
  408. SUNXI_FUNCTION(0x0, "gpio_in"),
  409. SUNXI_FUNCTION(0x1, "gpio_out")),
  410. /* Hole */
  411. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0),
  412. SUNXI_FUNCTION(0x0, "gpio_in"),
  413. SUNXI_FUNCTION(0x1, "gpio_out"),
  414. SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
  415. SUNXI_FUNCTION(0x3, "jtag")), /* MS1 */
  416. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1),
  417. SUNXI_FUNCTION(0x0, "gpio_in"),
  418. SUNXI_FUNCTION(0x1, "gpio_out"),
  419. SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
  420. SUNXI_FUNCTION(0x3, "jtag")), /* DI1 */
  421. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2),
  422. SUNXI_FUNCTION(0x0, "gpio_in"),
  423. SUNXI_FUNCTION(0x1, "gpio_out"),
  424. SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
  425. SUNXI_FUNCTION(0x3, "uart0")), /* TX */
  426. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3),
  427. SUNXI_FUNCTION(0x0, "gpio_in"),
  428. SUNXI_FUNCTION(0x1, "gpio_out"),
  429. SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
  430. SUNXI_FUNCTION(0x3, "jtag")), /* DO1 */
  431. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4),
  432. SUNXI_FUNCTION(0x0, "gpio_in"),
  433. SUNXI_FUNCTION(0x1, "gpio_out"),
  434. SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
  435. SUNXI_FUNCTION(0x3, "uart0")), /* RX */
  436. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5),
  437. SUNXI_FUNCTION(0x0, "gpio_in"),
  438. SUNXI_FUNCTION(0x1, "gpio_out"),
  439. SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
  440. SUNXI_FUNCTION(0x3, "jtag")), /* CK1 */
  441. /* Hole */
  442. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
  443. SUNXI_FUNCTION(0x0, "gpio_in"),
  444. SUNXI_FUNCTION(0x1, "gpio_out"),
  445. SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
  446. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 0)), /* PG_EINT0 */
  447. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
  448. SUNXI_FUNCTION(0x0, "gpio_in"),
  449. SUNXI_FUNCTION(0x1, "gpio_out"),
  450. SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
  451. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 1)), /* PG_EINT1 */
  452. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
  453. SUNXI_FUNCTION(0x0, "gpio_in"),
  454. SUNXI_FUNCTION(0x1, "gpio_out"),
  455. SUNXI_FUNCTION(0x2, "mmc1"), /* D0 */
  456. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 2)), /* PG_EINT2 */
  457. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
  458. SUNXI_FUNCTION(0x0, "gpio_in"),
  459. SUNXI_FUNCTION(0x1, "gpio_out"),
  460. SUNXI_FUNCTION(0x2, "mmc1"), /* D1 */
  461. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 3)), /* PG_EINT3 */
  462. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
  463. SUNXI_FUNCTION(0x0, "gpio_in"),
  464. SUNXI_FUNCTION(0x1, "gpio_out"),
  465. SUNXI_FUNCTION(0x2, "mmc1"), /* D2 */
  466. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 4)), /* PG_EINT4 */
  467. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
  468. SUNXI_FUNCTION(0x0, "gpio_in"),
  469. SUNXI_FUNCTION(0x1, "gpio_out"),
  470. SUNXI_FUNCTION(0x2, "mmc1"), /* D3 */
  471. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 5)), /* PG_EINT5 */
  472. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6),
  473. SUNXI_FUNCTION(0x0, "gpio_in"),
  474. SUNXI_FUNCTION(0x1, "gpio_out"),
  475. SUNXI_FUNCTION(0x2, "uart1"), /* TX */
  476. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 6)), /* PG_EINT6 */
  477. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7),
  478. SUNXI_FUNCTION(0x0, "gpio_in"),
  479. SUNXI_FUNCTION(0x1, "gpio_out"),
  480. SUNXI_FUNCTION(0x2, "uart1"), /* RX */
  481. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 7)), /* PG_EINT7 */
  482. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
  483. SUNXI_FUNCTION(0x0, "gpio_in"),
  484. SUNXI_FUNCTION(0x1, "gpio_out"),
  485. SUNXI_FUNCTION(0x2, "uart1"), /* RTS */
  486. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 8)), /* PG_EINT8 */
  487. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
  488. SUNXI_FUNCTION(0x0, "gpio_in"),
  489. SUNXI_FUNCTION(0x1, "gpio_out"),
  490. SUNXI_FUNCTION(0x2, "uart1"), /* CTS */
  491. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 9)), /* PG_EINT9 */
  492. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
  493. SUNXI_FUNCTION(0x0, "gpio_in"),
  494. SUNXI_FUNCTION(0x1, "gpio_out"),
  495. SUNXI_FUNCTION(0x2, "i2s1"), /* SYNC */
  496. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 10)), /* PG_EINT10 */
  497. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11),
  498. SUNXI_FUNCTION(0x0, "gpio_in"),
  499. SUNXI_FUNCTION(0x1, "gpio_out"),
  500. SUNXI_FUNCTION(0x2, "i2s1"), /* CLK */
  501. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 11)), /* PG_EINT11 */
  502. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),
  503. SUNXI_FUNCTION(0x0, "gpio_in"),
  504. SUNXI_FUNCTION(0x1, "gpio_out"),
  505. SUNXI_FUNCTION(0x2, "i2s1"), /* DOUT */
  506. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 12)), /* PG_EINT12 */
  507. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13),
  508. SUNXI_FUNCTION(0x0, "gpio_in"),
  509. SUNXI_FUNCTION(0x1, "gpio_out"),
  510. SUNXI_FUNCTION(0x2, "i2s1"), /* DIN */
  511. SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 13)), /* PG_EINT13 */
  512. /* Hole */
  513. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 0),
  514. SUNXI_FUNCTION(0x0, "gpio_in"),
  515. SUNXI_FUNCTION(0x1, "gpio_out"),
  516. SUNXI_FUNCTION(0x2, "pwm0")),
  517. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 1),
  518. SUNXI_FUNCTION(0x0, "gpio_in"),
  519. SUNXI_FUNCTION(0x1, "gpio_out"),
  520. SUNXI_FUNCTION(0x2, "pwm1")),
  521. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 2),
  522. SUNXI_FUNCTION(0x0, "gpio_in"),
  523. SUNXI_FUNCTION(0x1, "gpio_out"),
  524. SUNXI_FUNCTION(0x2, "i2c0")), /* SCK */
  525. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 3),
  526. SUNXI_FUNCTION(0x0, "gpio_in"),
  527. SUNXI_FUNCTION(0x1, "gpio_out"),
  528. SUNXI_FUNCTION(0x2, "i2c0")), /* SDA */
  529. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 4),
  530. SUNXI_FUNCTION(0x0, "gpio_in"),
  531. SUNXI_FUNCTION(0x1, "gpio_out"),
  532. SUNXI_FUNCTION(0x2, "i2c1")), /* SCK */
  533. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 5),
  534. SUNXI_FUNCTION(0x0, "gpio_in"),
  535. SUNXI_FUNCTION(0x1, "gpio_out"),
  536. SUNXI_FUNCTION(0x2, "i2c1")), /* SDA */
  537. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 6),
  538. SUNXI_FUNCTION(0x0, "gpio_in"),
  539. SUNXI_FUNCTION(0x1, "gpio_out"),
  540. SUNXI_FUNCTION(0x2, "spi0"), /* CS */
  541. SUNXI_FUNCTION(0x3, "uart3")), /* TX */
  542. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 7),
  543. SUNXI_FUNCTION(0x0, "gpio_in"),
  544. SUNXI_FUNCTION(0x1, "gpio_out"),
  545. SUNXI_FUNCTION(0x2, "spi0"), /* CLK */
  546. SUNXI_FUNCTION(0x3, "uart3")), /* RX */
  547. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 8),
  548. SUNXI_FUNCTION(0x0, "gpio_in"),
  549. SUNXI_FUNCTION(0x1, "gpio_out"),
  550. SUNXI_FUNCTION(0x2, "spi0"), /* DOUT */
  551. SUNXI_FUNCTION(0x3, "uart3")), /* RTS */
  552. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9),
  553. SUNXI_FUNCTION(0x0, "gpio_in"),
  554. SUNXI_FUNCTION(0x1, "gpio_out"),
  555. SUNXI_FUNCTION(0x2, "spi0"), /* DIN */
  556. SUNXI_FUNCTION(0x3, "uart3")), /* CTS */
  557. };
  558. static const struct sunxi_pinctrl_desc sun8i_a23_pinctrl_data = {
  559. .pins = sun8i_a23_pins,
  560. .npins = ARRAY_SIZE(sun8i_a23_pins),
  561. .irq_banks = 3,
  562. };
  563. static int sun8i_a23_pinctrl_probe(struct platform_device *pdev)
  564. {
  565. return sunxi_pinctrl_init(pdev,
  566. &sun8i_a23_pinctrl_data);
  567. }
  568. static const struct of_device_id sun8i_a23_pinctrl_match[] = {
  569. { .compatible = "allwinner,sun8i-a23-pinctrl", },
  570. {}
  571. };
  572. MODULE_DEVICE_TABLE(of, sun8i_a23_pinctrl_match);
  573. static struct platform_driver sun8i_a23_pinctrl_driver = {
  574. .probe = sun8i_a23_pinctrl_probe,
  575. .driver = {
  576. .name = "sun8i-a23-pinctrl",
  577. .of_match_table = sun8i_a23_pinctrl_match,
  578. },
  579. };
  580. module_platform_driver(sun8i_a23_pinctrl_driver);
  581. MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
  582. MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com");
  583. MODULE_DESCRIPTION("Allwinner A23 pinctrl driver");
  584. MODULE_LICENSE("GPL");