blob: 9ce2bc1b3afb500f4274b6a650bc58d2256a4975 [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
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500248};
249
Samuel Hollande3095022021-08-12 20:09:43 -0500250static const struct sunxi_pinctrl_desc __maybe_unused suniv_f1c100s_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500251 .functions = suniv_f1c100s_pinctrl_functions,
252 .num_functions = ARRAY_SIZE(suniv_f1c100s_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500253 .first_bank = SUNXI_GPIO_A,
254 .num_banks = 6,
255};
256
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500257static const struct sunxi_pinctrl_function sun4i_a10_pinctrl_functions[] = {
Samuel Holland5d57e052021-08-28 13:21:36 -0500258 { "emac", 2 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500259 { "gpio_in", 0 },
260 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500261 { "i2c0", 2 }, /* PB0-PB1 */
262 { "i2c1", 2 }, /* PB18-PB19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500263 { "mmc0", 2 }, /* PF0-PF5 */
264#if IS_ENABLED(CONFIG_MMC1_PINS_PH)
265 { "mmc1", 5 }, /* PH22-PH27 */
266#else
267 { "mmc1", 4 }, /* PG0-PG5 */
268#endif
269 { "mmc2", 3 }, /* PC6-PC15 */
270 { "mmc3", 2 }, /* PI4-PI9 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500271 { "spi0", 3 }, /* PC0-PC2, PC23 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500272#if IS_ENABLED(CONFIG_UART0_PORT_F)
273 { "uart0", 4 }, /* PF2-PF4 */
274#else
275 { "uart0", 2 }, /* PB22-PB23 */
276#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500277};
278
Samuel Hollande3095022021-08-12 20:09:43 -0500279static const struct sunxi_pinctrl_desc __maybe_unused sun4i_a10_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500280 .functions = sun4i_a10_pinctrl_functions,
281 .num_functions = ARRAY_SIZE(sun4i_a10_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500282 .first_bank = SUNXI_GPIO_A,
283 .num_banks = 9,
284};
285
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500286static const struct sunxi_pinctrl_function sun5i_a13_pinctrl_functions[] = {
Samuel Holland5d57e052021-08-28 13:21:36 -0500287 { "emac", 2 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500288 { "gpio_in", 0 },
289 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500290 { "i2c0", 2 }, /* PB0-PB1 */
291 { "i2c1", 2 }, /* PB15-PB16 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500292 { "mmc0", 2 }, /* PF0-PF5 */
293 { "mmc1", 2 }, /* PG3-PG8 */
294 { "mmc2", 3 }, /* PC6-PC15 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500295 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500296#if IS_ENABLED(CONFIG_UART0_PORT_F)
297 { "uart0", 4 }, /* PF2-PF4 */
298#else
299 { "uart0", 2 }, /* PB19-PB20 */
300#endif
301 { "uart1", 4 }, /* PG3-PG4 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500302};
303
Samuel Hollande3095022021-08-12 20:09:43 -0500304static const struct sunxi_pinctrl_desc __maybe_unused sun5i_a13_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500305 .functions = sun5i_a13_pinctrl_functions,
306 .num_functions = ARRAY_SIZE(sun5i_a13_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500307 .first_bank = SUNXI_GPIO_A,
308 .num_banks = 7,
309};
310
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500311static const struct sunxi_pinctrl_function sun6i_a31_pinctrl_functions[] = {
Samuel Holland8181f562021-08-28 13:13:52 -0500312 { "gmac", 2 }, /* PA0-PA27 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500313 { "gpio_in", 0 },
314 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500315 { "i2c0", 2 }, /* PH14-PH15 */
316 { "i2c1", 2 }, /* PH16-PH17 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500317 { "mmc0", 2 }, /* PF0-PF5 */
318 { "mmc1", 2 }, /* PG0-PG5 */
319 { "mmc2", 3 }, /* PC6-PC15, PC24 */
320 { "mmc3", 4 }, /* PC6-PC15, PC24 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500321 { "spi0", 3 }, /* PC0-PC2, PC27 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500322#if IS_ENABLED(CONFIG_UART0_PORT_F)
323 { "uart0", 3 }, /* PF2-PF4 */
324#else
325 { "uart0", 2 }, /* PH20-PH21 */
326#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500327};
328
Samuel Hollande3095022021-08-12 20:09:43 -0500329static const struct sunxi_pinctrl_desc __maybe_unused sun6i_a31_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500330 .functions = sun6i_a31_pinctrl_functions,
331 .num_functions = ARRAY_SIZE(sun6i_a31_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500332 .first_bank = SUNXI_GPIO_A,
333 .num_banks = 8,
334};
335
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500336static const struct sunxi_pinctrl_function sun6i_a31_r_pinctrl_functions[] = {
337 { "gpio_in", 0 },
338 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500339 { "s_i2c", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500340 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500341};
342
Samuel Hollande3095022021-08-12 20:09:43 -0500343static const struct sunxi_pinctrl_desc __maybe_unused sun6i_a31_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500344 .functions = sun6i_a31_r_pinctrl_functions,
345 .num_functions = ARRAY_SIZE(sun6i_a31_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500346 .first_bank = SUNXI_GPIO_L,
347 .num_banks = 2,
348};
349
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500350static const struct sunxi_pinctrl_function sun7i_a20_pinctrl_functions[] = {
Samuel Holland5d57e052021-08-28 13:21:36 -0500351 { "emac", 2 }, /* PA0-PA17 */
Samuel Holland8181f562021-08-28 13:13:52 -0500352 { "gmac", 5 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500353 { "gpio_in", 0 },
354 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500355 { "i2c0", 2 }, /* PB0-PB1 */
356 { "i2c1", 2 }, /* PB18-PB19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500357 { "mmc0", 2 }, /* PF0-PF5 */
358#if IS_ENABLED(CONFIG_MMC1_PINS_PH)
359 { "mmc1", 5 }, /* PH22-PH27 */
360#else
361 { "mmc1", 4 }, /* PG0-PG5 */
362#endif
363 { "mmc2", 3 }, /* PC5-PC15, PC24 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500364 { "spi0", 3 }, /* PC0-PC2, PC23 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500365#if IS_ENABLED(CONFIG_UART0_PORT_F)
366 { "uart0", 4 }, /* PF2-PF4 */
367#else
368 { "uart0", 2 }, /* PB22-PB23 */
369#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500370};
371
Samuel Hollande3095022021-08-12 20:09:43 -0500372static const struct sunxi_pinctrl_desc __maybe_unused sun7i_a20_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500373 .functions = sun7i_a20_pinctrl_functions,
374 .num_functions = ARRAY_SIZE(sun7i_a20_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500375 .first_bank = SUNXI_GPIO_A,
376 .num_banks = 9,
377};
378
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500379static const struct sunxi_pinctrl_function sun8i_a23_pinctrl_functions[] = {
380 { "gpio_in", 0 },
381 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500382 { "i2c0", 2 }, /* PH2-PH3 */
383 { "i2c1", 2 }, /* PH4-PH5 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500384 { "mmc0", 2 }, /* PF0-PF5 */
385 { "mmc1", 2 }, /* PG0-PG5 */
386 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500387 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500388#if IS_ENABLED(CONFIG_UART0_PORT_F)
389 { "uart0", 3 }, /* PF2-PF4 */
390#endif
391 { "uart1", 2 }, /* PG6-PG7 */
392 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500393};
394
Samuel Hollande3095022021-08-12 20:09:43 -0500395static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a23_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500396 .functions = sun8i_a23_pinctrl_functions,
397 .num_functions = ARRAY_SIZE(sun8i_a23_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500398 .first_bank = SUNXI_GPIO_A,
399 .num_banks = 8,
400};
401
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500402static const struct sunxi_pinctrl_function sun8i_a23_r_pinctrl_functions[] = {
403 { "gpio_in", 0 },
404 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500405 { "s_i2c", 3 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500406 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500407};
408
Samuel Hollande3095022021-08-12 20:09:43 -0500409static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a23_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500410 .functions = sun8i_a23_r_pinctrl_functions,
411 .num_functions = ARRAY_SIZE(sun8i_a23_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500412 .first_bank = SUNXI_GPIO_L,
413 .num_banks = 1,
414};
415
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500416static const struct sunxi_pinctrl_function sun8i_a33_pinctrl_functions[] = {
417 { "gpio_in", 0 },
418 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500419 { "i2c0", 2 }, /* PH2-PH3 */
420 { "i2c1", 2 }, /* PH4-PH5 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500421 { "mmc0", 2 }, /* PF0-PF5 */
422 { "mmc1", 2 }, /* PG0-PG5 */
423 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500424 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500425#if IS_ENABLED(CONFIG_UART0_PORT_F)
426 { "uart0", 3 }, /* PF2-PF4 */
427#else
428 { "uart0", 3 }, /* PB0-PB1 */
429#endif
430 { "uart1", 2 }, /* PG6-PG7 */
431 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500432};
433
Samuel Hollande3095022021-08-12 20:09:43 -0500434static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a33_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500435 .functions = sun8i_a33_pinctrl_functions,
436 .num_functions = ARRAY_SIZE(sun8i_a33_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500437 .first_bank = SUNXI_GPIO_A,
438 .num_banks = 8,
439};
440
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500441static const struct sunxi_pinctrl_function sun8i_a83t_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500442 { "gmac", 4 }, /* PD2-PD23 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500443 { "gpio_in", 0 },
444 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500445 { "i2c0", 2 }, /* PH0-PH1 */
446 { "i2c1", 2 }, /* PH2-PH3 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500447 { "mmc0", 2 }, /* PF0-PF5 */
448 { "mmc1", 2 }, /* PG0-PG5 */
449 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500450 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500451#if IS_ENABLED(CONFIG_UART0_PORT_F)
452 { "uart0", 3 }, /* PF2-PF4 */
453#else
454 { "uart0", 2 }, /* PB9-PB10 */
455#endif
456 { "uart1", 2 }, /* PG6-PG7 */
457 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500458};
459
Samuel Hollande3095022021-08-12 20:09:43 -0500460static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a83t_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500461 .functions = sun8i_a83t_pinctrl_functions,
462 .num_functions = ARRAY_SIZE(sun8i_a83t_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500463 .first_bank = SUNXI_GPIO_A,
464 .num_banks = 8,
465};
466
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500467static const struct sunxi_pinctrl_function sun8i_a83t_r_pinctrl_functions[] = {
468 { "gpio_in", 0 },
469 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500470 { "s_i2c", 2 }, /* PL8-PL9 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500471 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500472};
473
Samuel Hollande3095022021-08-12 20:09:43 -0500474static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a83t_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500475 .functions = sun8i_a83t_r_pinctrl_functions,
476 .num_functions = ARRAY_SIZE(sun8i_a83t_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500477 .first_bank = SUNXI_GPIO_L,
478 .num_banks = 1,
479};
480
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500481static const struct sunxi_pinctrl_function sun8i_h3_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500482 { "emac", 2 }, /* PD0-PD17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500483 { "gpio_in", 0 },
484 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500485 { "i2c0", 2 }, /* PA11-PA12 */
486 { "i2c1", 3 }, /* PA18-PA19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500487 { "mmc0", 2 }, /* PF0-PF5 */
488 { "mmc1", 2 }, /* PG0-PG5 */
489 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500490 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500491#if IS_ENABLED(CONFIG_UART0_PORT_F)
492 { "uart0", 3 }, /* PF2-PF4 */
493#else
494 { "uart0", 2 }, /* PA4-PA5 */
495#endif
496 { "uart1", 2 }, /* PG6-PG7 */
497 { "uart2", 2 }, /* PA0-PA1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500498};
499
Samuel Hollande3095022021-08-12 20:09:43 -0500500static const struct sunxi_pinctrl_desc __maybe_unused sun8i_h3_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500501 .functions = sun8i_h3_pinctrl_functions,
502 .num_functions = ARRAY_SIZE(sun8i_h3_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500503 .first_bank = SUNXI_GPIO_A,
504 .num_banks = 7,
505};
506
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500507static const struct sunxi_pinctrl_function sun8i_h3_r_pinctrl_functions[] = {
508 { "gpio_in", 0 },
509 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500510 { "s_i2c", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500511 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500512};
513
Samuel Hollande3095022021-08-12 20:09:43 -0500514static const struct sunxi_pinctrl_desc __maybe_unused sun8i_h3_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500515 .functions = sun8i_h3_r_pinctrl_functions,
516 .num_functions = ARRAY_SIZE(sun8i_h3_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500517 .first_bank = SUNXI_GPIO_L,
518 .num_banks = 1,
519};
520
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500521static const struct sunxi_pinctrl_function sun8i_v3s_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500522 { "emac", 4 }, /* PD0-PD17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500523 { "gpio_in", 0 },
524 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500525 { "i2c0", 2 }, /* PB6-PB7 */
526 { "i2c1", 2 }, /* PB8-PB9 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500527 { "mmc0", 2 }, /* PF0-PF5 */
528 { "mmc1", 2 }, /* PG0-PG5 */
529 { "mmc2", 2 }, /* PC0-PC10 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500530 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500531#if IS_ENABLED(CONFIG_UART0_PORT_F)
532 { "uart0", 3 }, /* PF2-PF4 */
533#else
534 { "uart0", 3 }, /* PB8-PB9 */
535#endif
536 { "uart1", 2 }, /* PG6-PG7 */
537 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500538};
539
Samuel Hollande3095022021-08-12 20:09:43 -0500540static const struct sunxi_pinctrl_desc __maybe_unused sun8i_v3s_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500541 .functions = sun8i_v3s_pinctrl_functions,
542 .num_functions = ARRAY_SIZE(sun8i_v3s_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500543 .first_bank = SUNXI_GPIO_A,
544 .num_banks = 7,
545};
546
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500547static const struct sunxi_pinctrl_function sun9i_a80_pinctrl_functions[] = {
Samuel Holland8181f562021-08-28 13:13:52 -0500548 { "gmac", 2 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500549 { "gpio_in", 0 },
550 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500551 { "i2c0", 2 }, /* PH0-PH1 */
552 { "i2c1", 2 }, /* PH2-PH3 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500553 { "mmc0", 2 }, /* PF0-PF5 */
554 { "mmc1", 2 }, /* PG0-PG5 */
555 { "mmc2", 3 }, /* PC6-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500556 { "spi0", 3 }, /* PC0-PC2, PC19 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500557#if IS_ENABLED(CONFIG_UART0_PORT_F)
558 { "uart0", 4 }, /* PF2-PF4 */
559#else
560 { "uart0", 2 }, /* PH12-PH13 */
561#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500562};
563
Samuel Hollande3095022021-08-12 20:09:43 -0500564static const struct sunxi_pinctrl_desc __maybe_unused sun9i_a80_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500565 .functions = sun9i_a80_pinctrl_functions,
566 .num_functions = ARRAY_SIZE(sun9i_a80_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500567 .first_bank = SUNXI_GPIO_A,
568 .num_banks = 8,
569};
570
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500571static const struct sunxi_pinctrl_function sun9i_a80_r_pinctrl_functions[] = {
572 { "gpio_in", 0 },
573 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500574 { "s_i2c0", 2 }, /* PN0-PN1 */
575 { "s_i2c1", 3 }, /* PM8-PM9 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500576 { "s_uart", 3 }, /* PL0-PL1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500577};
578
Samuel Hollande3095022021-08-12 20:09:43 -0500579static const struct sunxi_pinctrl_desc __maybe_unused sun9i_a80_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500580 .functions = sun9i_a80_r_pinctrl_functions,
581 .num_functions = ARRAY_SIZE(sun9i_a80_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500582 .first_bank = SUNXI_GPIO_L,
583 .num_banks = 3,
584};
585
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500586static const struct sunxi_pinctrl_function sun50i_a64_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500587 { "emac", 4 }, /* PD8-PD23 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500588 { "gpio_in", 0 },
589 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500590 { "i2c0", 2 }, /* PH0-PH1 */
591 { "i2c1", 2 }, /* PH2-PH3 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500592 { "mmc0", 2 }, /* PF0-PF5 */
593 { "mmc1", 2 }, /* PG0-PG5 */
594 { "mmc2", 3 }, /* PC1-PC16 */
Samuel Holland3de641b2021-08-28 15:52:52 -0500595 { "pwm", 2 }, /* PD22 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500596 { "spi0", 4 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500597#if IS_ENABLED(CONFIG_UART0_PORT_F)
598 { "uart0", 3 }, /* PF2-PF4 */
599#else
600 { "uart0", 4 }, /* PB8-PB9 */
601#endif
602 { "uart1", 2 }, /* PG6-PG7 */
603 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500604};
605
Samuel Hollande3095022021-08-12 20:09:43 -0500606static const struct sunxi_pinctrl_desc __maybe_unused sun50i_a64_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500607 .functions = sun50i_a64_pinctrl_functions,
608 .num_functions = ARRAY_SIZE(sun50i_a64_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500609 .first_bank = SUNXI_GPIO_A,
610 .num_banks = 8,
611};
612
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500613static const struct sunxi_pinctrl_function sun50i_a64_r_pinctrl_functions[] = {
614 { "gpio_in", 0 },
615 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500616 { "s_i2c", 2 }, /* PL8-PL9 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500617 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500618};
619
Samuel Hollande3095022021-08-12 20:09:43 -0500620static const struct sunxi_pinctrl_desc __maybe_unused sun50i_a64_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500621 .functions = sun50i_a64_r_pinctrl_functions,
622 .num_functions = ARRAY_SIZE(sun50i_a64_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500623 .first_bank = SUNXI_GPIO_L,
624 .num_banks = 1,
625};
626
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500627static const struct sunxi_pinctrl_function sun50i_h5_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500628 { "emac", 2 }, /* PD0-PD17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500629 { "gpio_in", 0 },
630 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500631 { "i2c0", 2 }, /* PA11-PA12 */
632 { "i2c1", 3 }, /* PA18-PA19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500633 { "mmc0", 2 }, /* PF0-PF5 */
634 { "mmc1", 2 }, /* PG0-PG5 */
635 { "mmc2", 3 }, /* PC1-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500636 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500637#if IS_ENABLED(CONFIG_UART0_PORT_F)
638 { "uart0", 3 }, /* PF2-PF4 */
639#else
640 { "uart0", 2 }, /* PA4-PA5 */
641#endif
642 { "uart1", 2 }, /* PG6-PG7 */
643 { "uart2", 2 }, /* PA0-PA1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500644};
645
Samuel Hollande3095022021-08-12 20:09:43 -0500646static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h5_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500647 .functions = sun50i_h5_pinctrl_functions,
648 .num_functions = ARRAY_SIZE(sun50i_h5_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500649 .first_bank = SUNXI_GPIO_A,
650 .num_banks = 7,
651};
652
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500653static const struct sunxi_pinctrl_function sun50i_h6_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500654 { "emac", 5 }, /* PD0-PD20 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500655 { "gpio_in", 0 },
656 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500657 { "i2c0", 2 }, /* PD25-PD26 */
658 { "i2c1", 4 }, /* PH5-PH6 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500659 { "mmc0", 2 }, /* PF0-PF5 */
660 { "mmc1", 2 }, /* PG0-PG5 */
661 { "mmc2", 3 }, /* PC1-PC14 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500662 { "spi0", 4 }, /* PC0-PC7 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500663#if IS_ENABLED(CONFIG_UART0_PORT_F)
664 { "uart0", 3 }, /* PF2-PF4 */
665#else
666 { "uart0", 2 }, /* PH0-PH1 */
667#endif
668 { "uart1", 2 }, /* PG6-PG7 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500669};
670
Samuel Hollande3095022021-08-12 20:09:43 -0500671static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h6_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500672 .functions = sun50i_h6_pinctrl_functions,
673 .num_functions = ARRAY_SIZE(sun50i_h6_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500674 .first_bank = SUNXI_GPIO_A,
675 .num_banks = 8,
676};
677
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500678static const struct sunxi_pinctrl_function sun50i_h6_r_pinctrl_functions[] = {
679 { "gpio_in", 0 },
680 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500681 { "s_i2c", 3 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500682 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500683};
684
Samuel Hollande3095022021-08-12 20:09:43 -0500685static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h6_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500686 .functions = sun50i_h6_r_pinctrl_functions,
687 .num_functions = ARRAY_SIZE(sun50i_h6_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500688 .first_bank = SUNXI_GPIO_L,
689 .num_banks = 2,
690};
691
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500692static const struct sunxi_pinctrl_function sun50i_h616_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500693 { "emac0", 2 }, /* PI0-PI16 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500694 { "gpio_in", 0 },
695 { "gpio_out", 1 },
Samuel Holland1c17f412021-08-28 16:51:03 -0500696 { "mmc0", 2 }, /* PF0-PF5 */
697 { "mmc1", 2 }, /* PG0-PG5 */
698 { "mmc2", 3 }, /* PC0-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500699 { "spi0", 4 }, /* PC0-PC7, PC15-PC16 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500700#if IS_ENABLED(CONFIG_UART0_PORT_F)
701 { "uart0", 3 }, /* PF2-PF4 */
702#else
703 { "uart0", 2 }, /* PH0-PH1 */
704#endif
705 { "uart1", 2 }, /* PG6-PG7 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500706};
707
Samuel Hollande3095022021-08-12 20:09:43 -0500708static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h616_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500709 .functions = sun50i_h616_pinctrl_functions,
710 .num_functions = ARRAY_SIZE(sun50i_h616_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500711 .first_bank = SUNXI_GPIO_A,
712 .num_banks = 9,
713};
714
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500715static const struct sunxi_pinctrl_function sun50i_h616_r_pinctrl_functions[] = {
716 { "gpio_in", 0 },
717 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500718 { "s_i2c", 3 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500719 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500720};
721
Samuel Hollande3095022021-08-12 20:09:43 -0500722static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h616_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500723 .functions = sun50i_h616_r_pinctrl_functions,
724 .num_functions = ARRAY_SIZE(sun50i_h616_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500725 .first_bank = SUNXI_GPIO_L,
726 .num_banks = 1,
727};
728
729static const struct udevice_id sunxi_pinctrl_ids[] = {
730#ifdef CONFIG_PINCTRL_SUNIV_F1C100S
731 {
732 .compatible = "allwinner,suniv-f1c100s-pinctrl",
733 .data = (ulong)&suniv_f1c100s_pinctrl_desc,
734 },
735#endif
736#ifdef CONFIG_PINCTRL_SUN4I_A10
737 {
738 .compatible = "allwinner,sun4i-a10-pinctrl",
739 .data = (ulong)&sun4i_a10_pinctrl_desc,
740 },
741#endif
742#ifdef CONFIG_PINCTRL_SUN5I_A13
743 {
744 .compatible = "allwinner,sun5i-a10s-pinctrl",
745 .data = (ulong)&sun5i_a13_pinctrl_desc,
746 },
747 {
748 .compatible = "allwinner,sun5i-a13-pinctrl",
749 .data = (ulong)&sun5i_a13_pinctrl_desc,
750 },
751#endif
752#ifdef CONFIG_PINCTRL_SUN6I_A31
753 {
754 .compatible = "allwinner,sun6i-a31-pinctrl",
755 .data = (ulong)&sun6i_a31_pinctrl_desc,
756 },
757 {
758 .compatible = "allwinner,sun6i-a31s-pinctrl",
759 .data = (ulong)&sun6i_a31_pinctrl_desc,
760 },
761#endif
762#ifdef CONFIG_PINCTRL_SUN6I_A31_R
763 {
764 .compatible = "allwinner,sun6i-a31-r-pinctrl",
765 .data = (ulong)&sun6i_a31_r_pinctrl_desc,
766 },
767#endif
768#ifdef CONFIG_PINCTRL_SUN7I_A20
769 {
770 .compatible = "allwinner,sun7i-a20-pinctrl",
771 .data = (ulong)&sun7i_a20_pinctrl_desc,
772 },
773#endif
774#ifdef CONFIG_PINCTRL_SUN8I_A23
775 {
776 .compatible = "allwinner,sun8i-a23-pinctrl",
777 .data = (ulong)&sun8i_a23_pinctrl_desc,
778 },
779#endif
780#ifdef CONFIG_PINCTRL_SUN8I_A23_R
781 {
782 .compatible = "allwinner,sun8i-a23-r-pinctrl",
783 .data = (ulong)&sun8i_a23_r_pinctrl_desc,
784 },
785#endif
786#ifdef CONFIG_PINCTRL_SUN8I_A33
787 {
788 .compatible = "allwinner,sun8i-a33-pinctrl",
789 .data = (ulong)&sun8i_a33_pinctrl_desc,
790 },
791#endif
792#ifdef CONFIG_PINCTRL_SUN8I_A83T
793 {
794 .compatible = "allwinner,sun8i-a83t-pinctrl",
795 .data = (ulong)&sun8i_a83t_pinctrl_desc,
796 },
797#endif
798#ifdef CONFIG_PINCTRL_SUN8I_A83T_R
799 {
800 .compatible = "allwinner,sun8i-a83t-r-pinctrl",
801 .data = (ulong)&sun8i_a83t_r_pinctrl_desc,
802 },
803#endif
804#ifdef CONFIG_PINCTRL_SUN8I_H3
805 {
806 .compatible = "allwinner,sun8i-h3-pinctrl",
807 .data = (ulong)&sun8i_h3_pinctrl_desc,
808 },
809#endif
810#ifdef CONFIG_PINCTRL_SUN8I_H3_R
811 {
812 .compatible = "allwinner,sun8i-h3-r-pinctrl",
813 .data = (ulong)&sun8i_h3_r_pinctrl_desc,
814 },
815#endif
816#ifdef CONFIG_PINCTRL_SUN7I_A20
817 {
818 .compatible = "allwinner,sun8i-r40-pinctrl",
819 .data = (ulong)&sun7i_a20_pinctrl_desc,
820 },
821#endif
822#ifdef CONFIG_PINCTRL_SUN8I_V3S
823 {
824 .compatible = "allwinner,sun8i-v3-pinctrl",
825 .data = (ulong)&sun8i_v3s_pinctrl_desc,
826 },
827 {
828 .compatible = "allwinner,sun8i-v3s-pinctrl",
829 .data = (ulong)&sun8i_v3s_pinctrl_desc,
830 },
831#endif
832#ifdef CONFIG_PINCTRL_SUN9I_A80
833 {
834 .compatible = "allwinner,sun9i-a80-pinctrl",
835 .data = (ulong)&sun9i_a80_pinctrl_desc,
836 },
837#endif
838#ifdef CONFIG_PINCTRL_SUN9I_A80_R
839 {
840 .compatible = "allwinner,sun9i-a80-r-pinctrl",
841 .data = (ulong)&sun9i_a80_r_pinctrl_desc,
842 },
843#endif
844#ifdef CONFIG_PINCTRL_SUN50I_A64
845 {
846 .compatible = "allwinner,sun50i-a64-pinctrl",
847 .data = (ulong)&sun50i_a64_pinctrl_desc,
848 },
849#endif
850#ifdef CONFIG_PINCTRL_SUN50I_A64_R
851 {
852 .compatible = "allwinner,sun50i-a64-r-pinctrl",
853 .data = (ulong)&sun50i_a64_r_pinctrl_desc,
854 },
855#endif
856#ifdef CONFIG_PINCTRL_SUN50I_H5
857 {
858 .compatible = "allwinner,sun50i-h5-pinctrl",
859 .data = (ulong)&sun50i_h5_pinctrl_desc,
860 },
861#endif
862#ifdef CONFIG_PINCTRL_SUN50I_H6
863 {
864 .compatible = "allwinner,sun50i-h6-pinctrl",
865 .data = (ulong)&sun50i_h6_pinctrl_desc,
866 },
867#endif
868#ifdef CONFIG_PINCTRL_SUN50I_H6_R
869 {
870 .compatible = "allwinner,sun50i-h6-r-pinctrl",
871 .data = (ulong)&sun50i_h6_r_pinctrl_desc,
872 },
873#endif
874#ifdef CONFIG_PINCTRL_SUN50I_H616
875 {
876 .compatible = "allwinner,sun50i-h616-pinctrl",
877 .data = (ulong)&sun50i_h616_pinctrl_desc,
878 },
879#endif
880#ifdef CONFIG_PINCTRL_SUN50I_H616_R
881 {
882 .compatible = "allwinner,sun50i-h616-r-pinctrl",
883 .data = (ulong)&sun50i_h616_r_pinctrl_desc,
884 },
885#endif
886 {}
887};
888
889U_BOOT_DRIVER(sunxi_pinctrl) = {
890 .name = "sunxi-pinctrl",
891 .id = UCLASS_PINCTRL,
892 .of_match = sunxi_pinctrl_ids,
893 .bind = sunxi_pinctrl_bind,
894 .probe = sunxi_pinctrl_probe,
895 .plat_auto = sizeof(struct sunxi_pinctrl_plat),
896 .ops = &sunxi_pinctrl_ops,
897};