pinctrl-gr8.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. /*
  2. * NextThing GR8 SoCs pinctrl driver.
  3. *
  4. * Copyright (C) 2016 Mylene Josserand
  5. *
  6. * Based on pinctrl-sun5i-a13.c
  7. *
  8. * Mylene Josserand <mylene.josserand@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 sun5i_gr8_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, "i2c0")), /* SCK */
  26. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 1),
  27. SUNXI_FUNCTION(0x0, "gpio_in"),
  28. SUNXI_FUNCTION(0x1, "gpio_out"),
  29. SUNXI_FUNCTION(0x2, "i2c0")), /* SDA */
  30. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 2),
  31. SUNXI_FUNCTION(0x0, "gpio_in"),
  32. SUNXI_FUNCTION(0x1, "gpio_out"),
  33. SUNXI_FUNCTION(0x2, "pwm0"),
  34. SUNXI_FUNCTION(0x3, "spdif"), /* DO */
  35. SUNXI_FUNCTION_IRQ(0x6, 16)), /* EINT16 */
  36. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 3),
  37. SUNXI_FUNCTION(0x0, "gpio_in"),
  38. SUNXI_FUNCTION(0x1, "gpio_out"),
  39. SUNXI_FUNCTION(0x2, "ir0"), /* TX */
  40. SUNXI_FUNCTION_IRQ(0x6, 17)), /* EINT17 */
  41. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 4),
  42. SUNXI_FUNCTION(0x0, "gpio_in"),
  43. SUNXI_FUNCTION(0x1, "gpio_out"),
  44. SUNXI_FUNCTION(0x2, "ir0"), /* RX */
  45. SUNXI_FUNCTION_IRQ(0x6, 18)), /* EINT18 */
  46. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 5),
  47. SUNXI_FUNCTION(0x0, "gpio_in"),
  48. SUNXI_FUNCTION(0x1, "gpio_out"),
  49. SUNXI_FUNCTION(0x2, "i2s0"), /* MCLK */
  50. SUNXI_FUNCTION_IRQ(0x6, 19)), /* EINT19 */
  51. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 6),
  52. SUNXI_FUNCTION(0x0, "gpio_in"),
  53. SUNXI_FUNCTION(0x1, "gpio_out"),
  54. SUNXI_FUNCTION(0x2, "i2s0"), /* BCLK */
  55. SUNXI_FUNCTION_IRQ(0x6, 20)), /* EINT20 */
  56. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 7),
  57. SUNXI_FUNCTION(0x0, "gpio_in"),
  58. SUNXI_FUNCTION(0x1, "gpio_out"),
  59. SUNXI_FUNCTION(0x2, "i2s0"), /* LRCK */
  60. SUNXI_FUNCTION_IRQ(0x6, 21)), /* EINT21 */
  61. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 8),
  62. SUNXI_FUNCTION(0x0, "gpio_in"),
  63. SUNXI_FUNCTION(0x1, "gpio_out"),
  64. SUNXI_FUNCTION(0x2, "i2s0"), /* DO */
  65. SUNXI_FUNCTION_IRQ(0x6, 22)), /* EINT22 */
  66. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 9),
  67. SUNXI_FUNCTION(0x0, "gpio_in"),
  68. SUNXI_FUNCTION(0x1, "gpio_out"),
  69. SUNXI_FUNCTION(0x2, "i2s0"), /* DI */
  70. SUNXI_FUNCTION(0x3, "spdif"), /* DI */
  71. SUNXI_FUNCTION_IRQ(0x6, 23)), /* EINT23 */
  72. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 10),
  73. SUNXI_FUNCTION(0x0, "gpio_in"),
  74. SUNXI_FUNCTION(0x1, "gpio_out"),
  75. SUNXI_FUNCTION(0x2, "spi2"), /* CS1 */
  76. SUNXI_FUNCTION(0x3, "spdif"), /* DO */
  77. SUNXI_FUNCTION_IRQ(0x6, 24)), /* EINT24 */
  78. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 11),
  79. SUNXI_FUNCTION(0x0, "gpio_in"),
  80. SUNXI_FUNCTION(0x1, "gpio_out"),
  81. SUNXI_FUNCTION(0x2, "spi2"), /* CS0 */
  82. SUNXI_FUNCTION(0x3, "jtag"), /* MS0 */
  83. SUNXI_FUNCTION_IRQ(0x6, 25)), /* EINT25 */
  84. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 12),
  85. SUNXI_FUNCTION(0x0, "gpio_in"),
  86. SUNXI_FUNCTION(0x1, "gpio_out"),
  87. SUNXI_FUNCTION(0x2, "spi2"), /* CLK */
  88. SUNXI_FUNCTION(0x3, "jtag"), /* CK0 */
  89. SUNXI_FUNCTION_IRQ(0x6, 26)), /* EINT26 */
  90. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 13),
  91. SUNXI_FUNCTION(0x0, "gpio_in"),
  92. SUNXI_FUNCTION(0x1, "gpio_out"),
  93. SUNXI_FUNCTION(0x2, "spi2"), /* MOSI */
  94. SUNXI_FUNCTION(0x3, "jtag"), /* DO0 */
  95. SUNXI_FUNCTION_IRQ(0x6, 27)), /* EINT27 */
  96. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 14),
  97. SUNXI_FUNCTION(0x0, "gpio_in"),
  98. SUNXI_FUNCTION(0x1, "gpio_out"),
  99. SUNXI_FUNCTION(0x2, "spi2"), /* MISO */
  100. SUNXI_FUNCTION(0x3, "jtag"), /* DI0 */
  101. SUNXI_FUNCTION_IRQ(0x6, 28)), /* EINT28 */
  102. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 15),
  103. SUNXI_FUNCTION(0x0, "gpio_in"),
  104. SUNXI_FUNCTION(0x1, "gpio_out"),
  105. SUNXI_FUNCTION(0x2, "i2c1")), /* SCK */
  106. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 16),
  107. SUNXI_FUNCTION(0x0, "gpio_in"),
  108. SUNXI_FUNCTION(0x1, "gpio_out"),
  109. SUNXI_FUNCTION(0x2, "i2c1")), /* SDA */
  110. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 17),
  111. SUNXI_FUNCTION(0x0, "gpio_in"),
  112. SUNXI_FUNCTION(0x1, "gpio_out"),
  113. SUNXI_FUNCTION(0x2, "i2c2")), /* SCK */
  114. SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 18),
  115. SUNXI_FUNCTION(0x0, "gpio_in"),
  116. SUNXI_FUNCTION(0x1, "gpio_out"),
  117. SUNXI_FUNCTION(0x2, "i2c2")), /* SDA */
  118. /* Hole */
  119. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0),
  120. SUNXI_FUNCTION(0x0, "gpio_in"),
  121. SUNXI_FUNCTION(0x1, "gpio_out"),
  122. SUNXI_FUNCTION(0x2, "nand0"), /* NWE */
  123. SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
  124. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1),
  125. SUNXI_FUNCTION(0x0, "gpio_in"),
  126. SUNXI_FUNCTION(0x1, "gpio_out"),
  127. SUNXI_FUNCTION(0x2, "nand0"), /* NALE */
  128. SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
  129. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2),
  130. SUNXI_FUNCTION(0x0, "gpio_in"),
  131. SUNXI_FUNCTION(0x1, "gpio_out"),
  132. SUNXI_FUNCTION(0x2, "nand0"), /* NCLE */
  133. SUNXI_FUNCTION(0x3, "spi0")), /* CLK */
  134. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3),
  135. SUNXI_FUNCTION(0x0, "gpio_in"),
  136. SUNXI_FUNCTION(0x1, "gpio_out"),
  137. SUNXI_FUNCTION(0x2, "nand0"), /* NCE1 */
  138. SUNXI_FUNCTION(0x3, "spi0")), /* CS0 */
  139. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4),
  140. SUNXI_FUNCTION(0x0, "gpio_in"),
  141. SUNXI_FUNCTION(0x1, "gpio_out"),
  142. SUNXI_FUNCTION(0x2, "nand0")), /* NCE0 */
  143. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5),
  144. SUNXI_FUNCTION(0x0, "gpio_in"),
  145. SUNXI_FUNCTION(0x1, "gpio_out"),
  146. SUNXI_FUNCTION(0x2, "nand0")), /* NRE */
  147. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6),
  148. SUNXI_FUNCTION(0x0, "gpio_in"),
  149. SUNXI_FUNCTION(0x1, "gpio_out"),
  150. SUNXI_FUNCTION(0x2, "nand0"), /* NRB0 */
  151. SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
  152. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7),
  153. SUNXI_FUNCTION(0x0, "gpio_in"),
  154. SUNXI_FUNCTION(0x1, "gpio_out"),
  155. SUNXI_FUNCTION(0x2, "nand0"), /* NRB1 */
  156. SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
  157. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8),
  158. SUNXI_FUNCTION(0x0, "gpio_in"),
  159. SUNXI_FUNCTION(0x1, "gpio_out"),
  160. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ0 */
  161. SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
  162. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9),
  163. SUNXI_FUNCTION(0x0, "gpio_in"),
  164. SUNXI_FUNCTION(0x1, "gpio_out"),
  165. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ1 */
  166. SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
  167. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10),
  168. SUNXI_FUNCTION(0x0, "gpio_in"),
  169. SUNXI_FUNCTION(0x1, "gpio_out"),
  170. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ2 */
  171. SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
  172. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 11),
  173. SUNXI_FUNCTION(0x0, "gpio_in"),
  174. SUNXI_FUNCTION(0x1, "gpio_out"),
  175. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ3 */
  176. SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
  177. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 12),
  178. SUNXI_FUNCTION(0x0, "gpio_in"),
  179. SUNXI_FUNCTION(0x1, "gpio_out"),
  180. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ4 */
  181. SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */
  182. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 13),
  183. SUNXI_FUNCTION(0x0, "gpio_in"),
  184. SUNXI_FUNCTION(0x1, "gpio_out"),
  185. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ5 */
  186. SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */
  187. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14),
  188. SUNXI_FUNCTION(0x0, "gpio_in"),
  189. SUNXI_FUNCTION(0x1, "gpio_out"),
  190. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ6 */
  191. SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
  192. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15),
  193. SUNXI_FUNCTION(0x0, "gpio_in"),
  194. SUNXI_FUNCTION(0x1, "gpio_out"),
  195. SUNXI_FUNCTION(0x2, "nand0"), /* NDQ7 */
  196. SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
  197. /* Hole */
  198. SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 19),
  199. SUNXI_FUNCTION(0x0, "gpio_in"),
  200. SUNXI_FUNCTION(0x1, "gpio_out"),
  201. SUNXI_FUNCTION(0x2, "nand0"), /* NDQS */
  202. SUNXI_FUNCTION(0x3, "uart2"), /* RX */
  203. SUNXI_FUNCTION(0x4, "uart3")), /* RTS */
  204. /* Hole */
  205. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
  206. SUNXI_FUNCTION(0x0, "gpio_in"),
  207. SUNXI_FUNCTION(0x1, "gpio_out"),
  208. SUNXI_FUNCTION(0x2, "lcd0"), /* D2 */
  209. SUNXI_FUNCTION(0x3, "uart2")), /* TX */
  210. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3),
  211. SUNXI_FUNCTION(0x0, "gpio_in"),
  212. SUNXI_FUNCTION(0x1, "gpio_out"),
  213. SUNXI_FUNCTION(0x2, "lcd0"), /* D3 */
  214. SUNXI_FUNCTION(0x3, "uart2")), /* RX */
  215. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4),
  216. SUNXI_FUNCTION(0x0, "gpio_in"),
  217. SUNXI_FUNCTION(0x1, "gpio_out"),
  218. SUNXI_FUNCTION(0x2, "lcd0"), /* D4 */
  219. SUNXI_FUNCTION(0x3, "uart2")), /* CTS */
  220. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5),
  221. SUNXI_FUNCTION(0x0, "gpio_in"),
  222. SUNXI_FUNCTION(0x1, "gpio_out"),
  223. SUNXI_FUNCTION(0x2, "lcd0"), /* D5 */
  224. SUNXI_FUNCTION(0x3, "uart2")), /* RTS */
  225. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6),
  226. SUNXI_FUNCTION(0x0, "gpio_in"),
  227. SUNXI_FUNCTION(0x1, "gpio_out"),
  228. SUNXI_FUNCTION(0x2, "lcd0"), /* D6 */
  229. SUNXI_FUNCTION(0x3, "emac")), /* ECRS */
  230. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7),
  231. SUNXI_FUNCTION(0x0, "gpio_in"),
  232. SUNXI_FUNCTION(0x1, "gpio_out"),
  233. SUNXI_FUNCTION(0x2, "lcd0"), /* D7 */
  234. SUNXI_FUNCTION(0x3, "emac")), /* ECOL */
  235. /* Hole */
  236. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 10),
  237. SUNXI_FUNCTION(0x0, "gpio_in"),
  238. SUNXI_FUNCTION(0x1, "gpio_out"),
  239. SUNXI_FUNCTION(0x2, "lcd0"), /* D10 */
  240. SUNXI_FUNCTION(0x3, "emac")), /* ERXD0 */
  241. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 11),
  242. SUNXI_FUNCTION(0x0, "gpio_in"),
  243. SUNXI_FUNCTION(0x1, "gpio_out"),
  244. SUNXI_FUNCTION(0x2, "lcd0"), /* D11 */
  245. SUNXI_FUNCTION(0x3, "emac")), /* ERXD1 */
  246. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 12),
  247. SUNXI_FUNCTION(0x0, "gpio_in"),
  248. SUNXI_FUNCTION(0x1, "gpio_out"),
  249. SUNXI_FUNCTION(0x2, "lcd0"), /* D12 */
  250. SUNXI_FUNCTION(0x3, "emac")), /* ERXD2 */
  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"), /* D13 */
  255. SUNXI_FUNCTION(0x3, "emac")), /* ERXD3 */
  256. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 14),
  257. SUNXI_FUNCTION(0x0, "gpio_in"),
  258. SUNXI_FUNCTION(0x1, "gpio_out"),
  259. SUNXI_FUNCTION(0x2, "lcd0"), /* D14 */
  260. SUNXI_FUNCTION(0x3, "emac")), /* ERXCK */
  261. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 15),
  262. SUNXI_FUNCTION(0x0, "gpio_in"),
  263. SUNXI_FUNCTION(0x1, "gpio_out"),
  264. SUNXI_FUNCTION(0x2, "lcd0"), /* D15 */
  265. SUNXI_FUNCTION(0x3, "emac")), /* ERXERR */
  266. /* Hole */
  267. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 18),
  268. SUNXI_FUNCTION(0x0, "gpio_in"),
  269. SUNXI_FUNCTION(0x1, "gpio_out"),
  270. SUNXI_FUNCTION(0x2, "lcd0"), /* D18 */
  271. SUNXI_FUNCTION(0x3, "emac")), /* ERXDV */
  272. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 19),
  273. SUNXI_FUNCTION(0x0, "gpio_in"),
  274. SUNXI_FUNCTION(0x1, "gpio_out"),
  275. SUNXI_FUNCTION(0x2, "lcd0"), /* D19 */
  276. SUNXI_FUNCTION(0x3, "emac")), /* ETXD0 */
  277. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 20),
  278. SUNXI_FUNCTION(0x0, "gpio_in"),
  279. SUNXI_FUNCTION(0x1, "gpio_out"),
  280. SUNXI_FUNCTION(0x2, "lcd0"), /* D20 */
  281. SUNXI_FUNCTION(0x3, "emac")), /* ETXD1 */
  282. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 21),
  283. SUNXI_FUNCTION(0x0, "gpio_in"),
  284. SUNXI_FUNCTION(0x1, "gpio_out"),
  285. SUNXI_FUNCTION(0x2, "lcd0"), /* D21 */
  286. SUNXI_FUNCTION(0x3, "emac")), /* ETXD2 */
  287. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 22),
  288. SUNXI_FUNCTION(0x0, "gpio_in"),
  289. SUNXI_FUNCTION(0x1, "gpio_out"),
  290. SUNXI_FUNCTION(0x2, "lcd0"), /* D22 */
  291. SUNXI_FUNCTION(0x3, "emac")), /* ETXD3 */
  292. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 23),
  293. SUNXI_FUNCTION(0x0, "gpio_in"),
  294. SUNXI_FUNCTION(0x1, "gpio_out"),
  295. SUNXI_FUNCTION(0x2, "lcd0"), /* D23 */
  296. SUNXI_FUNCTION(0x3, "emac")), /* ETXEN */
  297. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 24),
  298. SUNXI_FUNCTION(0x0, "gpio_in"),
  299. SUNXI_FUNCTION(0x1, "gpio_out"),
  300. SUNXI_FUNCTION(0x2, "lcd0"), /* CLK */
  301. SUNXI_FUNCTION(0x3, "emac")), /* ETXCK */
  302. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 25),
  303. SUNXI_FUNCTION(0x0, "gpio_in"),
  304. SUNXI_FUNCTION(0x1, "gpio_out"),
  305. SUNXI_FUNCTION(0x2, "lcd0"), /* DE */
  306. SUNXI_FUNCTION(0x3, "emac")), /* ETXERR*/
  307. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 26),
  308. SUNXI_FUNCTION(0x0, "gpio_in"),
  309. SUNXI_FUNCTION(0x1, "gpio_out"),
  310. SUNXI_FUNCTION(0x2, "lcd0"), /* HSYNC */
  311. SUNXI_FUNCTION(0x3, "emac")), /* EMDC */
  312. SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 27),
  313. SUNXI_FUNCTION(0x0, "gpio_in"),
  314. SUNXI_FUNCTION(0x1, "gpio_out"),
  315. SUNXI_FUNCTION(0x2, "lcd0"), /* VSYNC */
  316. SUNXI_FUNCTION(0x3, "emac")), /* EMDIO */
  317. /* Hole */
  318. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 0),
  319. SUNXI_FUNCTION(0x0, "gpio_in"),
  320. SUNXI_FUNCTION(0x2, "ts0"), /* CLK */
  321. SUNXI_FUNCTION(0x3, "csi0"), /* PCLK */
  322. SUNXI_FUNCTION(0x4, "spi2"), /* CS0 */
  323. SUNXI_FUNCTION_IRQ(0x6, 14)), /* EINT14 */
  324. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 1),
  325. SUNXI_FUNCTION(0x0, "gpio_in"),
  326. SUNXI_FUNCTION(0x2, "ts0"), /* ERR */
  327. SUNXI_FUNCTION(0x3, "csi0"), /* MCLK */
  328. SUNXI_FUNCTION(0x4, "spi2"), /* CLK */
  329. SUNXI_FUNCTION_IRQ(0x6, 15)), /* EINT15 */
  330. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 2),
  331. SUNXI_FUNCTION(0x0, "gpio_in"),
  332. SUNXI_FUNCTION(0x2, "ts0"), /* SYNC */
  333. SUNXI_FUNCTION(0x3, "csi0"), /* HSYNC */
  334. SUNXI_FUNCTION(0x4, "spi2")), /* MOSI */
  335. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 3),
  336. SUNXI_FUNCTION(0x0, "gpio_in"),
  337. SUNXI_FUNCTION(0x1, "gpio_out"),
  338. SUNXI_FUNCTION(0x2, "ts0"), /* DVLD */
  339. SUNXI_FUNCTION(0x3, "csi0"), /* VSYNC */
  340. SUNXI_FUNCTION(0x4, "spi2")), /* MISO */
  341. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 4),
  342. SUNXI_FUNCTION(0x0, "gpio_in"),
  343. SUNXI_FUNCTION(0x1, "gpio_out"),
  344. SUNXI_FUNCTION(0x2, "ts0"), /* D0 */
  345. SUNXI_FUNCTION(0x3, "csi0"), /* D0 */
  346. SUNXI_FUNCTION(0x4, "mmc2")), /* D0 */
  347. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 5),
  348. SUNXI_FUNCTION(0x0, "gpio_in"),
  349. SUNXI_FUNCTION(0x1, "gpio_out"),
  350. SUNXI_FUNCTION(0x2, "ts0"), /* D1 */
  351. SUNXI_FUNCTION(0x3, "csi0"), /* D1 */
  352. SUNXI_FUNCTION(0x4, "mmc2")), /* D1 */
  353. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 6),
  354. SUNXI_FUNCTION(0x0, "gpio_in"),
  355. SUNXI_FUNCTION(0x1, "gpio_out"),
  356. SUNXI_FUNCTION(0x2, "ts0"), /* D2 */
  357. SUNXI_FUNCTION(0x3, "csi0"), /* D2 */
  358. SUNXI_FUNCTION(0x4, "mmc2")), /* D2 */
  359. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 7),
  360. SUNXI_FUNCTION(0x0, "gpio_in"),
  361. SUNXI_FUNCTION(0x1, "gpio_out"),
  362. SUNXI_FUNCTION(0x2, "ts0"), /* D3 */
  363. SUNXI_FUNCTION(0x3, "csi0"), /* D3 */
  364. SUNXI_FUNCTION(0x4, "mmc2")), /* D3 */
  365. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 8),
  366. SUNXI_FUNCTION(0x0, "gpio_in"),
  367. SUNXI_FUNCTION(0x1, "gpio_out"),
  368. SUNXI_FUNCTION(0x2, "ts0"), /* D4 */
  369. SUNXI_FUNCTION(0x3, "csi0"), /* D4 */
  370. SUNXI_FUNCTION(0x4, "mmc2")), /* CMD */
  371. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 9),
  372. SUNXI_FUNCTION(0x0, "gpio_in"),
  373. SUNXI_FUNCTION(0x1, "gpio_out"),
  374. SUNXI_FUNCTION(0x2, "ts0"), /* D5 */
  375. SUNXI_FUNCTION(0x3, "csi0"), /* D5 */
  376. SUNXI_FUNCTION(0x4, "mmc2")), /* CLK */
  377. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 10),
  378. SUNXI_FUNCTION(0x0, "gpio_in"),
  379. SUNXI_FUNCTION(0x1, "gpio_out"),
  380. SUNXI_FUNCTION(0x2, "ts0"), /* D6 */
  381. SUNXI_FUNCTION(0x3, "csi0"), /* D6 */
  382. SUNXI_FUNCTION(0x4, "uart1")), /* TX */
  383. SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 11),
  384. SUNXI_FUNCTION(0x0, "gpio_in"),
  385. SUNXI_FUNCTION(0x1, "gpio_out"),
  386. SUNXI_FUNCTION(0x2, "ts0"), /* D7 */
  387. SUNXI_FUNCTION(0x3, "csi0"), /* D7 */
  388. SUNXI_FUNCTION(0x4, "uart1")), /* RX */
  389. /* Hole */
  390. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0),
  391. SUNXI_FUNCTION(0x0, "gpio_in"),
  392. SUNXI_FUNCTION(0x1, "gpio_out"),
  393. SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
  394. SUNXI_FUNCTION(0x4, "jtag")), /* MS1 */
  395. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1),
  396. SUNXI_FUNCTION(0x0, "gpio_in"),
  397. SUNXI_FUNCTION(0x1, "gpio_out"),
  398. SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
  399. SUNXI_FUNCTION(0x4, "jtag")), /* DI1 */
  400. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2),
  401. SUNXI_FUNCTION(0x0, "gpio_in"),
  402. SUNXI_FUNCTION(0x1, "gpio_out"),
  403. SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
  404. SUNXI_FUNCTION(0x4, "uart0")), /* TX */
  405. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3),
  406. SUNXI_FUNCTION(0x0, "gpio_in"),
  407. SUNXI_FUNCTION(0x1, "gpio_out"),
  408. SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
  409. SUNXI_FUNCTION(0x4, "jtag")), /* DO1 */
  410. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4),
  411. SUNXI_FUNCTION(0x0, "gpio_in"),
  412. SUNXI_FUNCTION(0x1, "gpio_out"),
  413. SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
  414. SUNXI_FUNCTION(0x4, "uart0")), /* RX */
  415. SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5),
  416. SUNXI_FUNCTION(0x0, "gpio_in"),
  417. SUNXI_FUNCTION(0x1, "gpio_out"),
  418. SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
  419. SUNXI_FUNCTION(0x4, "jtag")), /* CK1 */
  420. /* Hole */
  421. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
  422. SUNXI_FUNCTION(0x0, "gpio_in"),
  423. SUNXI_FUNCTION(0x2, "gps"), /* CLK */
  424. SUNXI_FUNCTION_IRQ(0x6, 0)), /* EINT0 */
  425. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
  426. SUNXI_FUNCTION(0x0, "gpio_in"),
  427. SUNXI_FUNCTION(0x2, "gps"), /* SIGN */
  428. SUNXI_FUNCTION_IRQ(0x6, 1)), /* EINT1 */
  429. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
  430. SUNXI_FUNCTION(0x0, "gpio_in"),
  431. SUNXI_FUNCTION(0x2, "gps"), /* MAG */
  432. SUNXI_FUNCTION_IRQ(0x6, 2)), /* EINT2 */
  433. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
  434. SUNXI_FUNCTION(0x0, "gpio_in"),
  435. SUNXI_FUNCTION(0x1, "gpio_out"),
  436. SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
  437. SUNXI_FUNCTION(0x3, "ms"), /* BS */
  438. SUNXI_FUNCTION(0x4, "uart1"), /* TX */
  439. SUNXI_FUNCTION_IRQ(0x6, 3)), /* EINT3 */
  440. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
  441. SUNXI_FUNCTION(0x0, "gpio_in"),
  442. SUNXI_FUNCTION(0x1, "gpio_out"),
  443. SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
  444. SUNXI_FUNCTION(0x3, "ms"), /* CLK */
  445. SUNXI_FUNCTION(0x4, "uart1"), /* RX */
  446. SUNXI_FUNCTION_IRQ(0x6, 4)), /* EINT4 */
  447. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
  448. SUNXI_FUNCTION(0x0, "gpio_in"),
  449. SUNXI_FUNCTION(0x1, "gpio_out"),
  450. SUNXI_FUNCTION(0x2, "mmc1"), /* D0 */
  451. SUNXI_FUNCTION(0x3, "ms"), /* D0 */
  452. SUNXI_FUNCTION(0x4, "uart1"), /* CTS */
  453. SUNXI_FUNCTION_IRQ(0x6, 5)), /* EINT5 */
  454. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6),
  455. SUNXI_FUNCTION(0x0, "gpio_in"),
  456. SUNXI_FUNCTION(0x1, "gpio_out"),
  457. SUNXI_FUNCTION(0x2, "mmc1"), /* D1 */
  458. SUNXI_FUNCTION(0x3, "ms"), /* D1 */
  459. SUNXI_FUNCTION(0x4, "uart1"), /* RTS */
  460. SUNXI_FUNCTION(0x5, "uart2"), /* RTS */
  461. SUNXI_FUNCTION_IRQ(0x6, 6)), /* EINT6 */
  462. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7),
  463. SUNXI_FUNCTION(0x0, "gpio_in"),
  464. SUNXI_FUNCTION(0x1, "gpio_out"),
  465. SUNXI_FUNCTION(0x2, "mmc1"), /* D2 */
  466. SUNXI_FUNCTION(0x3, "ms"), /* D2 */
  467. SUNXI_FUNCTION(0x5, "uart2"), /* TX */
  468. SUNXI_FUNCTION_IRQ(0x6, 7)), /* EINT7 */
  469. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
  470. SUNXI_FUNCTION(0x0, "gpio_in"),
  471. SUNXI_FUNCTION(0x1, "gpio_out"),
  472. SUNXI_FUNCTION(0x2, "mmc1"), /* D3 */
  473. SUNXI_FUNCTION(0x3, "ms"), /* D3 */
  474. SUNXI_FUNCTION(0x5, "uart2"), /* RX */
  475. SUNXI_FUNCTION_IRQ(0x6, 8)), /* EINT8 */
  476. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
  477. SUNXI_FUNCTION(0x0, "gpio_in"),
  478. SUNXI_FUNCTION(0x1, "gpio_out"),
  479. SUNXI_FUNCTION(0x2, "spi1"), /* CS0 */
  480. SUNXI_FUNCTION(0x3, "uart3"), /* TX */
  481. SUNXI_FUNCTION_IRQ(0x6, 9)), /* EINT9 */
  482. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
  483. SUNXI_FUNCTION(0x0, "gpio_in"),
  484. SUNXI_FUNCTION(0x1, "gpio_out"),
  485. SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
  486. SUNXI_FUNCTION(0x3, "uart3"), /* RX */
  487. SUNXI_FUNCTION_IRQ(0x6, 10)), /* EINT10 */
  488. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11),
  489. SUNXI_FUNCTION(0x0, "gpio_in"),
  490. SUNXI_FUNCTION(0x1, "gpio_out"),
  491. SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
  492. SUNXI_FUNCTION(0x3, "uart3"), /* CTS */
  493. SUNXI_FUNCTION_IRQ(0x6, 11)), /* EINT11 */
  494. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),
  495. SUNXI_FUNCTION(0x0, "gpio_in"),
  496. SUNXI_FUNCTION(0x1, "gpio_out"),
  497. SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
  498. SUNXI_FUNCTION(0x3, "uart3"), /* RTS */
  499. SUNXI_FUNCTION_IRQ(0x6, 12)), /* EINT12 */
  500. SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13),
  501. SUNXI_FUNCTION(0x0, "gpio_in"),
  502. SUNXI_FUNCTION(0x1, "gpio_out"),
  503. SUNXI_FUNCTION(0x2, "spi1"), /* CS1 */
  504. SUNXI_FUNCTION(0x3, "pwm1"),
  505. SUNXI_FUNCTION(0x5, "uart2"), /* CTS */
  506. SUNXI_FUNCTION_IRQ(0x6, 13)), /* EINT13 */
  507. };
  508. static const struct sunxi_pinctrl_desc sun5i_gr8_pinctrl_data = {
  509. .pins = sun5i_gr8_pins,
  510. .npins = ARRAY_SIZE(sun5i_gr8_pins),
  511. .irq_banks = 1,
  512. };
  513. static int sun5i_gr8_pinctrl_probe(struct platform_device *pdev)
  514. {
  515. return sunxi_pinctrl_init(pdev,
  516. &sun5i_gr8_pinctrl_data);
  517. }
  518. static const struct of_device_id sun5i_gr8_pinctrl_match[] = {
  519. { .compatible = "nextthing,gr8-pinctrl", },
  520. {}
  521. };
  522. MODULE_DEVICE_TABLE(of, sun5i_gr8_pinctrl_match);
  523. static struct platform_driver sun5i_gr8_pinctrl_driver = {
  524. .probe = sun5i_gr8_pinctrl_probe,
  525. .driver = {
  526. .name = "gr8-pinctrl",
  527. .of_match_table = sun5i_gr8_pinctrl_match,
  528. },
  529. };
  530. module_platform_driver(sun5i_gr8_pinctrl_driver);
  531. MODULE_AUTHOR("Mylene Josserand <mylene.josserand@free-electrons.com");
  532. MODULE_DESCRIPTION("NextThing GR8 pinctrl driver");
  533. MODULE_LICENSE("GPL");