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