pinctrl-sun8i-a33.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. /*
  2. * Allwinner a33 SoCs pinctrl driver.
  3. *
  4. * Copyright (C) 2015 Vishnu Patekar <vishnupatekar0510@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_a33_pins[] = {
  21. /* Hole */
  22. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 0),
  23. SUNXI_FUNCTION(0x0, "gpio_in"),
  24. SUNXI_FUNCTION(0x1, "gpio_out"),
  25. SUNXI_FUNCTION(0x2, "uart2"), /* TX */
  26. SUNXI_FUNCTION(0x3, "uart0"), /* TX */
  27. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 0)), /* PB_EINT0 */
  28. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 1),
  29. SUNXI_FUNCTION(0x0, "gpio_in"),
  30. SUNXI_FUNCTION(0x1, "gpio_out"),
  31. SUNXI_FUNCTION(0x2, "uart2"), /* RX */
  32. SUNXI_FUNCTION(0x3, "uart0"), /* RX */
  33. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 1)), /* PB_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_IRQ_BANK(0x4, 0, 2)), /* PB_EINT2 */
  39. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 3),
  40. SUNXI_FUNCTION(0x0, "gpio_in"),
  41. SUNXI_FUNCTION(0x1, "gpio_out"),
  42. SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
  43. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 3)), /* PB_EINT3 */
  44. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 4),
  45. SUNXI_FUNCTION(0x0, "gpio_in"),
  46. SUNXI_FUNCTION(0x1, "gpio_out"),
  47. SUNXI_FUNCTION(0x2, "i2s0"), /* SYNC */
  48. SUNXI_FUNCTION(0x3, "aif2"), /* SYNC */
  49. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 4)), /* PB_EINT4 */
  50. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 5),
  51. SUNXI_FUNCTION(0x0, "gpio_in"),
  52. SUNXI_FUNCTION(0x1, "gpio_out"),
  53. SUNXI_FUNCTION(0x2, "i2s0"), /* BCLK */
  54. SUNXI_FUNCTION(0x3, "aif2"), /* BCLK */
  55. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 5)), /* PB_EINT5 */
  56. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 6),
  57. SUNXI_FUNCTION(0x0, "gpio_in"),
  58. SUNXI_FUNCTION(0x1, "gpio_out"),
  59. SUNXI_FUNCTION(0x2, "i2s0"), /* DOUT */
  60. SUNXI_FUNCTION(0x3, "aif2"), /* DOUT */
  61. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 6)), /* PB_EINT6 */
  62. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 7),
  63. SUNXI_FUNCTION(0x0, "gpio_in"),
  64. SUNXI_FUNCTION(0x1, "gpio_out"),
  65. SUNXI_FUNCTION(0x2, "i2s0"), /* DIN */
  66. SUNXI_FUNCTION(0x3, "aif2"), /* DIN */
  67. SUNXI_FUNCTION_IRQ_BANK(0x4, 0, 7)), /* PB_EINT7 */
  68. /* Hole */
  69. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0),
  70. SUNXI_FUNCTION(0x0, "gpio_in"),
  71. SUNXI_FUNCTION(0x1, "gpio_out"),
  72. SUNXI_FUNCTION(0x2, "nand0"), /* WE */
  73. SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
  74. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1),
  75. SUNXI_FUNCTION(0x0, "gpio_in"),
  76. SUNXI_FUNCTION(0x1, "gpio_out"),
  77. SUNXI_FUNCTION(0x2, "nand0"), /* ALE */
  78. SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
  79. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2),
  80. SUNXI_FUNCTION(0x0, "gpio_in"),
  81. SUNXI_FUNCTION(0x1, "gpio_out"),
  82. SUNXI_FUNCTION(0x2, "nand0"), /* CLE */
  83. SUNXI_FUNCTION(0x3, "spi0")), /* CLK */
  84. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3),
  85. SUNXI_FUNCTION(0x0, "gpio_in"),
  86. SUNXI_FUNCTION(0x1, "gpio_out"),
  87. SUNXI_FUNCTION(0x2, "nand0"), /* CE1 */
  88. SUNXI_FUNCTION(0x3, "spi0")), /* CS */
  89. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4),
  90. SUNXI_FUNCTION(0x0, "gpio_in"),
  91. SUNXI_FUNCTION(0x1, "gpio_out"),
  92. SUNXI_FUNCTION(0x2, "nand0")), /* CE0 */
  93. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5),
  94. SUNXI_FUNCTION(0x0, "gpio_in"),
  95. SUNXI_FUNCTION(0x1, "gpio_out"),
  96. SUNXI_FUNCTION(0x2, "nand0"), /* RE */
  97. SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
  98. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6),
  99. SUNXI_FUNCTION(0x0, "gpio_in"),
  100. SUNXI_FUNCTION(0x1, "gpio_out"),
  101. SUNXI_FUNCTION(0x2, "nand0"), /* RB0 */
  102. SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
  103. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7),
  104. SUNXI_FUNCTION(0x0, "gpio_in"),
  105. SUNXI_FUNCTION(0x1, "gpio_out"),
  106. SUNXI_FUNCTION(0x2, "nand0")), /* RB1 */
  107. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8),
  108. SUNXI_FUNCTION(0x0, "gpio_in"),
  109. SUNXI_FUNCTION(0x1, "gpio_out"),
  110. SUNXI_FUNCTION(0x2, "nand0"), /* DQ0 */
  111. SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
  112. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9),
  113. SUNXI_FUNCTION(0x0, "gpio_in"),
  114. SUNXI_FUNCTION(0x1, "gpio_out"),
  115. SUNXI_FUNCTION(0x2, "nand0"), /* DQ1 */
  116. SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
  117. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10),
  118. SUNXI_FUNCTION(0x0, "gpio_in"),
  119. SUNXI_FUNCTION(0x1, "gpio_out"),
  120. SUNXI_FUNCTION(0x2, "nand0"), /* DQ2 */
  121. SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
  122. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 11),
  123. SUNXI_FUNCTION(0x0, "gpio_in"),
  124. SUNXI_FUNCTION(0x1, "gpio_out"),
  125. SUNXI_FUNCTION(0x2, "nand0"), /* DQ3 */
  126. SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
  127. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 12),
  128. SUNXI_FUNCTION(0x0, "gpio_in"),
  129. SUNXI_FUNCTION(0x1, "gpio_out"),
  130. SUNXI_FUNCTION(0x2, "nand0"), /* DQ4 */
  131. SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */
  132. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 13),
  133. SUNXI_FUNCTION(0x0, "gpio_in"),
  134. SUNXI_FUNCTION(0x1, "gpio_out"),
  135. SUNXI_FUNCTION(0x2, "nand0"), /* DQ5 */
  136. SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */
  137. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14),
  138. SUNXI_FUNCTION(0x0, "gpio_in"),
  139. SUNXI_FUNCTION(0x1, "gpio_out"),
  140. SUNXI_FUNCTION(0x2, "nand"), /* DQ6 */
  141. SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
  142. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15),
  143. SUNXI_FUNCTION(0x0, "gpio_in"),
  144. SUNXI_FUNCTION(0x1, "gpio_out"),
  145. SUNXI_FUNCTION(0x2, "nand"), /* DQ7 */
  146. SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
  147. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16),
  148. SUNXI_FUNCTION(0x0, "gpio_in"),
  149. SUNXI_FUNCTION(0x1, "gpio_out"),
  150. SUNXI_FUNCTION(0x2, "nand"), /* DQS */
  151. SUNXI_FUNCTION(0x3, "mmc2")), /* RST */
  152. /* Hole */
  153. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
  154. SUNXI_FUNCTION(0x0, "gpio_in"),
  155. SUNXI_FUNCTION(0x1, "gpio_out"),
  156. SUNXI_FUNCTION(0x2, "lcd0"), /* D2 */
  157. SUNXI_FUNCTION(0x3, "mmc1")), /* CLK */
  158. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3),
  159. SUNXI_FUNCTION(0x0, "gpio_in"),
  160. SUNXI_FUNCTION(0x1, "gpio_out"),
  161. SUNXI_FUNCTION(0x2, "lcd0"), /* D3 */
  162. SUNXI_FUNCTION(0x3, "mmc1")), /* CMD */
  163. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4),
  164. SUNXI_FUNCTION(0x0, "gpio_in"),
  165. SUNXI_FUNCTION(0x1, "gpio_out"),
  166. SUNXI_FUNCTION(0x2, "lcd0"), /* D4 */
  167. SUNXI_FUNCTION(0x3, "mmc1")), /* D0 */
  168. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5),
  169. SUNXI_FUNCTION(0x0, "gpio_in"),
  170. SUNXI_FUNCTION(0x1, "gpio_out"),
  171. SUNXI_FUNCTION(0x2, "lcd0"), /* D5 */
  172. SUNXI_FUNCTION(0x3, "mmc1")), /* D1 */
  173. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6),
  174. SUNXI_FUNCTION(0x0, "gpio_in"),
  175. SUNXI_FUNCTION(0x1, "gpio_out"),
  176. SUNXI_FUNCTION(0x2, "lcd0"), /* D6 */
  177. SUNXI_FUNCTION(0x3, "mmc1")), /* D2 */
  178. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7),
  179. SUNXI_FUNCTION(0x0, "gpio_in"),
  180. SUNXI_FUNCTION(0x1, "gpio_out"),
  181. SUNXI_FUNCTION(0x2, "lcd0"), /* D7 */
  182. SUNXI_FUNCTION(0x3, "mmc1")), /* D3 */
  183. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 10),
  184. SUNXI_FUNCTION(0x0, "gpio_in"),
  185. SUNXI_FUNCTION(0x1, "gpio_out"),
  186. SUNXI_FUNCTION(0x2, "lcd0"), /* D10 */
  187. SUNXI_FUNCTION(0x3, "uart1")), /* TX */
  188. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 11),
  189. SUNXI_FUNCTION(0x0, "gpio_in"),
  190. SUNXI_FUNCTION(0x1, "gpio_out"),
  191. SUNXI_FUNCTION(0x2, "lcd0"), /* D11 */
  192. SUNXI_FUNCTION(0x3, "uart1")), /* RX */
  193. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 12),
  194. SUNXI_FUNCTION(0x0, "gpio_in"),
  195. SUNXI_FUNCTION(0x1, "gpio_out"),
  196. SUNXI_FUNCTION(0x2, "lcd0"), /* D12 */
  197. SUNXI_FUNCTION(0x3, "uart1")), /* RTS */
  198. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 13),
  199. SUNXI_FUNCTION(0x0, "gpio_in"),
  200. SUNXI_FUNCTION(0x1, "gpio_out"),
  201. SUNXI_FUNCTION(0x2, "lcd0"), /* D13 */
  202. SUNXI_FUNCTION(0x3, "uart1")), /* CTS */
  203. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 14),
  204. SUNXI_FUNCTION(0x0, "gpio_in"),
  205. SUNXI_FUNCTION(0x1, "gpio_out"),
  206. SUNXI_FUNCTION(0x2, "lcd0")), /* D14 */
  207. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 15),
  208. SUNXI_FUNCTION(0x0, "gpio_in"),
  209. SUNXI_FUNCTION(0x1, "gpio_out"),
  210. SUNXI_FUNCTION(0x2, "lcd0")), /* D15 */
  211. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 18),
  212. SUNXI_FUNCTION(0x0, "gpio_in"),
  213. SUNXI_FUNCTION(0x1, "gpio_out"),
  214. SUNXI_FUNCTION(0x2, "lcd0"), /* D18 */
  215. SUNXI_FUNCTION(0x3, "lvds0")), /* VP0 */
  216. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 19),
  217. SUNXI_FUNCTION(0x0, "gpio_in"),
  218. SUNXI_FUNCTION(0x1, "gpio_out"),
  219. SUNXI_FUNCTION(0x2, "lcd0"), /* D19 */
  220. SUNXI_FUNCTION(0x3, "lvds0")), /* VN0 */
  221. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 20),
  222. SUNXI_FUNCTION(0x0, "gpio_in"),
  223. SUNXI_FUNCTION(0x1, "gpio_out"),
  224. SUNXI_FUNCTION(0x2, "lcd0"), /* D20 */
  225. SUNXI_FUNCTION(0x3, "lvds0")), /* VP1 */
  226. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 21),
  227. SUNXI_FUNCTION(0x0, "gpio_in"),
  228. SUNXI_FUNCTION(0x1, "gpio_out"),
  229. SUNXI_FUNCTION(0x2, "lcd0"), /* D21 */
  230. SUNXI_FUNCTION(0x3, "lvds0")), /* VN1 */
  231. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 22),
  232. SUNXI_FUNCTION(0x0, "gpio_in"),
  233. SUNXI_FUNCTION(0x1, "gpio_out"),
  234. SUNXI_FUNCTION(0x2, "lcd0"), /* D22 */
  235. SUNXI_FUNCTION(0x3, "lvds0")), /* VP2 */
  236. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 23),
  237. SUNXI_FUNCTION(0x0, "gpio_in"),
  238. SUNXI_FUNCTION(0x1, "gpio_out"),
  239. SUNXI_FUNCTION(0x2, "lcd0"), /* D23 */
  240. SUNXI_FUNCTION(0x3, "lvds0")), /* VN2 */
  241. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 24),
  242. SUNXI_FUNCTION(0x0, "gpio_in"),
  243. SUNXI_FUNCTION(0x1, "gpio_out"),
  244. SUNXI_FUNCTION(0x2, "lcd0"), /* CLK */
  245. SUNXI_FUNCTION(0x3, "lvds0")), /* VPC */
  246. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 25),
  247. SUNXI_FUNCTION(0x0, "gpio_in"),
  248. SUNXI_FUNCTION(0x1, "gpio_out"),
  249. SUNXI_FUNCTION(0x2, "lcd0"), /* DE */
  250. SUNXI_FUNCTION(0x3, "lvds0")), /* VNC */
  251. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 26),
  252. SUNXI_FUNCTION(0x0, "gpio_in"),
  253. SUNXI_FUNCTION(0x1, "gpio_out"),
  254. SUNXI_FUNCTION(0x2, "lcd0"), /* HSYNC */
  255. SUNXI_FUNCTION(0x3, "lvds0")), /* VP3 */
  256. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 27),
  257. SUNXI_FUNCTION(0x0, "gpio_in"),
  258. SUNXI_FUNCTION(0x1, "gpio_out"),
  259. SUNXI_FUNCTION(0x2, "lcd0"), /* VSYNC */
  260. SUNXI_FUNCTION(0x3, "lvds0")), /* VN3 */
  261. /* Hole */
  262. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 0),
  263. SUNXI_FUNCTION(0x0, "gpio_in"),
  264. SUNXI_FUNCTION(0x1, "gpio_out"),
  265. SUNXI_FUNCTION(0x2, "csi")), /* PCLK */
  266. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 1),
  267. SUNXI_FUNCTION(0x0, "gpio_in"),
  268. SUNXI_FUNCTION(0x1, "gpio_out"),
  269. SUNXI_FUNCTION(0x2, "csi")), /* MCLK */
  270. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 2),
  271. SUNXI_FUNCTION(0x0, "gpio_in"),
  272. SUNXI_FUNCTION(0x1, "gpio_out"),
  273. SUNXI_FUNCTION(0x2, "csi")), /* HSYNC */
  274. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 3),
  275. SUNXI_FUNCTION(0x0, "gpio_in"),
  276. SUNXI_FUNCTION(0x1, "gpio_out"),
  277. SUNXI_FUNCTION(0x2, "csi")), /* VSYNC */
  278. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 4),
  279. SUNXI_FUNCTION(0x0, "gpio_in"),
  280. SUNXI_FUNCTION(0x1, "gpio_out"),
  281. SUNXI_FUNCTION(0x2, "csi")), /* D0 */
  282. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 5),
  283. SUNXI_FUNCTION(0x0, "gpio_in"),
  284. SUNXI_FUNCTION(0x1, "gpio_out"),
  285. SUNXI_FUNCTION(0x2, "csi")), /* D1 */
  286. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 6),
  287. SUNXI_FUNCTION(0x0, "gpio_in"),
  288. SUNXI_FUNCTION(0x1, "gpio_out"),
  289. SUNXI_FUNCTION(0x2, "csi")), /* D2 */
  290. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 7),
  291. SUNXI_FUNCTION(0x0, "gpio_in"),
  292. SUNXI_FUNCTION(0x1, "gpio_out"),
  293. SUNXI_FUNCTION(0x2, "csi")), /* D3 */
  294. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 8),
  295. SUNXI_FUNCTION(0x0, "gpio_in"),
  296. SUNXI_FUNCTION(0x1, "gpio_out"),
  297. SUNXI_FUNCTION(0x2, "csi")), /* D4 */
  298. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 9),
  299. SUNXI_FUNCTION(0x0, "gpio_in"),
  300. SUNXI_FUNCTION(0x1, "gpio_out"),
  301. SUNXI_FUNCTION(0x2, "csi")), /* D5 */
  302. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 10),
  303. SUNXI_FUNCTION(0x0, "gpio_in"),
  304. SUNXI_FUNCTION(0x1, "gpio_out"),
  305. SUNXI_FUNCTION(0x2, "csi")), /* D6 */
  306. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 11),
  307. SUNXI_FUNCTION(0x0, "gpio_in"),
  308. SUNXI_FUNCTION(0x1, "gpio_out"),
  309. SUNXI_FUNCTION(0x2, "csi")), /* D7 */
  310. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 12),
  311. SUNXI_FUNCTION(0x0, "gpio_in"),
  312. SUNXI_FUNCTION(0x1, "gpio_out"),
  313. SUNXI_FUNCTION(0x2, "csi"), /* SCK */
  314. SUNXI_FUNCTION(0x3, "i2c2")), /* SCK */
  315. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 13),
  316. SUNXI_FUNCTION(0x0, "gpio_in"),
  317. SUNXI_FUNCTION(0x1, "gpio_out"),
  318. SUNXI_FUNCTION(0x2, "csi"), /* SDA */
  319. SUNXI_FUNCTION(0x3, "i2c2")), /* SDA */
  320. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 14),
  321. SUNXI_FUNCTION(0x0, "gpio_in"),
  322. SUNXI_FUNCTION(0x1, "gpio_out")),
  323. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 15),
  324. SUNXI_FUNCTION(0x0, "gpio_in"),
  325. SUNXI_FUNCTION(0x1, "gpio_out")),
  326. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 16),
  327. SUNXI_FUNCTION(0x0, "gpio_in"),
  328. SUNXI_FUNCTION(0x1, "gpio_out")),
  329. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 17),
  330. SUNXI_FUNCTION(0x0, "gpio_in"),
  331. SUNXI_FUNCTION(0x1, "gpio_out")),
  332. /* Hole */
  333. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0),
  334. SUNXI_FUNCTION(0x0, "gpio_in"),
  335. SUNXI_FUNCTION(0x1, "gpio_out"),
  336. SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
  337. SUNXI_FUNCTION(0x3, "jtag")), /* MS1 */
  338. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1),
  339. SUNXI_FUNCTION(0x0, "gpio_in"),
  340. SUNXI_FUNCTION(0x1, "gpio_out"),
  341. SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
  342. SUNXI_FUNCTION(0x3, "jtag")), /* DI1 */
  343. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2),
  344. SUNXI_FUNCTION(0x0, "gpio_in"),
  345. SUNXI_FUNCTION(0x1, "gpio_out"),
  346. SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
  347. SUNXI_FUNCTION(0x3, "uart0")), /* TX */
  348. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3),
  349. SUNXI_FUNCTION(0x0, "gpio_in"),
  350. SUNXI_FUNCTION(0x1, "gpio_out"),
  351. SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
  352. SUNXI_FUNCTION(0x3, "jtag")), /* DO1 */
  353. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4),
  354. SUNXI_FUNCTION(0x0, "gpio_in"),
  355. SUNXI_FUNCTION(0x1, "gpio_out"),
  356. SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
  357. SUNXI_FUNCTION(0x3, "uart0")), /* RX */
  358. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5),
  359. SUNXI_FUNCTION(0x0, "gpio_in"),
  360. SUNXI_FUNCTION(0x1, "gpio_out"),
  361. SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
  362. SUNXI_FUNCTION(0x3, "jtag")), /* CK1 */
  363. /* Hole */
  364. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
  365. SUNXI_FUNCTION(0x0, "gpio_in"),
  366. SUNXI_FUNCTION(0x1, "gpio_out"),
  367. SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
  368. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 0)), /* PG_EINT0 */
  369. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
  370. SUNXI_FUNCTION(0x0, "gpio_in"),
  371. SUNXI_FUNCTION(0x1, "gpio_out"),
  372. SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
  373. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 1)), /* PG_EINT1 */
  374. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
  375. SUNXI_FUNCTION(0x0, "gpio_in"),
  376. SUNXI_FUNCTION(0x1, "gpio_out"),
  377. SUNXI_FUNCTION(0x2, "mmc1"), /* D0 */
  378. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 2)), /* PG_EINT2 */
  379. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
  380. SUNXI_FUNCTION(0x0, "gpio_in"),
  381. SUNXI_FUNCTION(0x1, "gpio_out"),
  382. SUNXI_FUNCTION(0x2, "mmc1"), /* D1 */
  383. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 3)), /* PG_EINT3 */
  384. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
  385. SUNXI_FUNCTION(0x0, "gpio_in"),
  386. SUNXI_FUNCTION(0x1, "gpio_out"),
  387. SUNXI_FUNCTION(0x2, "mmc1"), /* D2 */
  388. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 4)), /* PG_EINT4 */
  389. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
  390. SUNXI_FUNCTION(0x0, "gpio_in"),
  391. SUNXI_FUNCTION(0x1, "gpio_out"),
  392. SUNXI_FUNCTION(0x2, "mmc1"), /* D3 */
  393. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 5)), /* PG_EINT5 */
  394. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6),
  395. SUNXI_FUNCTION(0x0, "gpio_in"),
  396. SUNXI_FUNCTION(0x1, "gpio_out"),
  397. SUNXI_FUNCTION(0x2, "uart1"), /* TX */
  398. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 6)), /* PG_EINT6 */
  399. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7),
  400. SUNXI_FUNCTION(0x0, "gpio_in"),
  401. SUNXI_FUNCTION(0x1, "gpio_out"),
  402. SUNXI_FUNCTION(0x2, "uart1"), /* RX */
  403. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 7)), /* PG_EINT7 */
  404. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
  405. SUNXI_FUNCTION(0x0, "gpio_in"),
  406. SUNXI_FUNCTION(0x1, "gpio_out"),
  407. SUNXI_FUNCTION(0x2, "uart1"), /* RTS */
  408. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 8)), /* PG_EINT8 */
  409. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
  410. SUNXI_FUNCTION(0x0, "gpio_in"),
  411. SUNXI_FUNCTION(0x1, "gpio_out"),
  412. SUNXI_FUNCTION(0x2, "uart1"), /* CTS */
  413. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 9)), /* PG_EINT9 */
  414. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
  415. SUNXI_FUNCTION(0x0, "gpio_in"),
  416. SUNXI_FUNCTION(0x1, "gpio_out"),
  417. SUNXI_FUNCTION(0x2, "i2s1"), /* SYNC */
  418. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 10)), /* PG_EINT10 */
  419. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11),
  420. SUNXI_FUNCTION(0x0, "gpio_in"),
  421. SUNXI_FUNCTION(0x1, "gpio_out"),
  422. SUNXI_FUNCTION(0x2, "i2s1"), /* CLK */
  423. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 11)), /* PG_EINT11 */
  424. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),
  425. SUNXI_FUNCTION(0x0, "gpio_in"),
  426. SUNXI_FUNCTION(0x1, "gpio_out"),
  427. SUNXI_FUNCTION(0x2, "i2s1"), /* DOUT */
  428. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 12)), /* PG_EINT12 */
  429. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13),
  430. SUNXI_FUNCTION(0x0, "gpio_in"),
  431. SUNXI_FUNCTION(0x1, "gpio_out"),
  432. SUNXI_FUNCTION(0x2, "i2s1"), /* DIN */
  433. SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 13)), /* PG_EINT13 */
  434. /* Hole */
  435. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 0),
  436. SUNXI_FUNCTION(0x0, "gpio_in"),
  437. SUNXI_FUNCTION(0x1, "gpio_out"),
  438. SUNXI_FUNCTION(0x2, "pwm0")),
  439. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 1),
  440. SUNXI_FUNCTION(0x0, "gpio_in"),
  441. SUNXI_FUNCTION(0x1, "gpio_out"),
  442. SUNXI_FUNCTION(0x2, "pwm1")),
  443. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 2),
  444. SUNXI_FUNCTION(0x0, "gpio_in"),
  445. SUNXI_FUNCTION(0x1, "gpio_out"),
  446. SUNXI_FUNCTION(0x2, "i2c0")), /* SCK */
  447. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 3),
  448. SUNXI_FUNCTION(0x0, "gpio_in"),
  449. SUNXI_FUNCTION(0x1, "gpio_out"),
  450. SUNXI_FUNCTION(0x2, "i2c0")), /* SDA */
  451. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 4),
  452. SUNXI_FUNCTION(0x0, "gpio_in"),
  453. SUNXI_FUNCTION(0x1, "gpio_out"),
  454. SUNXI_FUNCTION(0x2, "i2c1")), /* SCK */
  455. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 5),
  456. SUNXI_FUNCTION(0x0, "gpio_in"),
  457. SUNXI_FUNCTION(0x1, "gpio_out"),
  458. SUNXI_FUNCTION(0x2, "i2c1")), /* SDA */
  459. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 6),
  460. SUNXI_FUNCTION(0x0, "gpio_in"),
  461. SUNXI_FUNCTION(0x1, "gpio_out"),
  462. SUNXI_FUNCTION(0x2, "spi0"), /* CS */
  463. SUNXI_FUNCTION(0x3, "uart3")), /* TX */
  464. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 7),
  465. SUNXI_FUNCTION(0x0, "gpio_in"),
  466. SUNXI_FUNCTION(0x1, "gpio_out"),
  467. SUNXI_FUNCTION(0x2, "spi0"), /* CLK */
  468. SUNXI_FUNCTION(0x3, "uart3")), /* RX */
  469. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 8),
  470. SUNXI_FUNCTION(0x0, "gpio_in"),
  471. SUNXI_FUNCTION(0x1, "gpio_out"),
  472. SUNXI_FUNCTION(0x2, "spi0"), /* DOUT */
  473. SUNXI_FUNCTION(0x3, "uart3")), /* RTS */
  474. SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9),
  475. SUNXI_FUNCTION(0x0, "gpio_in"),
  476. SUNXI_FUNCTION(0x1, "gpio_out"),
  477. SUNXI_FUNCTION(0x2, "spi0"), /* DIN */
  478. SUNXI_FUNCTION(0x3, "uart3")), /* CTS */
  479. };
  480. static const struct sunxi_pinctrl_desc sun8i_a33_pinctrl_data = {
  481. .pins = sun8i_a33_pins,
  482. .npins = ARRAY_SIZE(sun8i_a33_pins),
  483. .irq_banks = 2,
  484. .irq_bank_base = 1,
  485. };
  486. static int sun8i_a33_pinctrl_probe(struct platform_device *pdev)
  487. {
  488. return sunxi_pinctrl_init(pdev,
  489. &sun8i_a33_pinctrl_data);
  490. }
  491. static const struct of_device_id sun8i_a33_pinctrl_match[] = {
  492. { .compatible = "allwinner,sun8i-a33-pinctrl", },
  493. {}
  494. };
  495. MODULE_DEVICE_TABLE(of, sun8i_a33_pinctrl_match);
  496. static struct platform_driver sun8i_a33_pinctrl_driver = {
  497. .probe = sun8i_a33_pinctrl_probe,
  498. .driver = {
  499. .name = "sun8i-a33-pinctrl",
  500. .of_match_table = sun8i_a33_pinctrl_match,
  501. },
  502. };
  503. module_platform_driver(sun8i_a33_pinctrl_driver);
  504. MODULE_AUTHOR("Vishnu Patekar <vishnupatekar0510@gmail.com>");
  505. MODULE_DESCRIPTION("Allwinner a33 pinctrl driver");
  506. MODULE_LICENSE("GPL");