pinctrl-sun50i-a64.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /*
  2. * Allwinner A64 SoCs pinctrl driver.
  3. *
  4. * Copyright (C) 2016 - ARM Ltd.
  5. * Author: Andre Przywara <andre.przywara@arm.com>
  6. *
  7. * Based on pinctrl-sun7i-a20.c, which is:
  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 a64_pins[] = {
  21. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 0),
  22. SUNXI_FUNCTION(0x0, "gpio_in"),
  23. SUNXI_FUNCTION(0x1, "gpio_out"),
  24. SUNXI_FUNCTION(0x2, "uart2"), /* TX */
  25. SUNXI_FUNCTION(0x4, "jtag"), /* MS0 */
  26. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 0)), /* EINT0 */
  27. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 1),
  28. SUNXI_FUNCTION(0x0, "gpio_in"),
  29. SUNXI_FUNCTION(0x1, "gpio_out"),
  30. SUNXI_FUNCTION(0x2, "uart2"), /* RX */
  31. SUNXI_FUNCTION(0x4, "jtag"), /* CK0 */
  32. SUNXI_FUNCTION(0x5, "sim"), /* VCCEN */
  33. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 1)), /* EINT1 */
  34. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 2),
  35. SUNXI_FUNCTION(0x0, "gpio_in"),
  36. SUNXI_FUNCTION(0x1, "gpio_out"),
  37. SUNXI_FUNCTION(0x2, "uart2"), /* RTS */
  38. SUNXI_FUNCTION(0x4, "jtag"), /* DO0 */
  39. SUNXI_FUNCTION(0x5, "sim"), /* VPPEN */
  40. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 2)), /* EINT2 */
  41. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 3),
  42. SUNXI_FUNCTION(0x0, "gpio_in"),
  43. SUNXI_FUNCTION(0x1, "gpio_out"),
  44. SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
  45. SUNXI_FUNCTION(0x3, "i2s0"), /* MCLK */
  46. SUNXI_FUNCTION(0x4, "jtag"), /* DI0 */
  47. SUNXI_FUNCTION(0x5, "sim"), /* VPPPP */
  48. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 3)), /* EINT3 */
  49. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 4),
  50. SUNXI_FUNCTION(0x0, "gpio_in"),
  51. SUNXI_FUNCTION(0x1, "gpio_out"),
  52. SUNXI_FUNCTION(0x2, "aif2"), /* SYNC */
  53. SUNXI_FUNCTION(0x3, "i2s0"), /* SYNC */
  54. SUNXI_FUNCTION(0x5, "sim"), /* CLK */
  55. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 4)), /* EINT4 */
  56. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 5),
  57. SUNXI_FUNCTION(0x0, "gpio_in"),
  58. SUNXI_FUNCTION(0x1, "gpio_out"),
  59. SUNXI_FUNCTION(0x2, "aif2"), /* BCLK */
  60. SUNXI_FUNCTION(0x3, "i2s0"), /* BCLK */
  61. SUNXI_FUNCTION(0x5, "sim"), /* DATA */
  62. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 5)), /* EINT5 */
  63. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 6),
  64. SUNXI_FUNCTION(0x0, "gpio_in"),
  65. SUNXI_FUNCTION(0x1, "gpio_out"),
  66. SUNXI_FUNCTION(0x2, "aif2"), /* DOUT */
  67. SUNXI_FUNCTION(0x3, "i2s0"), /* DOUT */
  68. SUNXI_FUNCTION(0x5, "sim"), /* RST */
  69. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)), /* EINT6 */
  70. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 7),
  71. SUNXI_FUNCTION(0x0, "gpio_in"),
  72. SUNXI_FUNCTION(0x1, "gpio_out"),
  73. SUNXI_FUNCTION(0x2, "aif2"), /* DIN */
  74. SUNXI_FUNCTION(0x3, "i2s0"), /* DIN */
  75. SUNXI_FUNCTION(0x5, "sim"), /* DET */
  76. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 7)), /* EINT7 */
  77. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 8),
  78. SUNXI_FUNCTION(0x0, "gpio_in"),
  79. SUNXI_FUNCTION(0x1, "gpio_out"),
  80. SUNXI_FUNCTION(0x4, "uart0"), /* TX */
  81. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 8)), /* EINT8 */
  82. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 9),
  83. SUNXI_FUNCTION(0x0, "gpio_in"),
  84. SUNXI_FUNCTION(0x1, "gpio_out"),
  85. SUNXI_FUNCTION(0x4, "uart0"), /* RX */
  86. SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 9)), /* EINT9 */
  87. /* Hole */
  88. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0),
  89. SUNXI_FUNCTION(0x0, "gpio_in"),
  90. SUNXI_FUNCTION(0x1, "gpio_out"),
  91. SUNXI_FUNCTION(0x2, "nand0"), /* NWE */
  92. SUNXI_FUNCTION(0x4, "spi0")), /* MOSI */
  93. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1),
  94. SUNXI_FUNCTION(0x0, "gpio_in"),
  95. SUNXI_FUNCTION(0x1, "gpio_out"),
  96. SUNXI_FUNCTION(0x2, "nand0"), /* NALE */
  97. SUNXI_FUNCTION(0x3, "mmc2"), /* DS */
  98. SUNXI_FUNCTION(0x4, "spi0")), /* MISO */
  99. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2),
  100. SUNXI_FUNCTION(0x0, "gpio_in"),
  101. SUNXI_FUNCTION(0x1, "gpio_out"),
  102. SUNXI_FUNCTION(0x2, "nand0"), /* NCLE */
  103. SUNXI_FUNCTION(0x4, "spi0")), /* SCK */
  104. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3),
  105. SUNXI_FUNCTION(0x0, "gpio_in"),
  106. SUNXI_FUNCTION(0x1, "gpio_out"),
  107. SUNXI_FUNCTION(0x2, "nand0"), /* NCE1 */
  108. SUNXI_FUNCTION(0x4, "spi0")), /* CS */
  109. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4),
  110. SUNXI_FUNCTION(0x0, "gpio_in"),
  111. SUNXI_FUNCTION(0x1, "gpio_out"),
  112. SUNXI_FUNCTION(0x2, "nand0")), /* NCE0 */
  113. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5),
  114. SUNXI_FUNCTION(0x0, "gpio_in"),
  115. SUNXI_FUNCTION(0x1, "gpio_out"),
  116. SUNXI_FUNCTION(0x2, "nand0"), /* NRE# */
  117. SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
  118. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6),
  119. SUNXI_FUNCTION(0x0, "gpio_in"),
  120. SUNXI_FUNCTION(0x1, "gpio_out"),
  121. SUNXI_FUNCTION(0x2, "nand0"), /* NRB0 */
  122. SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
  123. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7),
  124. SUNXI_FUNCTION(0x0, "gpio_in"),
  125. SUNXI_FUNCTION(0x1, "gpio_out"),
  126. SUNXI_FUNCTION(0x2, "nand0")), /* NRB1 */
  127. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8),
  128. SUNXI_FUNCTION(0x0, "gpio_in"),
  129. SUNXI_FUNCTION(0x1, "gpio_out"),
  130. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ0 */
  131. SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
  132. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9),
  133. SUNXI_FUNCTION(0x0, "gpio_in"),
  134. SUNXI_FUNCTION(0x1, "gpio_out"),
  135. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ1 */
  136. SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
  137. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10),
  138. SUNXI_FUNCTION(0x0, "gpio_in"),
  139. SUNXI_FUNCTION(0x1, "gpio_out"),
  140. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ2 */
  141. SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
  142. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 11),
  143. SUNXI_FUNCTION(0x0, "gpio_in"),
  144. SUNXI_FUNCTION(0x1, "gpio_out"),
  145. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ3 */
  146. SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
  147. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 12),
  148. SUNXI_FUNCTION(0x0, "gpio_in"),
  149. SUNXI_FUNCTION(0x1, "gpio_out"),
  150. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ4 */
  151. SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */
  152. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 13),
  153. SUNXI_FUNCTION(0x0, "gpio_in"),
  154. SUNXI_FUNCTION(0x1, "gpio_out"),
  155. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ5 */
  156. SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */
  157. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14),
  158. SUNXI_FUNCTION(0x0, "gpio_in"),
  159. SUNXI_FUNCTION(0x1, "gpio_out"),
  160. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ6 */
  161. SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
  162. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15),
  163. SUNXI_FUNCTION(0x0, "gpio_in"),
  164. SUNXI_FUNCTION(0x1, "gpio_out"),
  165. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ7 */
  166. SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
  167. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16),
  168. SUNXI_FUNCTION(0x0, "gpio_in"),
  169. SUNXI_FUNCTION(0x1, "gpio_out"),
  170. SUNXI_FUNCTION(0x2, "nand0"), /* NDQS */
  171. SUNXI_FUNCTION(0x3, "mmc2")), /* RST */
  172. /* Hole */
  173. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 0),
  174. SUNXI_FUNCTION(0x0, "gpio_in"),
  175. SUNXI_FUNCTION(0x1, "gpio_out"),
  176. SUNXI_FUNCTION(0x2, "lcd0"), /* D2 */
  177. SUNXI_FUNCTION(0x3, "uart3"), /* TX */
  178. SUNXI_FUNCTION(0x4, "spi1"), /* CS */
  179. SUNXI_FUNCTION(0x5, "ccir")), /* CLK */
  180. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 1),
  181. SUNXI_FUNCTION(0x0, "gpio_in"),
  182. SUNXI_FUNCTION(0x1, "gpio_out"),
  183. SUNXI_FUNCTION(0x2, "lcd0"), /* D3 */
  184. SUNXI_FUNCTION(0x3, "uart3"), /* RX */
  185. SUNXI_FUNCTION(0x4, "spi1"), /* CLK */
  186. SUNXI_FUNCTION(0x5, "ccir")), /* DE */
  187. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
  188. SUNXI_FUNCTION(0x0, "gpio_in"),
  189. SUNXI_FUNCTION(0x1, "gpio_out"),
  190. SUNXI_FUNCTION(0x2, "lcd0"), /* D4 */
  191. SUNXI_FUNCTION(0x3, "uart4"), /* TX */
  192. SUNXI_FUNCTION(0x4, "spi1"), /* MOSI */
  193. SUNXI_FUNCTION(0x5, "ccir")), /* HSYNC */
  194. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3),
  195. SUNXI_FUNCTION(0x0, "gpio_in"),
  196. SUNXI_FUNCTION(0x1, "gpio_out"),
  197. SUNXI_FUNCTION(0x2, "lcd0"), /* D5 */
  198. SUNXI_FUNCTION(0x3, "uart4"), /* RX */
  199. SUNXI_FUNCTION(0x4, "spi1"), /* MISO */
  200. SUNXI_FUNCTION(0x5, "ccir")), /* VSYNC */
  201. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4),
  202. SUNXI_FUNCTION(0x0, "gpio_in"),
  203. SUNXI_FUNCTION(0x1, "gpio_out"),
  204. SUNXI_FUNCTION(0x2, "lcd0"), /* D6 */
  205. SUNXI_FUNCTION(0x3, "uart4"), /* RTS */
  206. SUNXI_FUNCTION(0x5, "ccir")), /* D0 */
  207. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5),
  208. SUNXI_FUNCTION(0x0, "gpio_in"),
  209. SUNXI_FUNCTION(0x1, "gpio_out"),
  210. SUNXI_FUNCTION(0x2, "lcd0"), /* D7 */
  211. SUNXI_FUNCTION(0x3, "uart4"), /* CTS */
  212. SUNXI_FUNCTION(0x5, "ccir")), /* D1 */
  213. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6),
  214. SUNXI_FUNCTION(0x0, "gpio_in"),
  215. SUNXI_FUNCTION(0x1, "gpio_out"),
  216. SUNXI_FUNCTION(0x2, "lcd0"), /* D10 */
  217. SUNXI_FUNCTION(0x5, "ccir")), /* D2 */
  218. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7),
  219. SUNXI_FUNCTION(0x0, "gpio_in"),
  220. SUNXI_FUNCTION(0x1, "gpio_out"),
  221. SUNXI_FUNCTION(0x2, "lcd0"), /* D11 */
  222. SUNXI_FUNCTION(0x5, "ccir")), /* D3 */
  223. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 8),
  224. SUNXI_FUNCTION(0x0, "gpio_in"),
  225. SUNXI_FUNCTION(0x1, "gpio_out"),
  226. SUNXI_FUNCTION(0x2, "lcd0"), /* D12 */
  227. SUNXI_FUNCTION(0x4, "emac"), /* ERXD3 */
  228. SUNXI_FUNCTION(0x5, "ccir")), /* D4 */
  229. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 9),
  230. SUNXI_FUNCTION(0x0, "gpio_in"),
  231. SUNXI_FUNCTION(0x1, "gpio_out"),
  232. SUNXI_FUNCTION(0x2, "lcd0"), /* D13 */
  233. SUNXI_FUNCTION(0x4, "emac"), /* ERXD2 */
  234. SUNXI_FUNCTION(0x5, "ccir")), /* D5 */
  235. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 10),
  236. SUNXI_FUNCTION(0x0, "gpio_in"),
  237. SUNXI_FUNCTION(0x1, "gpio_out"),
  238. SUNXI_FUNCTION(0x2, "lcd0"), /* D14 */
  239. SUNXI_FUNCTION(0x4, "emac")), /* ERXD1 */
  240. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 11),
  241. SUNXI_FUNCTION(0x0, "gpio_in"),
  242. SUNXI_FUNCTION(0x1, "gpio_out"),
  243. SUNXI_FUNCTION(0x2, "lcd0"), /* D15 */
  244. SUNXI_FUNCTION(0x4, "emac")), /* ERXD0 */
  245. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 12),
  246. SUNXI_FUNCTION(0x0, "gpio_in"),
  247. SUNXI_FUNCTION(0x1, "gpio_out"),
  248. SUNXI_FUNCTION(0x2, "lcd0"), /* D18 */
  249. SUNXI_FUNCTION(0x3, "lvds0"), /* VP0 */
  250. SUNXI_FUNCTION(0x4, "emac")), /* ERXCK */
  251. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 13),
  252. SUNXI_FUNCTION(0x0, "gpio_in"),
  253. SUNXI_FUNCTION(0x1, "gpio_out"),
  254. SUNXI_FUNCTION(0x2, "lcd0"), /* D19 */
  255. SUNXI_FUNCTION(0x3, "lvds0"), /* VN0 */
  256. SUNXI_FUNCTION(0x4, "emac")), /* ERXCTL */
  257. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 14),
  258. SUNXI_FUNCTION(0x0, "gpio_in"),
  259. SUNXI_FUNCTION(0x1, "gpio_out"),
  260. SUNXI_FUNCTION(0x2, "lcd0"), /* D20 */
  261. SUNXI_FUNCTION(0x3, "lvds0"), /* VP1 */
  262. SUNXI_FUNCTION(0x4, "emac")), /* ENULL */
  263. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 15),
  264. SUNXI_FUNCTION(0x0, "gpio_in"),
  265. SUNXI_FUNCTION(0x1, "gpio_out"),
  266. SUNXI_FUNCTION(0x2, "lcd0"), /* D21 */
  267. SUNXI_FUNCTION(0x3, "lvds0"), /* VN1 */
  268. SUNXI_FUNCTION(0x4, "emac"), /* ETXD3 */
  269. SUNXI_FUNCTION(0x5, "ccir")), /* D6 */
  270. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 16),
  271. SUNXI_FUNCTION(0x0, "gpio_in"),
  272. SUNXI_FUNCTION(0x1, "gpio_out"),
  273. SUNXI_FUNCTION(0x2, "lcd0"), /* D22 */
  274. SUNXI_FUNCTION(0x3, "lvds0"), /* VP2 */
  275. SUNXI_FUNCTION(0x4, "emac"), /* ETXD2 */
  276. SUNXI_FUNCTION(0x5, "ccir")), /* D7 */
  277. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 17),
  278. SUNXI_FUNCTION(0x0, "gpio_in"),
  279. SUNXI_FUNCTION(0x1, "gpio_out"),
  280. SUNXI_FUNCTION(0x2, "lcd0"), /* D23 */
  281. SUNXI_FUNCTION(0x3, "lvds0"), /* VN2 */
  282. SUNXI_FUNCTION(0x4, "emac")), /* ETXD1 */
  283. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 18),
  284. SUNXI_FUNCTION(0x0, "gpio_in"),
  285. SUNXI_FUNCTION(0x1, "gpio_out"),
  286. SUNXI_FUNCTION(0x2, "lcd0"), /* CLK */
  287. SUNXI_FUNCTION(0x3, "lvds0"), /* VPC */
  288. SUNXI_FUNCTION(0x4, "emac")), /* ETXD0 */
  289. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 19),
  290. SUNXI_FUNCTION(0x0, "gpio_in"),
  291. SUNXI_FUNCTION(0x1, "gpio_out"),
  292. SUNXI_FUNCTION(0x2, "lcd0"), /* DE */
  293. SUNXI_FUNCTION(0x3, "lvds0"), /* VNC */
  294. SUNXI_FUNCTION(0x4, "emac")), /* ETXCK */
  295. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 20),
  296. SUNXI_FUNCTION(0x0, "gpio_in"),
  297. SUNXI_FUNCTION(0x1, "gpio_out"),
  298. SUNXI_FUNCTION(0x2, "lcd0"), /* HSYNC */
  299. SUNXI_FUNCTION(0x3, "lvds0"), /* VP3 */
  300. SUNXI_FUNCTION(0x4, "emac")), /* ETXCTL */
  301. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 21),
  302. SUNXI_FUNCTION(0x0, "gpio_in"),
  303. SUNXI_FUNCTION(0x1, "gpio_out"),
  304. SUNXI_FUNCTION(0x2, "lcd0"), /* VSYNC */
  305. SUNXI_FUNCTION(0x3, "lvds0"), /* VN3 */
  306. SUNXI_FUNCTION(0x4, "emac")), /* ECLKIN */
  307. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 22),
  308. SUNXI_FUNCTION(0x0, "gpio_in"),
  309. SUNXI_FUNCTION(0x1, "gpio_out"),
  310. SUNXI_FUNCTION(0x2, "pwm"), /* PWM0 */
  311. SUNXI_FUNCTION(0x4, "emac")), /* EMDC */
  312. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 23),
  313. SUNXI_FUNCTION(0x0, "gpio_in"),
  314. SUNXI_FUNCTION(0x1, "gpio_out"),
  315. SUNXI_FUNCTION(0x4, "emac")), /* EMDIO */
  316. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 24),
  317. SUNXI_FUNCTION(0x0, "gpio_in"),
  318. SUNXI_FUNCTION(0x1, "gpio_out")),
  319. /* Hole */
  320. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 0),
  321. SUNXI_FUNCTION(0x0, "gpio_in"),
  322. SUNXI_FUNCTION(0x1, "gpio_out"),
  323. SUNXI_FUNCTION(0x2, "csi0"), /* PCK */
  324. SUNXI_FUNCTION(0x4, "ts0")), /* CLK */
  325. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 1),
  326. SUNXI_FUNCTION(0x0, "gpio_in"),
  327. SUNXI_FUNCTION(0x1, "gpio_out"),
  328. SUNXI_FUNCTION(0x2, "csi0"), /* CK */
  329. SUNXI_FUNCTION(0x4, "ts0")), /* ERR */
  330. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 2),
  331. SUNXI_FUNCTION(0x0, "gpio_in"),
  332. SUNXI_FUNCTION(0x1, "gpio_out"),
  333. SUNXI_FUNCTION(0x2, "csi0"), /* HSYNC */
  334. SUNXI_FUNCTION(0x4, "ts0")), /* SYNC */
  335. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 3),
  336. SUNXI_FUNCTION(0x0, "gpio_in"),
  337. SUNXI_FUNCTION(0x1, "gpio_out"),
  338. SUNXI_FUNCTION(0x2, "csi0"), /* VSYNC */
  339. SUNXI_FUNCTION(0x4, "ts0")), /* DVLD */
  340. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 4),
  341. SUNXI_FUNCTION(0x0, "gpio_in"),
  342. SUNXI_FUNCTION(0x1, "gpio_out"),
  343. SUNXI_FUNCTION(0x2, "csi0"), /* D0 */
  344. SUNXI_FUNCTION(0x4, "ts0")), /* D0 */
  345. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 5),
  346. SUNXI_FUNCTION(0x0, "gpio_in"),
  347. SUNXI_FUNCTION(0x1, "gpio_out"),
  348. SUNXI_FUNCTION(0x2, "csi0"), /* D1 */
  349. SUNXI_FUNCTION(0x4, "ts0")), /* D1 */
  350. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 6),
  351. SUNXI_FUNCTION(0x0, "gpio_in"),
  352. SUNXI_FUNCTION(0x1, "gpio_out"),
  353. SUNXI_FUNCTION(0x2, "csi0"), /* D2 */
  354. SUNXI_FUNCTION(0x4, "ts0")), /* D2 */
  355. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 7),
  356. SUNXI_FUNCTION(0x0, "gpio_in"),
  357. SUNXI_FUNCTION(0x1, "gpio_out"),
  358. SUNXI_FUNCTION(0x2, "csi0"), /* D3 */
  359. SUNXI_FUNCTION(0x4, "ts0")), /* D3 */
  360. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 8),
  361. SUNXI_FUNCTION(0x0, "gpio_in"),
  362. SUNXI_FUNCTION(0x1, "gpio_out"),
  363. SUNXI_FUNCTION(0x2, "csi0"), /* D4 */
  364. SUNXI_FUNCTION(0x4, "ts0")), /* D4 */
  365. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 9),
  366. SUNXI_FUNCTION(0x0, "gpio_in"),
  367. SUNXI_FUNCTION(0x1, "gpio_out"),
  368. SUNXI_FUNCTION(0x2, "csi0"), /* D5 */
  369. SUNXI_FUNCTION(0x4, "ts0")), /* D5 */
  370. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 10),
  371. SUNXI_FUNCTION(0x0, "gpio_in"),
  372. SUNXI_FUNCTION(0x1, "gpio_out"),
  373. SUNXI_FUNCTION(0x2, "csi0"), /* D6 */
  374. SUNXI_FUNCTION(0x4, "ts0")), /* D6 */
  375. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 11),
  376. SUNXI_FUNCTION(0x0, "gpio_in"),
  377. SUNXI_FUNCTION(0x1, "gpio_out"),
  378. SUNXI_FUNCTION(0x2, "csi0"), /* D7 */
  379. SUNXI_FUNCTION(0x4, "ts0")), /* D7 */
  380. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 12),
  381. SUNXI_FUNCTION(0x0, "gpio_in"),
  382. SUNXI_FUNCTION(0x1, "gpio_out"),
  383. SUNXI_FUNCTION(0x2, "csi0")), /* SCK */
  384. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 13),
  385. SUNXI_FUNCTION(0x0, "gpio_in"),
  386. SUNXI_FUNCTION(0x1, "gpio_out"),
  387. SUNXI_FUNCTION(0x2, "csi0")), /* SDA */
  388. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 14),
  389. SUNXI_FUNCTION(0x0, "gpio_in"),
  390. SUNXI_FUNCTION(0x1, "gpio_out"),
  391. SUNXI_FUNCTION(0x2, "pll"), /* LOCK_DBG */
  392. SUNXI_FUNCTION(0x3, "i2c2")), /* SCK */
  393. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 15),
  394. SUNXI_FUNCTION(0x0, "gpio_in"),
  395. SUNXI_FUNCTION(0x1, "gpio_out"),
  396. SUNXI_FUNCTION(0x3, "i2c2")), /* SDA */
  397. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 16),
  398. SUNXI_FUNCTION(0x0, "gpio_in"),
  399. SUNXI_FUNCTION(0x1, "gpio_out")),
  400. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 17),
  401. SUNXI_FUNCTION(0x0, "gpio_in"),
  402. SUNXI_FUNCTION(0x1, "gpio_out")),
  403. /* Hole */
  404. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0),
  405. SUNXI_FUNCTION(0x0, "gpio_in"),
  406. SUNXI_FUNCTION(0x1, "gpio_out"),
  407. SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
  408. SUNXI_FUNCTION(0x3, "jtag")), /* MSI */
  409. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1),
  410. SUNXI_FUNCTION(0x0, "gpio_in"),
  411. SUNXI_FUNCTION(0x1, "gpio_out"),
  412. SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
  413. SUNXI_FUNCTION(0x3, "jtag")), /* DI1 */
  414. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2),
  415. SUNXI_FUNCTION(0x0, "gpio_in"),
  416. SUNXI_FUNCTION(0x1, "gpio_out"),
  417. SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
  418. SUNXI_FUNCTION(0x3, "uart0")), /* TX */
  419. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3),
  420. SUNXI_FUNCTION(0x0, "gpio_in"),
  421. SUNXI_FUNCTION(0x1, "gpio_out"),
  422. SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
  423. SUNXI_FUNCTION(0x3, "jtag")), /* DO1 */
  424. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4),
  425. SUNXI_FUNCTION(0x0, "gpio_in"),
  426. SUNXI_FUNCTION(0x1, "gpio_out"),
  427. SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
  428. SUNXI_FUNCTION(0x3, "uart0")), /* RX */
  429. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5),
  430. SUNXI_FUNCTION(0x0, "gpio_in"),
  431. SUNXI_FUNCTION(0x1, "gpio_out"),
  432. SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
  433. SUNXI_FUNCTION(0x3, "jtag")), /* CK1 */
  434. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 6),
  435. SUNXI_FUNCTION(0x0, "gpio_in"),
  436. SUNXI_FUNCTION(0x1, "gpio_out")),
  437. /* Hole */
  438. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
  439. SUNXI_FUNCTION(0x0, "gpio_in"),
  440. SUNXI_FUNCTION(0x1, "gpio_out"),
  441. SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
  442. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 0)), /* EINT0 */
  443. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
  444. SUNXI_FUNCTION(0x0, "gpio_in"),
  445. SUNXI_FUNCTION(0x1, "gpio_out"),
  446. SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
  447. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 1)), /* EINT1 */
  448. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
  449. SUNXI_FUNCTION(0x0, "gpio_in"),
  450. SUNXI_FUNCTION(0x1, "gpio_out"),
  451. SUNXI_FUNCTION(0x2, "mmc1"), /* D0 */
  452. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 2)), /* EINT2 */
  453. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
  454. SUNXI_FUNCTION(0x0, "gpio_in"),
  455. SUNXI_FUNCTION(0x1, "gpio_out"),
  456. SUNXI_FUNCTION(0x2, "mmc1"), /* D1 */
  457. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 3)), /* EINT3 */
  458. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
  459. SUNXI_FUNCTION(0x0, "gpio_in"),
  460. SUNXI_FUNCTION(0x1, "gpio_out"),
  461. SUNXI_FUNCTION(0x2, "mmc1"), /* D2 */
  462. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 4)), /* EINT4 */
  463. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
  464. SUNXI_FUNCTION(0x0, "gpio_in"),
  465. SUNXI_FUNCTION(0x1, "gpio_out"),
  466. SUNXI_FUNCTION(0x2, "mmc1"), /* D3 */
  467. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 5)), /* EINT5 */
  468. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6),
  469. SUNXI_FUNCTION(0x0, "gpio_in"),
  470. SUNXI_FUNCTION(0x1, "gpio_out"),
  471. SUNXI_FUNCTION(0x2, "uart1"), /* TX */
  472. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 6)), /* EINT6 */
  473. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7),
  474. SUNXI_FUNCTION(0x0, "gpio_in"),
  475. SUNXI_FUNCTION(0x1, "gpio_out"),
  476. SUNXI_FUNCTION(0x2, "uart1"), /* RX */
  477. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 7)), /* EINT7 */
  478. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
  479. SUNXI_FUNCTION(0x0, "gpio_in"),
  480. SUNXI_FUNCTION(0x1, "gpio_out"),
  481. SUNXI_FUNCTION(0x2, "uart1"), /* RTS */
  482. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 8)), /* EINT8 */
  483. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
  484. SUNXI_FUNCTION(0x0, "gpio_in"),
  485. SUNXI_FUNCTION(0x1, "gpio_out"),
  486. SUNXI_FUNCTION(0x2, "uart1"), /* CTS */
  487. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 9)), /* EINT9 */
  488. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
  489. SUNXI_FUNCTION(0x0, "gpio_in"),
  490. SUNXI_FUNCTION(0x1, "gpio_out"),
  491. SUNXI_FUNCTION(0x2, "aif3"), /* SYNC */
  492. SUNXI_FUNCTION(0x3, "i2s1"), /* SYNC */
  493. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 10)), /* EINT10 */
  494. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11),
  495. SUNXI_FUNCTION(0x0, "gpio_in"),
  496. SUNXI_FUNCTION(0x1, "gpio_out"),
  497. SUNXI_FUNCTION(0x2, "aif3"), /* BCLK */
  498. SUNXI_FUNCTION(0x3, "i2s1"), /* BCLK */
  499. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 11)), /* EINT11 */
  500. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),
  501. SUNXI_FUNCTION(0x0, "gpio_in"),
  502. SUNXI_FUNCTION(0x1, "gpio_out"),
  503. SUNXI_FUNCTION(0x2, "aif3"), /* DOUT */
  504. SUNXI_FUNCTION(0x3, "i2s1"), /* DOUT */
  505. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 12)), /* EINT12 */
  506. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13),
  507. SUNXI_FUNCTION(0x0, "gpio_in"),
  508. SUNXI_FUNCTION(0x1, "gpio_out"),
  509. SUNXI_FUNCTION(0x2, "aif3"), /* DIN */
  510. SUNXI_FUNCTION(0x3, "i2s1"), /* DIN */
  511. SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 13)), /* 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, "i2c0"), /* SCK */
  517. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 0)), /* EINT0 */
  518. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 1),
  519. SUNXI_FUNCTION(0x0, "gpio_in"),
  520. SUNXI_FUNCTION(0x1, "gpio_out"),
  521. SUNXI_FUNCTION(0x2, "i2c0"), /* SDA */
  522. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 1)), /* EINT1 */
  523. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 2),
  524. SUNXI_FUNCTION(0x0, "gpio_in"),
  525. SUNXI_FUNCTION(0x1, "gpio_out"),
  526. SUNXI_FUNCTION(0x2, "i2c1"), /* SCK */
  527. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 2)), /* EINT2 */
  528. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 3),
  529. SUNXI_FUNCTION(0x0, "gpio_in"),
  530. SUNXI_FUNCTION(0x1, "gpio_out"),
  531. SUNXI_FUNCTION(0x2, "i2c1"), /* SDA */
  532. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 3)), /* EINT3 */
  533. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 4),
  534. SUNXI_FUNCTION(0x0, "gpio_in"),
  535. SUNXI_FUNCTION(0x1, "gpio_out"),
  536. SUNXI_FUNCTION(0x2, "uart3"), /* TX */
  537. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 4)), /* EINT4 */
  538. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 5),
  539. SUNXI_FUNCTION(0x0, "gpio_in"),
  540. SUNXI_FUNCTION(0x1, "gpio_out"),
  541. SUNXI_FUNCTION(0x2, "uart3"), /* RX */
  542. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 5)), /* EINT5 */
  543. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 6),
  544. SUNXI_FUNCTION(0x0, "gpio_in"),
  545. SUNXI_FUNCTION(0x1, "gpio_out"),
  546. SUNXI_FUNCTION(0x2, "uart3"), /* RTS */
  547. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 6)), /* EINT6 */
  548. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 7),
  549. SUNXI_FUNCTION(0x0, "gpio_in"),
  550. SUNXI_FUNCTION(0x1, "gpio_out"),
  551. SUNXI_FUNCTION(0x2, "uart3"), /* CTS */
  552. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 7)), /* EINT7 */
  553. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 8),
  554. SUNXI_FUNCTION(0x0, "gpio_in"),
  555. SUNXI_FUNCTION(0x1, "gpio_out"),
  556. SUNXI_FUNCTION(0x2, "spdif"), /* OUT */
  557. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 8)), /* EINT8 */
  558. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9),
  559. SUNXI_FUNCTION(0x0, "gpio_in"),
  560. SUNXI_FUNCTION(0x1, "gpio_out"),
  561. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 9)), /* EINT9 */
  562. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 10),
  563. SUNXI_FUNCTION(0x0, "gpio_in"),
  564. SUNXI_FUNCTION(0x1, "gpio_out"),
  565. SUNXI_FUNCTION(0x2, "mic"), /* CLK */
  566. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 10)), /* EINT10 */
  567. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 11),
  568. SUNXI_FUNCTION(0x0, "gpio_in"),
  569. SUNXI_FUNCTION(0x1, "gpio_out"),
  570. SUNXI_FUNCTION(0x2, "mic"), /* DATA */
  571. SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 11)), /* EINT11 */
  572. };
  573. static const struct sunxi_pinctrl_desc a64_pinctrl_data = {
  574. .pins = a64_pins,
  575. .npins = ARRAY_SIZE(a64_pins),
  576. .irq_banks = 3,
  577. };
  578. static int a64_pinctrl_probe(struct platform_device *pdev)
  579. {
  580. return sunxi_pinctrl_init(pdev,
  581. &a64_pinctrl_data);
  582. }
  583. static const struct of_device_id a64_pinctrl_match[] = {
  584. { .compatible = "allwinner,sun50i-a64-pinctrl", },
  585. {}
  586. };
  587. static struct platform_driver a64_pinctrl_driver = {
  588. .probe = a64_pinctrl_probe,
  589. .driver = {
  590. .name = "sun50i-a64-pinctrl",
  591. .of_match_table = a64_pinctrl_match,
  592. },
  593. };
  594. builtin_platform_driver(a64_pinctrl_driver);