blob: 061104be05631ead9f82b465a771b02569a7340d [file] [log] [blame]
Samuel Hollande3095022021-08-12 20:09:43 -05001// SPDX-License-Identifier: GPL-2.0
2
3#include <clk.h>
4#include <dm.h>
5#include <dm/device-internal.h>
6#include <dm/lists.h>
7#include <dm/pinctrl.h>
8#include <errno.h>
9#include <malloc.h>
10
11#include <asm/gpio.h>
12
13extern U_BOOT_DRIVER(gpio_sunxi);
14
Samuel Hollandecbbedb2021-08-16 23:56:47 -050015/*
16 * This structure implements a simplified view of the possible pinmux settings:
17 * Each mux value is assumed to be the same for a given function, across the
18 * pins in each group (almost universally true, with same rare exceptions not
19 * relevant to U-Boot), but also across different ports (not true in many
20 * cases). We ignore the first problem, and work around the latter by just
21 * supporting one particular port for a each function. This works fine for all
22 * board configurations so far. If this would need to be revisited, we could
23 * add a "u8 port;" below and match that, with 0 encoding the "don't care" case.
24 */
25struct sunxi_pinctrl_function {
26 const char name[sizeof("gpio_out")];
27 u8 mux;
28};
29
Samuel Hollande3095022021-08-12 20:09:43 -050030struct sunxi_pinctrl_desc {
Samuel Hollandecbbedb2021-08-16 23:56:47 -050031 const struct sunxi_pinctrl_function *functions;
32 u8 num_functions;
Samuel Hollande3095022021-08-12 20:09:43 -050033 u8 first_bank;
34 u8 num_banks;
35};
36
37struct sunxi_pinctrl_plat {
38 struct sunxi_gpio __iomem *base;
39};
40
Samuel Hollandecbbedb2021-08-16 23:56:47 -050041static int sunxi_pinctrl_get_pins_count(struct udevice *dev)
42{
43 const struct sunxi_pinctrl_desc *desc = dev_get_priv(dev);
44
45 return desc->num_banks * SUNXI_GPIOS_PER_BANK;
46}
47
48static const char *sunxi_pinctrl_get_pin_name(struct udevice *dev,
49 uint pin_selector)
50{
51 const struct sunxi_pinctrl_desc *desc = dev_get_priv(dev);
52 static char pin_name[sizeof("PN31")];
53
54 snprintf(pin_name, sizeof(pin_name), "P%c%d",
55 pin_selector / SUNXI_GPIOS_PER_BANK + desc->first_bank + 'A',
56 pin_selector % SUNXI_GPIOS_PER_BANK);
57
58 return pin_name;
59}
60
61static int sunxi_pinctrl_get_functions_count(struct udevice *dev)
62{
63 const struct sunxi_pinctrl_desc *desc = dev_get_priv(dev);
64
65 return desc->num_functions;
66}
67
68static const char *sunxi_pinctrl_get_function_name(struct udevice *dev,
69 uint func_selector)
70{
71 const struct sunxi_pinctrl_desc *desc = dev_get_priv(dev);
72
73 return desc->functions[func_selector].name;
74}
75
76static int sunxi_pinctrl_pinmux_set(struct udevice *dev, uint pin_selector,
77 uint func_selector)
78{
79 const struct sunxi_pinctrl_desc *desc = dev_get_priv(dev);
80 struct sunxi_pinctrl_plat *plat = dev_get_plat(dev);
81 int bank = pin_selector / SUNXI_GPIOS_PER_BANK;
82 int pin = pin_selector % SUNXI_GPIOS_PER_BANK;
83
84 debug("set mux: %-4s => %s (%d)\n",
85 sunxi_pinctrl_get_pin_name(dev, pin_selector),
86 sunxi_pinctrl_get_function_name(dev, func_selector),
87 desc->functions[func_selector].mux);
88
89 sunxi_gpio_set_cfgbank(plat->base + bank, pin,
90 desc->functions[func_selector].mux);
91
92 return 0;
93}
94
Samuel Hollandde828b42021-08-28 21:10:47 -050095static const struct pinconf_param sunxi_pinctrl_pinconf_params[] = {
96 { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 },
97 { "bias-pull-down", PIN_CONFIG_BIAS_PULL_DOWN, 2 },
98 { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 1 },
99 { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 10 },
100};
101
102static int sunxi_pinctrl_pinconf_set_pull(struct sunxi_pinctrl_plat *plat,
103 uint bank, uint pin, uint bias)
104{
105 struct sunxi_gpio *regs = &plat->base[bank];
106
107 sunxi_gpio_set_pull_bank(regs, pin, bias);
108
109 return 0;
110}
111
112static int sunxi_pinctrl_pinconf_set_drive(struct sunxi_pinctrl_plat *plat,
113 uint bank, uint pin, uint drive)
114{
115 struct sunxi_gpio *regs = &plat->base[bank];
116
117 if (drive < 10 || drive > 40)
118 return -EINVAL;
119
120 /* Convert mA to the register value, rounding down. */
121 sunxi_gpio_set_drv_bank(regs, pin, drive / 10 - 1);
122
123 return 0;
124}
125
126static int sunxi_pinctrl_pinconf_set(struct udevice *dev, uint pin_selector,
127 uint param, uint val)
128{
129 struct sunxi_pinctrl_plat *plat = dev_get_plat(dev);
130 int bank = pin_selector / SUNXI_GPIOS_PER_BANK;
131 int pin = pin_selector % SUNXI_GPIOS_PER_BANK;
132
133 switch (param) {
134 case PIN_CONFIG_BIAS_DISABLE:
135 case PIN_CONFIG_BIAS_PULL_DOWN:
136 case PIN_CONFIG_BIAS_PULL_UP:
137 return sunxi_pinctrl_pinconf_set_pull(plat, bank, pin, val);
138 case PIN_CONFIG_DRIVE_STRENGTH:
139 return sunxi_pinctrl_pinconf_set_drive(plat, bank, pin, val);
140 }
141
142 return -EINVAL;
143}
144
Samuel Holland116d5232021-08-17 00:52:00 -0500145static int sunxi_pinctrl_get_pin_muxing(struct udevice *dev, uint pin_selector,
146 char *buf, int size)
147{
148 struct sunxi_pinctrl_plat *plat = dev_get_plat(dev);
149 int bank = pin_selector / SUNXI_GPIOS_PER_BANK;
150 int pin = pin_selector % SUNXI_GPIOS_PER_BANK;
151 int mux = sunxi_gpio_get_cfgbank(plat->base + bank, pin);
152
153 switch (mux) {
154 case SUNXI_GPIO_INPUT:
155 strlcpy(buf, "gpio input", size);
156 break;
157 case SUNXI_GPIO_OUTPUT:
158 strlcpy(buf, "gpio output", size);
159 break;
160 case SUNXI_GPIO_DISABLE:
161 strlcpy(buf, "disabled", size);
162 break;
163 default:
164 snprintf(buf, size, "function %d", mux);
165 break;
166 }
167
168 return 0;
169}
170
Samuel Hollande3095022021-08-12 20:09:43 -0500171static const struct pinctrl_ops sunxi_pinctrl_ops = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500172 .get_pins_count = sunxi_pinctrl_get_pins_count,
173 .get_pin_name = sunxi_pinctrl_get_pin_name,
174 .get_functions_count = sunxi_pinctrl_get_functions_count,
175 .get_function_name = sunxi_pinctrl_get_function_name,
176 .pinmux_set = sunxi_pinctrl_pinmux_set,
Samuel Hollandde828b42021-08-28 21:10:47 -0500177 .pinconf_num_params = ARRAY_SIZE(sunxi_pinctrl_pinconf_params),
178 .pinconf_params = sunxi_pinctrl_pinconf_params,
179 .pinconf_set = sunxi_pinctrl_pinconf_set,
Samuel Hollande3095022021-08-12 20:09:43 -0500180 .set_state = pinctrl_generic_set_state,
Samuel Holland116d5232021-08-17 00:52:00 -0500181 .get_pin_muxing = sunxi_pinctrl_get_pin_muxing,
Samuel Hollande3095022021-08-12 20:09:43 -0500182};
183
184static int sunxi_pinctrl_bind(struct udevice *dev)
185{
186 struct sunxi_pinctrl_plat *plat = dev_get_plat(dev);
187 struct sunxi_pinctrl_desc *desc;
188 struct sunxi_gpio_plat *gpio_plat;
189 struct udevice *gpio_dev;
190 int i, ret;
191
192 desc = (void *)dev_get_driver_data(dev);
193 if (!desc)
194 return -EINVAL;
195 dev_set_priv(dev, desc);
196
197 plat->base = dev_read_addr_ptr(dev);
198
199 ret = device_bind_driver_to_node(dev, "gpio_sunxi", dev->name,
200 dev_ofnode(dev), &gpio_dev);
201 if (ret)
202 return ret;
203
204 for (i = 0; i < desc->num_banks; ++i) {
205 gpio_plat = malloc(sizeof(*gpio_plat));
206 if (!gpio_plat)
207 return -ENOMEM;
208
209 gpio_plat->regs = plat->base + i;
210 gpio_plat->bank_name[0] = 'P';
211 gpio_plat->bank_name[1] = 'A' + desc->first_bank + i;
212 gpio_plat->bank_name[2] = '\0';
213
214 ret = device_bind(gpio_dev, DM_DRIVER_REF(gpio_sunxi),
215 gpio_plat->bank_name, gpio_plat,
216 ofnode_null(), NULL);
217 if (ret)
218 return ret;
219 }
220
221 return 0;
222}
223
224static int sunxi_pinctrl_probe(struct udevice *dev)
225{
226 struct clk *apb_clk;
227
228 apb_clk = devm_clk_get(dev, "apb");
229 if (!IS_ERR(apb_clk))
230 clk_enable(apb_clk);
231
232 return 0;
233}
234
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500235static const struct sunxi_pinctrl_function suniv_f1c100s_pinctrl_functions[] = {
236 { "gpio_in", 0 },
237 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500238 { "i2c0", 3 }, /* PE11-PE12 */
239 { "i2c1", 3 }, /* PD5-PD6 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500240 { "mmc0", 2 }, /* PF0-PF5 */
241 { "mmc1", 3 }, /* PC0-PC2 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500242 { "spi0", 2 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500243#if IS_ENABLED(CONFIG_UART0_PORT_F)
244 { "uart0", 3 }, /* PF2-PF4 */
245#else
246 { "uart0", 5 }, /* PE0-PE1 */
247#endif
Andre Przywara72313dc2022-10-05 23:19:54 +0100248 { "uart1", 5 }, /* PA0-PA3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500249};
250
Samuel Hollande3095022021-08-12 20:09:43 -0500251static const struct sunxi_pinctrl_desc __maybe_unused suniv_f1c100s_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500252 .functions = suniv_f1c100s_pinctrl_functions,
253 .num_functions = ARRAY_SIZE(suniv_f1c100s_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500254 .first_bank = SUNXI_GPIO_A,
255 .num_banks = 6,
256};
257
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500258static const struct sunxi_pinctrl_function sun4i_a10_pinctrl_functions[] = {
Samuel Holland5d57e052021-08-28 13:21:36 -0500259 { "emac", 2 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500260 { "gpio_in", 0 },
261 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500262 { "i2c0", 2 }, /* PB0-PB1 */
263 { "i2c1", 2 }, /* PB18-PB19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500264 { "mmc0", 2 }, /* PF0-PF5 */
265#if IS_ENABLED(CONFIG_MMC1_PINS_PH)
266 { "mmc1", 5 }, /* PH22-PH27 */
267#else
268 { "mmc1", 4 }, /* PG0-PG5 */
269#endif
270 { "mmc2", 3 }, /* PC6-PC15 */
271 { "mmc3", 2 }, /* PI4-PI9 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500272 { "spi0", 3 }, /* PC0-PC2, PC23 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500273#if IS_ENABLED(CONFIG_UART0_PORT_F)
274 { "uart0", 4 }, /* PF2-PF4 */
275#else
276 { "uart0", 2 }, /* PB22-PB23 */
277#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500278};
279
Samuel Hollande3095022021-08-12 20:09:43 -0500280static const struct sunxi_pinctrl_desc __maybe_unused sun4i_a10_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500281 .functions = sun4i_a10_pinctrl_functions,
282 .num_functions = ARRAY_SIZE(sun4i_a10_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500283 .first_bank = SUNXI_GPIO_A,
284 .num_banks = 9,
285};
286
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500287static const struct sunxi_pinctrl_function sun5i_a13_pinctrl_functions[] = {
Samuel Holland5d57e052021-08-28 13:21:36 -0500288 { "emac", 2 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500289 { "gpio_in", 0 },
290 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500291 { "i2c0", 2 }, /* PB0-PB1 */
292 { "i2c1", 2 }, /* PB15-PB16 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500293 { "mmc0", 2 }, /* PF0-PF5 */
294 { "mmc1", 2 }, /* PG3-PG8 */
295 { "mmc2", 3 }, /* PC6-PC15 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500296 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500297#if IS_ENABLED(CONFIG_UART0_PORT_F)
298 { "uart0", 4 }, /* PF2-PF4 */
299#else
300 { "uart0", 2 }, /* PB19-PB20 */
301#endif
302 { "uart1", 4 }, /* PG3-PG4 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500303};
304
Samuel Hollande3095022021-08-12 20:09:43 -0500305static const struct sunxi_pinctrl_desc __maybe_unused sun5i_a13_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500306 .functions = sun5i_a13_pinctrl_functions,
307 .num_functions = ARRAY_SIZE(sun5i_a13_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500308 .first_bank = SUNXI_GPIO_A,
309 .num_banks = 7,
310};
311
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500312static const struct sunxi_pinctrl_function sun6i_a31_pinctrl_functions[] = {
Samuel Holland8181f562021-08-28 13:13:52 -0500313 { "gmac", 2 }, /* PA0-PA27 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500314 { "gpio_in", 0 },
315 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500316 { "i2c0", 2 }, /* PH14-PH15 */
317 { "i2c1", 2 }, /* PH16-PH17 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500318 { "mmc0", 2 }, /* PF0-PF5 */
319 { "mmc1", 2 }, /* PG0-PG5 */
320 { "mmc2", 3 }, /* PC6-PC15, PC24 */
321 { "mmc3", 4 }, /* PC6-PC15, PC24 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500322 { "spi0", 3 }, /* PC0-PC2, PC27 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500323#if IS_ENABLED(CONFIG_UART0_PORT_F)
324 { "uart0", 3 }, /* PF2-PF4 */
325#else
326 { "uart0", 2 }, /* PH20-PH21 */
327#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500328};
329
Samuel Hollande3095022021-08-12 20:09:43 -0500330static const struct sunxi_pinctrl_desc __maybe_unused sun6i_a31_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500331 .functions = sun6i_a31_pinctrl_functions,
332 .num_functions = ARRAY_SIZE(sun6i_a31_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500333 .first_bank = SUNXI_GPIO_A,
334 .num_banks = 8,
335};
336
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500337static const struct sunxi_pinctrl_function sun6i_a31_r_pinctrl_functions[] = {
338 { "gpio_in", 0 },
339 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500340 { "s_i2c", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500341 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500342};
343
Samuel Hollande3095022021-08-12 20:09:43 -0500344static const struct sunxi_pinctrl_desc __maybe_unused sun6i_a31_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500345 .functions = sun6i_a31_r_pinctrl_functions,
346 .num_functions = ARRAY_SIZE(sun6i_a31_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500347 .first_bank = SUNXI_GPIO_L,
348 .num_banks = 2,
349};
350
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500351static const struct sunxi_pinctrl_function sun7i_a20_pinctrl_functions[] = {
Samuel Holland5d57e052021-08-28 13:21:36 -0500352 { "emac", 2 }, /* PA0-PA17 */
Samuel Holland8181f562021-08-28 13:13:52 -0500353 { "gmac", 5 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500354 { "gpio_in", 0 },
355 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500356 { "i2c0", 2 }, /* PB0-PB1 */
357 { "i2c1", 2 }, /* PB18-PB19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500358 { "mmc0", 2 }, /* PF0-PF5 */
359#if IS_ENABLED(CONFIG_MMC1_PINS_PH)
360 { "mmc1", 5 }, /* PH22-PH27 */
361#else
362 { "mmc1", 4 }, /* PG0-PG5 */
363#endif
364 { "mmc2", 3 }, /* PC5-PC15, PC24 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500365 { "spi0", 3 }, /* PC0-PC2, PC23 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500366#if IS_ENABLED(CONFIG_UART0_PORT_F)
367 { "uart0", 4 }, /* PF2-PF4 */
368#else
369 { "uart0", 2 }, /* PB22-PB23 */
370#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500371};
372
Samuel Hollande3095022021-08-12 20:09:43 -0500373static const struct sunxi_pinctrl_desc __maybe_unused sun7i_a20_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500374 .functions = sun7i_a20_pinctrl_functions,
375 .num_functions = ARRAY_SIZE(sun7i_a20_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500376 .first_bank = SUNXI_GPIO_A,
377 .num_banks = 9,
378};
379
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500380static const struct sunxi_pinctrl_function sun8i_a23_pinctrl_functions[] = {
381 { "gpio_in", 0 },
382 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500383 { "i2c0", 2 }, /* PH2-PH3 */
384 { "i2c1", 2 }, /* PH4-PH5 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500385 { "mmc0", 2 }, /* PF0-PF5 */
386 { "mmc1", 2 }, /* PG0-PG5 */
387 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500388 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500389#if IS_ENABLED(CONFIG_UART0_PORT_F)
390 { "uart0", 3 }, /* PF2-PF4 */
391#endif
392 { "uart1", 2 }, /* PG6-PG7 */
393 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500394};
395
Samuel Hollande3095022021-08-12 20:09:43 -0500396static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a23_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500397 .functions = sun8i_a23_pinctrl_functions,
398 .num_functions = ARRAY_SIZE(sun8i_a23_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500399 .first_bank = SUNXI_GPIO_A,
400 .num_banks = 8,
401};
402
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500403static const struct sunxi_pinctrl_function sun8i_a23_r_pinctrl_functions[] = {
404 { "gpio_in", 0 },
405 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500406 { "s_i2c", 3 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500407 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500408};
409
Samuel Hollande3095022021-08-12 20:09:43 -0500410static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a23_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500411 .functions = sun8i_a23_r_pinctrl_functions,
412 .num_functions = ARRAY_SIZE(sun8i_a23_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500413 .first_bank = SUNXI_GPIO_L,
414 .num_banks = 1,
415};
416
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500417static const struct sunxi_pinctrl_function sun8i_a33_pinctrl_functions[] = {
418 { "gpio_in", 0 },
419 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500420 { "i2c0", 2 }, /* PH2-PH3 */
421 { "i2c1", 2 }, /* PH4-PH5 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500422 { "mmc0", 2 }, /* PF0-PF5 */
423 { "mmc1", 2 }, /* PG0-PG5 */
424 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500425 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500426#if IS_ENABLED(CONFIG_UART0_PORT_F)
427 { "uart0", 3 }, /* PF2-PF4 */
428#else
429 { "uart0", 3 }, /* PB0-PB1 */
430#endif
431 { "uart1", 2 }, /* PG6-PG7 */
432 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500433};
434
Samuel Hollande3095022021-08-12 20:09:43 -0500435static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a33_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500436 .functions = sun8i_a33_pinctrl_functions,
437 .num_functions = ARRAY_SIZE(sun8i_a33_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500438 .first_bank = SUNXI_GPIO_A,
439 .num_banks = 8,
440};
441
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500442static const struct sunxi_pinctrl_function sun8i_a83t_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500443 { "gmac", 4 }, /* PD2-PD23 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500444 { "gpio_in", 0 },
445 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500446 { "i2c0", 2 }, /* PH0-PH1 */
447 { "i2c1", 2 }, /* PH2-PH3 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500448 { "mmc0", 2 }, /* PF0-PF5 */
449 { "mmc1", 2 }, /* PG0-PG5 */
450 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500451 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500452#if IS_ENABLED(CONFIG_UART0_PORT_F)
453 { "uart0", 3 }, /* PF2-PF4 */
454#else
455 { "uart0", 2 }, /* PB9-PB10 */
456#endif
457 { "uart1", 2 }, /* PG6-PG7 */
458 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500459};
460
Samuel Hollande3095022021-08-12 20:09:43 -0500461static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a83t_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500462 .functions = sun8i_a83t_pinctrl_functions,
463 .num_functions = ARRAY_SIZE(sun8i_a83t_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500464 .first_bank = SUNXI_GPIO_A,
465 .num_banks = 8,
466};
467
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500468static const struct sunxi_pinctrl_function sun8i_a83t_r_pinctrl_functions[] = {
469 { "gpio_in", 0 },
470 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500471 { "s_i2c", 2 }, /* PL8-PL9 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500472 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500473};
474
Samuel Hollande3095022021-08-12 20:09:43 -0500475static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a83t_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500476 .functions = sun8i_a83t_r_pinctrl_functions,
477 .num_functions = ARRAY_SIZE(sun8i_a83t_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500478 .first_bank = SUNXI_GPIO_L,
479 .num_banks = 1,
480};
481
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500482static const struct sunxi_pinctrl_function sun8i_h3_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500483 { "emac", 2 }, /* PD0-PD17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500484 { "gpio_in", 0 },
485 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500486 { "i2c0", 2 }, /* PA11-PA12 */
487 { "i2c1", 3 }, /* PA18-PA19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500488 { "mmc0", 2 }, /* PF0-PF5 */
489 { "mmc1", 2 }, /* PG0-PG5 */
490 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500491 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500492#if IS_ENABLED(CONFIG_UART0_PORT_F)
493 { "uart0", 3 }, /* PF2-PF4 */
494#else
495 { "uart0", 2 }, /* PA4-PA5 */
496#endif
497 { "uart1", 2 }, /* PG6-PG7 */
498 { "uart2", 2 }, /* PA0-PA1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500499};
500
Samuel Hollande3095022021-08-12 20:09:43 -0500501static const struct sunxi_pinctrl_desc __maybe_unused sun8i_h3_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500502 .functions = sun8i_h3_pinctrl_functions,
503 .num_functions = ARRAY_SIZE(sun8i_h3_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500504 .first_bank = SUNXI_GPIO_A,
505 .num_banks = 7,
506};
507
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500508static const struct sunxi_pinctrl_function sun8i_h3_r_pinctrl_functions[] = {
509 { "gpio_in", 0 },
510 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500511 { "s_i2c", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500512 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500513};
514
Samuel Hollande3095022021-08-12 20:09:43 -0500515static const struct sunxi_pinctrl_desc __maybe_unused sun8i_h3_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500516 .functions = sun8i_h3_r_pinctrl_functions,
517 .num_functions = ARRAY_SIZE(sun8i_h3_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500518 .first_bank = SUNXI_GPIO_L,
519 .num_banks = 1,
520};
521
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500522static const struct sunxi_pinctrl_function sun8i_v3s_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500523 { "emac", 4 }, /* PD0-PD17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500524 { "gpio_in", 0 },
525 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500526 { "i2c0", 2 }, /* PB6-PB7 */
527 { "i2c1", 2 }, /* PB8-PB9 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500528 { "mmc0", 2 }, /* PF0-PF5 */
529 { "mmc1", 2 }, /* PG0-PG5 */
530 { "mmc2", 2 }, /* PC0-PC10 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500531 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500532#if IS_ENABLED(CONFIG_UART0_PORT_F)
533 { "uart0", 3 }, /* PF2-PF4 */
534#else
535 { "uart0", 3 }, /* PB8-PB9 */
536#endif
537 { "uart1", 2 }, /* PG6-PG7 */
538 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500539};
540
Samuel Hollande3095022021-08-12 20:09:43 -0500541static const struct sunxi_pinctrl_desc __maybe_unused sun8i_v3s_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500542 .functions = sun8i_v3s_pinctrl_functions,
543 .num_functions = ARRAY_SIZE(sun8i_v3s_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500544 .first_bank = SUNXI_GPIO_A,
545 .num_banks = 7,
546};
547
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500548static const struct sunxi_pinctrl_function sun9i_a80_pinctrl_functions[] = {
Samuel Holland8181f562021-08-28 13:13:52 -0500549 { "gmac", 2 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500550 { "gpio_in", 0 },
551 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500552 { "i2c0", 2 }, /* PH0-PH1 */
553 { "i2c1", 2 }, /* PH2-PH3 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500554 { "mmc0", 2 }, /* PF0-PF5 */
555 { "mmc1", 2 }, /* PG0-PG5 */
556 { "mmc2", 3 }, /* PC6-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500557 { "spi0", 3 }, /* PC0-PC2, PC19 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500558#if IS_ENABLED(CONFIG_UART0_PORT_F)
559 { "uart0", 4 }, /* PF2-PF4 */
560#else
561 { "uart0", 2 }, /* PH12-PH13 */
562#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500563};
564
Samuel Hollande3095022021-08-12 20:09:43 -0500565static const struct sunxi_pinctrl_desc __maybe_unused sun9i_a80_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500566 .functions = sun9i_a80_pinctrl_functions,
567 .num_functions = ARRAY_SIZE(sun9i_a80_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500568 .first_bank = SUNXI_GPIO_A,
569 .num_banks = 8,
570};
571
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500572static const struct sunxi_pinctrl_function sun9i_a80_r_pinctrl_functions[] = {
573 { "gpio_in", 0 },
574 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500575 { "s_i2c0", 2 }, /* PN0-PN1 */
576 { "s_i2c1", 3 }, /* PM8-PM9 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500577 { "s_uart", 3 }, /* PL0-PL1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500578};
579
Samuel Hollande3095022021-08-12 20:09:43 -0500580static const struct sunxi_pinctrl_desc __maybe_unused sun9i_a80_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500581 .functions = sun9i_a80_r_pinctrl_functions,
582 .num_functions = ARRAY_SIZE(sun9i_a80_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500583 .first_bank = SUNXI_GPIO_L,
584 .num_banks = 3,
585};
586
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500587static const struct sunxi_pinctrl_function sun50i_a64_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500588 { "emac", 4 }, /* PD8-PD23 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500589 { "gpio_in", 0 },
590 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500591 { "i2c0", 2 }, /* PH0-PH1 */
592 { "i2c1", 2 }, /* PH2-PH3 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500593 { "mmc0", 2 }, /* PF0-PF5 */
594 { "mmc1", 2 }, /* PG0-PG5 */
595 { "mmc2", 3 }, /* PC1-PC16 */
Samuel Holland3de641b2021-08-28 15:52:52 -0500596 { "pwm", 2 }, /* PD22 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500597 { "spi0", 4 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500598#if IS_ENABLED(CONFIG_UART0_PORT_F)
599 { "uart0", 3 }, /* PF2-PF4 */
600#else
601 { "uart0", 4 }, /* PB8-PB9 */
602#endif
603 { "uart1", 2 }, /* PG6-PG7 */
604 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500605};
606
Samuel Hollande3095022021-08-12 20:09:43 -0500607static const struct sunxi_pinctrl_desc __maybe_unused sun50i_a64_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500608 .functions = sun50i_a64_pinctrl_functions,
609 .num_functions = ARRAY_SIZE(sun50i_a64_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500610 .first_bank = SUNXI_GPIO_A,
611 .num_banks = 8,
612};
613
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500614static const struct sunxi_pinctrl_function sun50i_a64_r_pinctrl_functions[] = {
615 { "gpio_in", 0 },
616 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500617 { "s_i2c", 2 }, /* PL8-PL9 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500618 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500619};
620
Samuel Hollande3095022021-08-12 20:09:43 -0500621static const struct sunxi_pinctrl_desc __maybe_unused sun50i_a64_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500622 .functions = sun50i_a64_r_pinctrl_functions,
623 .num_functions = ARRAY_SIZE(sun50i_a64_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500624 .first_bank = SUNXI_GPIO_L,
625 .num_banks = 1,
626};
627
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500628static const struct sunxi_pinctrl_function sun50i_h5_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500629 { "emac", 2 }, /* PD0-PD17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500630 { "gpio_in", 0 },
631 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500632 { "i2c0", 2 }, /* PA11-PA12 */
633 { "i2c1", 3 }, /* PA18-PA19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500634 { "mmc0", 2 }, /* PF0-PF5 */
635 { "mmc1", 2 }, /* PG0-PG5 */
636 { "mmc2", 3 }, /* PC1-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500637 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500638#if IS_ENABLED(CONFIG_UART0_PORT_F)
639 { "uart0", 3 }, /* PF2-PF4 */
640#else
641 { "uart0", 2 }, /* PA4-PA5 */
642#endif
643 { "uart1", 2 }, /* PG6-PG7 */
644 { "uart2", 2 }, /* PA0-PA1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500645};
646
Samuel Hollande3095022021-08-12 20:09:43 -0500647static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h5_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500648 .functions = sun50i_h5_pinctrl_functions,
649 .num_functions = ARRAY_SIZE(sun50i_h5_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500650 .first_bank = SUNXI_GPIO_A,
651 .num_banks = 7,
652};
653
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500654static const struct sunxi_pinctrl_function sun50i_h6_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500655 { "emac", 5 }, /* PD0-PD20 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500656 { "gpio_in", 0 },
657 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500658 { "i2c0", 2 }, /* PD25-PD26 */
659 { "i2c1", 4 }, /* PH5-PH6 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500660 { "mmc0", 2 }, /* PF0-PF5 */
661 { "mmc1", 2 }, /* PG0-PG5 */
662 { "mmc2", 3 }, /* PC1-PC14 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500663 { "spi0", 4 }, /* PC0-PC7 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500664#if IS_ENABLED(CONFIG_UART0_PORT_F)
665 { "uart0", 3 }, /* PF2-PF4 */
666#else
667 { "uart0", 2 }, /* PH0-PH1 */
668#endif
669 { "uart1", 2 }, /* PG6-PG7 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500670};
671
Samuel Hollande3095022021-08-12 20:09:43 -0500672static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h6_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500673 .functions = sun50i_h6_pinctrl_functions,
674 .num_functions = ARRAY_SIZE(sun50i_h6_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500675 .first_bank = SUNXI_GPIO_A,
676 .num_banks = 8,
677};
678
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500679static const struct sunxi_pinctrl_function sun50i_h6_r_pinctrl_functions[] = {
680 { "gpio_in", 0 },
681 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500682 { "s_i2c", 3 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500683 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500684};
685
Samuel Hollande3095022021-08-12 20:09:43 -0500686static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h6_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500687 .functions = sun50i_h6_r_pinctrl_functions,
688 .num_functions = ARRAY_SIZE(sun50i_h6_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500689 .first_bank = SUNXI_GPIO_L,
690 .num_banks = 2,
691};
692
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500693static const struct sunxi_pinctrl_function sun50i_h616_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500694 { "emac0", 2 }, /* PI0-PI16 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500695 { "gpio_in", 0 },
696 { "gpio_out", 1 },
Samuel Holland1c17f412021-08-28 16:51:03 -0500697 { "mmc0", 2 }, /* PF0-PF5 */
698 { "mmc1", 2 }, /* PG0-PG5 */
699 { "mmc2", 3 }, /* PC0-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500700 { "spi0", 4 }, /* PC0-PC7, PC15-PC16 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500701#if IS_ENABLED(CONFIG_UART0_PORT_F)
702 { "uart0", 3 }, /* PF2-PF4 */
703#else
704 { "uart0", 2 }, /* PH0-PH1 */
705#endif
706 { "uart1", 2 }, /* PG6-PG7 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500707};
708
Samuel Hollande3095022021-08-12 20:09:43 -0500709static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h616_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500710 .functions = sun50i_h616_pinctrl_functions,
711 .num_functions = ARRAY_SIZE(sun50i_h616_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500712 .first_bank = SUNXI_GPIO_A,
713 .num_banks = 9,
714};
715
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500716static const struct sunxi_pinctrl_function sun50i_h616_r_pinctrl_functions[] = {
717 { "gpio_in", 0 },
718 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500719 { "s_i2c", 3 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500720 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500721};
722
Samuel Hollande3095022021-08-12 20:09:43 -0500723static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h616_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500724 .functions = sun50i_h616_r_pinctrl_functions,
725 .num_functions = ARRAY_SIZE(sun50i_h616_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500726 .first_bank = SUNXI_GPIO_L,
727 .num_banks = 1,
728};
729
730static const struct udevice_id sunxi_pinctrl_ids[] = {
731#ifdef CONFIG_PINCTRL_SUNIV_F1C100S
732 {
733 .compatible = "allwinner,suniv-f1c100s-pinctrl",
734 .data = (ulong)&suniv_f1c100s_pinctrl_desc,
735 },
736#endif
737#ifdef CONFIG_PINCTRL_SUN4I_A10
738 {
739 .compatible = "allwinner,sun4i-a10-pinctrl",
740 .data = (ulong)&sun4i_a10_pinctrl_desc,
741 },
742#endif
743#ifdef CONFIG_PINCTRL_SUN5I_A13
744 {
745 .compatible = "allwinner,sun5i-a10s-pinctrl",
746 .data = (ulong)&sun5i_a13_pinctrl_desc,
747 },
748 {
749 .compatible = "allwinner,sun5i-a13-pinctrl",
750 .data = (ulong)&sun5i_a13_pinctrl_desc,
751 },
752#endif
753#ifdef CONFIG_PINCTRL_SUN6I_A31
754 {
755 .compatible = "allwinner,sun6i-a31-pinctrl",
756 .data = (ulong)&sun6i_a31_pinctrl_desc,
757 },
758 {
759 .compatible = "allwinner,sun6i-a31s-pinctrl",
760 .data = (ulong)&sun6i_a31_pinctrl_desc,
761 },
762#endif
763#ifdef CONFIG_PINCTRL_SUN6I_A31_R
764 {
765 .compatible = "allwinner,sun6i-a31-r-pinctrl",
766 .data = (ulong)&sun6i_a31_r_pinctrl_desc,
767 },
768#endif
769#ifdef CONFIG_PINCTRL_SUN7I_A20
770 {
771 .compatible = "allwinner,sun7i-a20-pinctrl",
772 .data = (ulong)&sun7i_a20_pinctrl_desc,
773 },
774#endif
775#ifdef CONFIG_PINCTRL_SUN8I_A23
776 {
777 .compatible = "allwinner,sun8i-a23-pinctrl",
778 .data = (ulong)&sun8i_a23_pinctrl_desc,
779 },
780#endif
781#ifdef CONFIG_PINCTRL_SUN8I_A23_R
782 {
783 .compatible = "allwinner,sun8i-a23-r-pinctrl",
784 .data = (ulong)&sun8i_a23_r_pinctrl_desc,
785 },
786#endif
787#ifdef CONFIG_PINCTRL_SUN8I_A33
788 {
789 .compatible = "allwinner,sun8i-a33-pinctrl",
790 .data = (ulong)&sun8i_a33_pinctrl_desc,
791 },
792#endif
793#ifdef CONFIG_PINCTRL_SUN8I_A83T
794 {
795 .compatible = "allwinner,sun8i-a83t-pinctrl",
796 .data = (ulong)&sun8i_a83t_pinctrl_desc,
797 },
798#endif
799#ifdef CONFIG_PINCTRL_SUN8I_A83T_R
800 {
801 .compatible = "allwinner,sun8i-a83t-r-pinctrl",
802 .data = (ulong)&sun8i_a83t_r_pinctrl_desc,
803 },
804#endif
805#ifdef CONFIG_PINCTRL_SUN8I_H3
806 {
807 .compatible = "allwinner,sun8i-h3-pinctrl",
808 .data = (ulong)&sun8i_h3_pinctrl_desc,
809 },
810#endif
811#ifdef CONFIG_PINCTRL_SUN8I_H3_R
812 {
813 .compatible = "allwinner,sun8i-h3-r-pinctrl",
814 .data = (ulong)&sun8i_h3_r_pinctrl_desc,
815 },
816#endif
817#ifdef CONFIG_PINCTRL_SUN7I_A20
818 {
819 .compatible = "allwinner,sun8i-r40-pinctrl",
820 .data = (ulong)&sun7i_a20_pinctrl_desc,
821 },
822#endif
823#ifdef CONFIG_PINCTRL_SUN8I_V3S
824 {
825 .compatible = "allwinner,sun8i-v3-pinctrl",
826 .data = (ulong)&sun8i_v3s_pinctrl_desc,
827 },
828 {
829 .compatible = "allwinner,sun8i-v3s-pinctrl",
830 .data = (ulong)&sun8i_v3s_pinctrl_desc,
831 },
832#endif
833#ifdef CONFIG_PINCTRL_SUN9I_A80
834 {
835 .compatible = "allwinner,sun9i-a80-pinctrl",
836 .data = (ulong)&sun9i_a80_pinctrl_desc,
837 },
838#endif
839#ifdef CONFIG_PINCTRL_SUN9I_A80_R
840 {
841 .compatible = "allwinner,sun9i-a80-r-pinctrl",
842 .data = (ulong)&sun9i_a80_r_pinctrl_desc,
843 },
844#endif
845#ifdef CONFIG_PINCTRL_SUN50I_A64
846 {
847 .compatible = "allwinner,sun50i-a64-pinctrl",
848 .data = (ulong)&sun50i_a64_pinctrl_desc,
849 },
850#endif
851#ifdef CONFIG_PINCTRL_SUN50I_A64_R
852 {
853 .compatible = "allwinner,sun50i-a64-r-pinctrl",
854 .data = (ulong)&sun50i_a64_r_pinctrl_desc,
855 },
856#endif
857#ifdef CONFIG_PINCTRL_SUN50I_H5
858 {
859 .compatible = "allwinner,sun50i-h5-pinctrl",
860 .data = (ulong)&sun50i_h5_pinctrl_desc,
861 },
862#endif
863#ifdef CONFIG_PINCTRL_SUN50I_H6
864 {
865 .compatible = "allwinner,sun50i-h6-pinctrl",
866 .data = (ulong)&sun50i_h6_pinctrl_desc,
867 },
868#endif
869#ifdef CONFIG_PINCTRL_SUN50I_H6_R
870 {
871 .compatible = "allwinner,sun50i-h6-r-pinctrl",
872 .data = (ulong)&sun50i_h6_r_pinctrl_desc,
873 },
874#endif
875#ifdef CONFIG_PINCTRL_SUN50I_H616
876 {
877 .compatible = "allwinner,sun50i-h616-pinctrl",
878 .data = (ulong)&sun50i_h616_pinctrl_desc,
879 },
880#endif
881#ifdef CONFIG_PINCTRL_SUN50I_H616_R
882 {
883 .compatible = "allwinner,sun50i-h616-r-pinctrl",
884 .data = (ulong)&sun50i_h616_r_pinctrl_desc,
885 },
886#endif
887 {}
888};
889
890U_BOOT_DRIVER(sunxi_pinctrl) = {
891 .name = "sunxi-pinctrl",
892 .id = UCLASS_PINCTRL,
893 .of_match = sunxi_pinctrl_ids,
894 .bind = sunxi_pinctrl_bind,
895 .probe = sunxi_pinctrl_probe,
896 .plat_auto = sizeof(struct sunxi_pinctrl_plat),
897 .ops = &sunxi_pinctrl_ops,
898};