1838adb57SIcenowy Zheng /*
2838adb57SIcenowy Zheng * Allwinner H5 SoC pinctrl driver.
3838adb57SIcenowy Zheng *
4838adb57SIcenowy Zheng * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
5838adb57SIcenowy Zheng *
6838adb57SIcenowy Zheng * Based on pinctrl-sun8i-h3.c, which is:
7838adb57SIcenowy Zheng * Copyright (C) 2015 Jens Kuske <jenskuske@gmail.com>
8838adb57SIcenowy Zheng *
9838adb57SIcenowy Zheng * Based on pinctrl-sun8i-a23.c, which is:
10838adb57SIcenowy Zheng * Copyright (C) 2014 Chen-Yu Tsai <wens@csie.org>
11838adb57SIcenowy Zheng * Copyright (C) 2014 Maxime Ripard <maxime.ripard@free-electrons.com>
12838adb57SIcenowy Zheng *
13838adb57SIcenowy Zheng * This file is licensed under the terms of the GNU General Public
14838adb57SIcenowy Zheng * License version 2. This program is licensed "as is" without any
15838adb57SIcenowy Zheng * warranty of any kind, whether express or implied.
16838adb57SIcenowy Zheng */
17838adb57SIcenowy Zheng
18838adb57SIcenowy Zheng #include <linux/module.h>
19838adb57SIcenowy Zheng #include <linux/platform_device.h>
20838adb57SIcenowy Zheng #include <linux/of.h>
21838adb57SIcenowy Zheng #include <linux/pinctrl/pinctrl.h>
22838adb57SIcenowy Zheng
23838adb57SIcenowy Zheng #include "pinctrl-sunxi.h"
24838adb57SIcenowy Zheng
25838adb57SIcenowy Zheng static const struct sunxi_desc_pin sun50i_h5_pins[] = {
26838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 0),
27838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
28838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
29838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart2"), /* TX */
30838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "jtag"), /* MS */
31838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 0)), /* PA_EINT0 */
32838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 1),
33838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
34838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
35838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart2"), /* RX */
36838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "jtag"), /* CK */
37838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 1)), /* PA_EINT1 */
38838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 2),
39838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
40838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
41838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart2"), /* RTS */
42838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "jtag"), /* DO */
43838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 2)), /* PA_EINT2 */
44838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 3),
45838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
46838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
47838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
48838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "jtag"), /* DI */
49838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 3)), /* PA_EINT3 */
50838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 4),
51838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
52838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
53838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart0"), /* TX */
54838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 4)), /* PA_EINT4 */
55838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 5),
56838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
57838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
58838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart0"), /* RX */
59838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "pwm0"),
60838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 5)), /* PA_EINT5 */
61838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 6),
62838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
63838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
64838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "sim"), /* PWREN */
65838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)), /* PA_EINT6 */
66838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 7),
67838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
68838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
69838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "sim"), /* CLK */
70838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 7)), /* PA_EINT7 */
71838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 8),
72838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
73838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
74838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "sim"), /* DATA */
75838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 8)), /* PA_EINT8 */
76838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 9),
77838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
78838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
79838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "sim"), /* RST */
80838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 9)), /* PA_EINT9 */
81838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 10),
82838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
83838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
84838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "sim"), /* DET */
85838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 10)), /* PA_EINT10 */
86838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 11),
87838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
88838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
89838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2c0"), /* SCK */
90838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "di"), /* TX */
91838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 11)), /* PA_EINT11 */
92838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 12),
93838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
94838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
95838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2c0"), /* SDA */
96838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "di"), /* RX */
97838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 12)), /* PA_EINT12 */
98838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 13),
99838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
100838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
101838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "spi1"), /* CS */
102838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "uart3"), /* TX */
103838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 13)), /* PA_EINT13 */
104838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 14),
105838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
106838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
107838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
108838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "uart3"), /* RX */
109838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 14)), /* PA_EINT14 */
110838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 15),
111838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
112838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
113838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
114838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "uart3"), /* RTS */
115838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 15)), /* PA_EINT15 */
116838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 16),
117838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
118838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
119838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
120838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "uart3"), /* CTS */
121838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 16)), /* PA_EINT16 */
122838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 17),
123838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
124838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
125838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "spdif"), /* OUT */
126838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 17)), /* PA_EINT17 */
127838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 18),
128838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
129838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
130838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2s0"), /* SYNC */
131838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "i2c1"), /* SCK */
132838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 18)), /* PA_EINT18 */
133838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 19),
134838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
135838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
136838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2s0"), /* CLK */
137838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "i2c1"), /* SDA */
138838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 19)), /* PA_EINT19 */
139838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 20),
140838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
141838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
142838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2s0"), /* DOUT */
143838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "sim"), /* VPPEN */
144838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 20)), /* PA_EINT20 */
145838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 21),
146838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
147838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
148838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2s0"), /* DIN */
149838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "sim"), /* VPPPP */
150838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 21)), /* PA_EINT21 */
151838adb57SIcenowy Zheng /* Hole */
152838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0),
153838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
154838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
155838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* WE */
156838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
157838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1),
158838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
159838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
160838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* ALE */
161838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "spi0"), /* MISO */
162838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "mmc2")), /* DS */
163838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2),
164838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
165838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
166838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* CLE */
167838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "spi0")), /* CLK */
168838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3),
169838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
170838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
171838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* CE1 */
172838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "spi0")), /* CS */
173838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4),
174838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
175838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
176838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* CE0 */
177838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "spi0")), /* MISO */
178838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5),
179838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
180838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
181838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* RE */
182838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
183838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6),
184838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
185838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
186838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* RB0 */
187838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
188838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7),
189838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
190838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
191838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0")), /* RB1 */
192838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8),
193838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
194838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
195838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* DQ0 */
196838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
197838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9),
198838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
199838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
200838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* DQ1 */
201838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
202838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10),
203838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
204838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
205838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* DQ2 */
206838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
207838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 11),
208838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
209838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
210838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* DQ3 */
211838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
212838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 12),
213838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
214838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
215838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* DQ4 */
216838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */
217838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 13),
218838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
219838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
220838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* DQ5 */
221838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */
222838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14),
223838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
224838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
225838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* DQ6 */
226838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
227838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15),
228838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
229838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
230838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* DQ7 */
231838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
232838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16),
233838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
234838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
235838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "nand0"), /* DQS */
236838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "mmc2")), /* RST */
237838adb57SIcenowy Zheng /* Hole */
238838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 0),
239838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
240838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
241838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* RXD3 */
242838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "di"), /* TX */
243838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2")), /* CLK */
244838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 1),
245838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
246838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
247838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* RXD2 */
248838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "di"), /* RX */
249838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2")), /* ERR */
250838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
251838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
252838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
253838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* RXD1 */
254838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2")), /* SYNC */
255838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3),
256838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
257838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
258838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* RXD0 */
259838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2")), /* DVLD */
260838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4),
261838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
262838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
263838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* RXCK */
264838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2")), /* D0 */
265838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5),
266838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
267838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
268838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* RXCTL/RXDV */
269838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2")), /* D1 */
270838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6),
271838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
272838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
273838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* RXERR */
274838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2")), /* D2 */
275838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7),
276838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
277838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
278838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* TXD3 */
279838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2"), /* D3 */
280838adb57SIcenowy Zheng SUNXI_FUNCTION(0x5, "ts3")), /* CLK */
281838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 8),
282838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
283838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
284838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* TXD2 */
285838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2"), /* D4 */
286838adb57SIcenowy Zheng SUNXI_FUNCTION(0x5, "ts3")), /* ERR */
287838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 9),
288838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
289838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
290838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* TXD1 */
291838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2"), /* D5 */
292838adb57SIcenowy Zheng SUNXI_FUNCTION(0x5, "ts3")), /* SYNC */
293838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 10),
294838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
295838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
296838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* TXD0 */
297838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2"), /* D6 */
298838adb57SIcenowy Zheng SUNXI_FUNCTION(0x5, "ts3")), /* DVLD */
299838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 11),
300838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
301838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
302838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* CRS */
303838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts2"), /* D7 */
304838adb57SIcenowy Zheng SUNXI_FUNCTION(0x5, "ts3")), /* D0 */
305838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 12),
306838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
307838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
308838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* TXCK */
309838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "sim")), /* PWREN */
310838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 13),
311838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
312838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
313838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* TXCTL/TXEN */
314838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "sim")), /* CLK */
315838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 14),
316838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
317838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
318838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* TXERR */
319838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "sim")), /* DATA */
320838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 15),
321838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
322838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
323838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* CLKIN/COL */
324838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "sim")), /* RST */
325838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 16),
326838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
327838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
328838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac"), /* MDC */
329838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "sim")), /* DET */
330838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 17),
331838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
332838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
333838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "emac")), /* MDIO */
334838adb57SIcenowy Zheng /* Hole */
335838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 0),
336838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
337838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
338838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* PCLK */
339838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0")), /* CLK */
340838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 1),
341838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
342838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
343838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* MCLK */
344838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0")), /* ERR */
345838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 2),
346838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
347838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
348838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* HSYNC */
349838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0")), /* SYNC */
350838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 3),
351838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
352838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
353838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* VSYNC */
354838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0")), /* DVLD */
355838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 4),
356838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
357838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
358838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* D0 */
359838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0")), /* D0 */
360838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 5),
361838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
362838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
363838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* D1 */
364838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0")), /* D1 */
365838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 6),
366838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
367838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
368838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* D2 */
369838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0")), /* D2 */
370838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 7),
371838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
372838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
373838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* D3 */
374838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0"), /* D3 */
375838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts1")), /* CLK */
376838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 8),
377838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
378838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
379838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* D4 */
380838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0"), /* D4 */
381838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts1")), /* ERR */
382838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 9),
383838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
384838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
385838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* D5 */
386838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0"), /* D5 */
387838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts1")), /* SYNC */
388838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 10),
389838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
390838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
391838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* D6 */
392838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts0"), /* D6 */
393838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts1")), /* DVLD */
394838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 11),
395838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
396838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
397838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* D7 */
398838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "ts"), /* D7 */
399838adb57SIcenowy Zheng SUNXI_FUNCTION(0x4, "ts1")), /* D0 */
400838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 12),
401838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
402838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
403838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* SCK */
404838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "i2c2")), /* SCK */
405838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 13),
406838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
407838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
408838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "csi"), /* SDA */
409838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "i2c2")), /* SDA */
410838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 14),
411838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
412838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
413838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "sim")), /* VPPEN */
414838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 15),
415838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
416838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
417838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "sim")), /* VPPPP */
418838adb57SIcenowy Zheng /* Hole */
419838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0),
420838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
421838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
422838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
423838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "jtag"), /* MS */
424838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 0)), /* PF_EINT0 */
425838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1),
426838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
427838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
428838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
429838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "jtag"), /* DI */
430838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 1)), /* PF_EINT1 */
431838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2),
432838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
433838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
434838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
435838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "uart0"), /* TX */
436838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 2)), /* PF_EINT2 */
437838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3),
438838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
439838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
440838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
441838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "jtag"), /* DO */
442838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 3)), /* PF_EINT3 */
443838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4),
444838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
445838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
446838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
447838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "uart0"), /* RX */
448838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 4)), /* PF_EINT4 */
449838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5),
450838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
451838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
452838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
453838adb57SIcenowy Zheng SUNXI_FUNCTION(0x3, "jtag"), /* CK */
454838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 5)), /* PF_EINT5 */
455838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 6),
456838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
457838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
458838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 6)), /* PF_EINT6 */
459838adb57SIcenowy Zheng /* Hole */
460838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
461838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
462838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
463838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
464838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 0)), /* PG_EINT0 */
465838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
466838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
467838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
468838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
469838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 1)), /* PG_EINT1 */
470838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
471838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
472838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
473838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc1"), /* D0 */
474838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 2)), /* PG_EINT2 */
475838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
476838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
477838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
478838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc1"), /* D1 */
479838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 3)), /* PG_EINT3 */
480838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
481838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
482838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
483838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc1"), /* D2 */
484838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 4)), /* PG_EINT4 */
485838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
486838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
487838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
488838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "mmc1"), /* D3 */
489838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 5)), /* PG_EINT5 */
490838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6),
491838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
492838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
493838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart1"), /* TX */
494838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 6)), /* PG_EINT6 */
495838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7),
496838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
497838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
498838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart1"), /* RX */
499838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 7)), /* PG_EINT7 */
500838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
501838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
502838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
503838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart1"), /* RTS */
504838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 8)), /* PG_EINT8 */
505838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
506838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
507838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
508838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "uart1"), /* CTS */
509838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 9)), /* PG_EINT9 */
510838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
511838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
512838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
513838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2s1"), /* SYNC */
514838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 10)), /* PG_EINT10 */
515838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11),
516838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
517838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
518838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2s1"), /* CLK */
519838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 11)), /* PG_EINT11 */
520838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),
521838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
522838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
523838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2s1"), /* DOUT */
524838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 12)), /* PG_EINT12 */
525838adb57SIcenowy Zheng SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13),
526838adb57SIcenowy Zheng SUNXI_FUNCTION(0x0, "gpio_in"),
527838adb57SIcenowy Zheng SUNXI_FUNCTION(0x1, "gpio_out"),
528838adb57SIcenowy Zheng SUNXI_FUNCTION(0x2, "i2s1"), /* DIN */
529838adb57SIcenowy Zheng SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 13)), /* PG_EINT13 */
530838adb57SIcenowy Zheng };
531838adb57SIcenowy Zheng
5321899ccc0SIcenowy Zheng static const struct sunxi_pinctrl_desc sun50i_h5_pinctrl_data_broken = {
533838adb57SIcenowy Zheng .pins = sun50i_h5_pins,
534838adb57SIcenowy Zheng .npins = ARRAY_SIZE(sun50i_h5_pins),
535838adb57SIcenowy Zheng .irq_banks = 2,
53607c43a38SAndre Przywara .irq_read_needs_mux = true,
53707c43a38SAndre Przywara .disable_strict_mode = true,
538838adb57SIcenowy Zheng };
539838adb57SIcenowy Zheng
5401899ccc0SIcenowy Zheng static const struct sunxi_pinctrl_desc sun50i_h5_pinctrl_data = {
5411899ccc0SIcenowy Zheng .pins = sun50i_h5_pins,
5421899ccc0SIcenowy Zheng .npins = ARRAY_SIZE(sun50i_h5_pins),
5431899ccc0SIcenowy Zheng .irq_banks = 3,
54407c43a38SAndre Przywara .irq_read_needs_mux = true,
54507c43a38SAndre Przywara .disable_strict_mode = true,
5461899ccc0SIcenowy Zheng };
5471899ccc0SIcenowy Zheng
sun50i_h5_pinctrl_probe(struct platform_device * pdev)548838adb57SIcenowy Zheng static int sun50i_h5_pinctrl_probe(struct platform_device *pdev)
549838adb57SIcenowy Zheng {
550f314f20bSPeng Fan int ret;
551f314f20bSPeng Fan
552f314f20bSPeng Fan ret = platform_irq_count(pdev);
553*35b871f7SYang Yingliang if (ret < 0)
554*35b871f7SYang Yingliang return dev_err_probe(&pdev->dev, ret,
555*35b871f7SYang Yingliang "Couldn't determine irq count\n");
556f314f20bSPeng Fan
557f314f20bSPeng Fan switch (ret) {
5581899ccc0SIcenowy Zheng case 2:
5591899ccc0SIcenowy Zheng dev_warn(&pdev->dev,
5601899ccc0SIcenowy Zheng "Your device tree's pinctrl node is broken, which has no IRQ of PG bank routed.\n");
5611899ccc0SIcenowy Zheng dev_warn(&pdev->dev,
5621899ccc0SIcenowy Zheng "Please update the device tree, otherwise PG bank IRQ won't work.\n");
5631899ccc0SIcenowy Zheng return sunxi_pinctrl_init(pdev,
5641899ccc0SIcenowy Zheng &sun50i_h5_pinctrl_data_broken);
5651899ccc0SIcenowy Zheng case 3:
566838adb57SIcenowy Zheng return sunxi_pinctrl_init(pdev,
567838adb57SIcenowy Zheng &sun50i_h5_pinctrl_data);
5681899ccc0SIcenowy Zheng default:
5691899ccc0SIcenowy Zheng return -EINVAL;
5701899ccc0SIcenowy Zheng }
571838adb57SIcenowy Zheng }
572838adb57SIcenowy Zheng
573838adb57SIcenowy Zheng static const struct of_device_id sun50i_h5_pinctrl_match[] = {
574838adb57SIcenowy Zheng { .compatible = "allwinner,sun50i-h5-pinctrl", },
575838adb57SIcenowy Zheng {}
576838adb57SIcenowy Zheng };
577838adb57SIcenowy Zheng
578838adb57SIcenowy Zheng static struct platform_driver sun50i_h5_pinctrl_driver = {
579838adb57SIcenowy Zheng .probe = sun50i_h5_pinctrl_probe,
580838adb57SIcenowy Zheng .driver = {
581838adb57SIcenowy Zheng .name = "sun50i-h5-pinctrl",
582838adb57SIcenowy Zheng .of_match_table = sun50i_h5_pinctrl_match,
583838adb57SIcenowy Zheng },
584838adb57SIcenowy Zheng };
585838adb57SIcenowy Zheng builtin_platform_driver(sun50i_h5_pinctrl_driver);
586