1
0

130-pinctrl-sunxi-add-h3-pio.patch 22 KB

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