blob: c4fbda7a925fd83d789041443ce525e7c51fa534 [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 Hollandd98ccb82022-11-17 22:22:27 -0600341 { "s_p2wi", 3 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500342 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500343};
344
Samuel Hollande3095022021-08-12 20:09:43 -0500345static const struct sunxi_pinctrl_desc __maybe_unused sun6i_a31_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500346 .functions = sun6i_a31_r_pinctrl_functions,
347 .num_functions = ARRAY_SIZE(sun6i_a31_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500348 .first_bank = SUNXI_GPIO_L,
349 .num_banks = 2,
350};
351
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500352static const struct sunxi_pinctrl_function sun7i_a20_pinctrl_functions[] = {
Samuel Holland5d57e052021-08-28 13:21:36 -0500353 { "emac", 2 }, /* PA0-PA17 */
Samuel Holland8181f562021-08-28 13:13:52 -0500354 { "gmac", 5 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500355 { "gpio_in", 0 },
356 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500357 { "i2c0", 2 }, /* PB0-PB1 */
358 { "i2c1", 2 }, /* PB18-PB19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500359 { "mmc0", 2 }, /* PF0-PF5 */
360#if IS_ENABLED(CONFIG_MMC1_PINS_PH)
361 { "mmc1", 5 }, /* PH22-PH27 */
362#else
363 { "mmc1", 4 }, /* PG0-PG5 */
364#endif
365 { "mmc2", 3 }, /* PC5-PC15, PC24 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500366 { "spi0", 3 }, /* PC0-PC2, PC23 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500367#if IS_ENABLED(CONFIG_UART0_PORT_F)
368 { "uart0", 4 }, /* PF2-PF4 */
369#else
370 { "uart0", 2 }, /* PB22-PB23 */
371#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500372};
373
Samuel Hollande3095022021-08-12 20:09:43 -0500374static const struct sunxi_pinctrl_desc __maybe_unused sun7i_a20_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500375 .functions = sun7i_a20_pinctrl_functions,
376 .num_functions = ARRAY_SIZE(sun7i_a20_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500377 .first_bank = SUNXI_GPIO_A,
378 .num_banks = 9,
379};
380
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500381static const struct sunxi_pinctrl_function sun8i_a23_pinctrl_functions[] = {
382 { "gpio_in", 0 },
383 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500384 { "i2c0", 2 }, /* PH2-PH3 */
385 { "i2c1", 2 }, /* PH4-PH5 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500386 { "mmc0", 2 }, /* PF0-PF5 */
387 { "mmc1", 2 }, /* PG0-PG5 */
388 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500389 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500390#if IS_ENABLED(CONFIG_UART0_PORT_F)
391 { "uart0", 3 }, /* PF2-PF4 */
392#endif
393 { "uart1", 2 }, /* PG6-PG7 */
394 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500395};
396
Samuel Hollande3095022021-08-12 20:09:43 -0500397static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a23_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500398 .functions = sun8i_a23_pinctrl_functions,
399 .num_functions = ARRAY_SIZE(sun8i_a23_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500400 .first_bank = SUNXI_GPIO_A,
401 .num_banks = 8,
402};
403
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500404static const struct sunxi_pinctrl_function sun8i_a23_r_pinctrl_functions[] = {
405 { "gpio_in", 0 },
406 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500407 { "s_i2c", 3 }, /* PL0-PL1 */
Samuel Hollandd98ccb82022-11-17 22:22:27 -0600408 { "s_rsb", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500409 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500410};
411
Samuel Hollande3095022021-08-12 20:09:43 -0500412static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a23_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500413 .functions = sun8i_a23_r_pinctrl_functions,
414 .num_functions = ARRAY_SIZE(sun8i_a23_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500415 .first_bank = SUNXI_GPIO_L,
416 .num_banks = 1,
417};
418
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500419static const struct sunxi_pinctrl_function sun8i_a33_pinctrl_functions[] = {
420 { "gpio_in", 0 },
421 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500422 { "i2c0", 2 }, /* PH2-PH3 */
423 { "i2c1", 2 }, /* PH4-PH5 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500424 { "mmc0", 2 }, /* PF0-PF5 */
425 { "mmc1", 2 }, /* PG0-PG5 */
426 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500427 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500428#if IS_ENABLED(CONFIG_UART0_PORT_F)
429 { "uart0", 3 }, /* PF2-PF4 */
430#else
431 { "uart0", 3 }, /* PB0-PB1 */
432#endif
433 { "uart1", 2 }, /* PG6-PG7 */
434 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500435};
436
Samuel Hollande3095022021-08-12 20:09:43 -0500437static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a33_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500438 .functions = sun8i_a33_pinctrl_functions,
439 .num_functions = ARRAY_SIZE(sun8i_a33_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500440 .first_bank = SUNXI_GPIO_A,
441 .num_banks = 8,
442};
443
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500444static const struct sunxi_pinctrl_function sun8i_a83t_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500445 { "gmac", 4 }, /* PD2-PD23 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500446 { "gpio_in", 0 },
447 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500448 { "i2c0", 2 }, /* PH0-PH1 */
449 { "i2c1", 2 }, /* PH2-PH3 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500450 { "mmc0", 2 }, /* PF0-PF5 */
451 { "mmc1", 2 }, /* PG0-PG5 */
452 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500453 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500454#if IS_ENABLED(CONFIG_UART0_PORT_F)
455 { "uart0", 3 }, /* PF2-PF4 */
456#else
457 { "uart0", 2 }, /* PB9-PB10 */
458#endif
459 { "uart1", 2 }, /* PG6-PG7 */
460 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500461};
462
Samuel Hollande3095022021-08-12 20:09:43 -0500463static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a83t_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500464 .functions = sun8i_a83t_pinctrl_functions,
465 .num_functions = ARRAY_SIZE(sun8i_a83t_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500466 .first_bank = SUNXI_GPIO_A,
467 .num_banks = 8,
468};
469
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500470static const struct sunxi_pinctrl_function sun8i_a83t_r_pinctrl_functions[] = {
471 { "gpio_in", 0 },
472 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500473 { "s_i2c", 2 }, /* PL8-PL9 */
Samuel Hollandd98ccb82022-11-17 22:22:27 -0600474 { "s_rsb", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500475 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500476};
477
Samuel Hollande3095022021-08-12 20:09:43 -0500478static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a83t_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500479 .functions = sun8i_a83t_r_pinctrl_functions,
480 .num_functions = ARRAY_SIZE(sun8i_a83t_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500481 .first_bank = SUNXI_GPIO_L,
482 .num_banks = 1,
483};
484
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500485static const struct sunxi_pinctrl_function sun8i_h3_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500486 { "emac", 2 }, /* PD0-PD17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500487 { "gpio_in", 0 },
488 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500489 { "i2c0", 2 }, /* PA11-PA12 */
490 { "i2c1", 3 }, /* PA18-PA19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500491 { "mmc0", 2 }, /* PF0-PF5 */
492 { "mmc1", 2 }, /* PG0-PG5 */
493 { "mmc2", 3 }, /* PC5-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500494 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500495#if IS_ENABLED(CONFIG_UART0_PORT_F)
496 { "uart0", 3 }, /* PF2-PF4 */
497#else
498 { "uart0", 2 }, /* PA4-PA5 */
499#endif
500 { "uart1", 2 }, /* PG6-PG7 */
501 { "uart2", 2 }, /* PA0-PA1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500502};
503
Samuel Hollande3095022021-08-12 20:09:43 -0500504static const struct sunxi_pinctrl_desc __maybe_unused sun8i_h3_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500505 .functions = sun8i_h3_pinctrl_functions,
506 .num_functions = ARRAY_SIZE(sun8i_h3_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500507 .first_bank = SUNXI_GPIO_A,
508 .num_banks = 7,
509};
510
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500511static const struct sunxi_pinctrl_function sun8i_h3_r_pinctrl_functions[] = {
512 { "gpio_in", 0 },
513 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500514 { "s_i2c", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500515 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500516};
517
Samuel Hollande3095022021-08-12 20:09:43 -0500518static const struct sunxi_pinctrl_desc __maybe_unused sun8i_h3_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500519 .functions = sun8i_h3_r_pinctrl_functions,
520 .num_functions = ARRAY_SIZE(sun8i_h3_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500521 .first_bank = SUNXI_GPIO_L,
522 .num_banks = 1,
523};
524
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500525static const struct sunxi_pinctrl_function sun8i_v3s_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500526 { "emac", 4 }, /* PD0-PD17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500527 { "gpio_in", 0 },
528 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500529 { "i2c0", 2 }, /* PB6-PB7 */
530 { "i2c1", 2 }, /* PB8-PB9 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500531 { "mmc0", 2 }, /* PF0-PF5 */
532 { "mmc1", 2 }, /* PG0-PG5 */
533 { "mmc2", 2 }, /* PC0-PC10 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500534 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500535#if IS_ENABLED(CONFIG_UART0_PORT_F)
536 { "uart0", 3 }, /* PF2-PF4 */
537#else
538 { "uart0", 3 }, /* PB8-PB9 */
539#endif
540 { "uart1", 2 }, /* PG6-PG7 */
541 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500542};
543
Samuel Hollande3095022021-08-12 20:09:43 -0500544static const struct sunxi_pinctrl_desc __maybe_unused sun8i_v3s_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500545 .functions = sun8i_v3s_pinctrl_functions,
546 .num_functions = ARRAY_SIZE(sun8i_v3s_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500547 .first_bank = SUNXI_GPIO_A,
548 .num_banks = 7,
549};
550
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500551static const struct sunxi_pinctrl_function sun9i_a80_pinctrl_functions[] = {
Samuel Holland8181f562021-08-28 13:13:52 -0500552 { "gmac", 2 }, /* PA0-PA17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500553 { "gpio_in", 0 },
554 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500555 { "i2c0", 2 }, /* PH0-PH1 */
556 { "i2c1", 2 }, /* PH2-PH3 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500557 { "mmc0", 2 }, /* PF0-PF5 */
558 { "mmc1", 2 }, /* PG0-PG5 */
559 { "mmc2", 3 }, /* PC6-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500560 { "spi0", 3 }, /* PC0-PC2, PC19 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500561#if IS_ENABLED(CONFIG_UART0_PORT_F)
562 { "uart0", 4 }, /* PF2-PF4 */
563#else
564 { "uart0", 2 }, /* PH12-PH13 */
565#endif
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500566};
567
Samuel Hollande3095022021-08-12 20:09:43 -0500568static const struct sunxi_pinctrl_desc __maybe_unused sun9i_a80_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500569 .functions = sun9i_a80_pinctrl_functions,
570 .num_functions = ARRAY_SIZE(sun9i_a80_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500571 .first_bank = SUNXI_GPIO_A,
572 .num_banks = 8,
573};
574
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500575static const struct sunxi_pinctrl_function sun9i_a80_r_pinctrl_functions[] = {
576 { "gpio_in", 0 },
577 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500578 { "s_i2c0", 2 }, /* PN0-PN1 */
579 { "s_i2c1", 3 }, /* PM8-PM9 */
Samuel Hollandd98ccb82022-11-17 22:22:27 -0600580 { "s_rsb", 3 }, /* PN0-PN1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500581 { "s_uart", 3 }, /* PL0-PL1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500582};
583
Samuel Hollande3095022021-08-12 20:09:43 -0500584static const struct sunxi_pinctrl_desc __maybe_unused sun9i_a80_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500585 .functions = sun9i_a80_r_pinctrl_functions,
586 .num_functions = ARRAY_SIZE(sun9i_a80_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500587 .first_bank = SUNXI_GPIO_L,
588 .num_banks = 3,
589};
590
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500591static const struct sunxi_pinctrl_function sun50i_a64_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500592 { "emac", 4 }, /* PD8-PD23 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500593 { "gpio_in", 0 },
594 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500595 { "i2c0", 2 }, /* PH0-PH1 */
596 { "i2c1", 2 }, /* PH2-PH3 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500597 { "mmc0", 2 }, /* PF0-PF5 */
598 { "mmc1", 2 }, /* PG0-PG5 */
599 { "mmc2", 3 }, /* PC1-PC16 */
Samuel Holland3de641b2021-08-28 15:52:52 -0500600 { "pwm", 2 }, /* PD22 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500601 { "spi0", 4 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500602#if IS_ENABLED(CONFIG_UART0_PORT_F)
603 { "uart0", 3 }, /* PF2-PF4 */
604#else
605 { "uart0", 4 }, /* PB8-PB9 */
606#endif
607 { "uart1", 2 }, /* PG6-PG7 */
608 { "uart2", 2 }, /* PB0-PB1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500609};
610
Samuel Hollande3095022021-08-12 20:09:43 -0500611static const struct sunxi_pinctrl_desc __maybe_unused sun50i_a64_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500612 .functions = sun50i_a64_pinctrl_functions,
613 .num_functions = ARRAY_SIZE(sun50i_a64_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500614 .first_bank = SUNXI_GPIO_A,
615 .num_banks = 8,
616};
617
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500618static const struct sunxi_pinctrl_function sun50i_a64_r_pinctrl_functions[] = {
619 { "gpio_in", 0 },
620 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500621 { "s_i2c", 2 }, /* PL8-PL9 */
Samuel Hollandd98ccb82022-11-17 22:22:27 -0600622 { "s_rsb", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500623 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500624};
625
Samuel Hollande3095022021-08-12 20:09:43 -0500626static const struct sunxi_pinctrl_desc __maybe_unused sun50i_a64_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500627 .functions = sun50i_a64_r_pinctrl_functions,
628 .num_functions = ARRAY_SIZE(sun50i_a64_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500629 .first_bank = SUNXI_GPIO_L,
630 .num_banks = 1,
631};
632
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500633static const struct sunxi_pinctrl_function sun50i_h5_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500634 { "emac", 2 }, /* PD0-PD17 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500635 { "gpio_in", 0 },
636 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500637 { "i2c0", 2 }, /* PA11-PA12 */
638 { "i2c1", 3 }, /* PA18-PA19 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500639 { "mmc0", 2 }, /* PF0-PF5 */
640 { "mmc1", 2 }, /* PG0-PG5 */
641 { "mmc2", 3 }, /* PC1-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500642 { "spi0", 3 }, /* PC0-PC3 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500643#if IS_ENABLED(CONFIG_UART0_PORT_F)
644 { "uart0", 3 }, /* PF2-PF4 */
645#else
646 { "uart0", 2 }, /* PA4-PA5 */
647#endif
648 { "uart1", 2 }, /* PG6-PG7 */
649 { "uart2", 2 }, /* PA0-PA1 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500650};
651
Samuel Hollande3095022021-08-12 20:09:43 -0500652static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h5_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500653 .functions = sun50i_h5_pinctrl_functions,
654 .num_functions = ARRAY_SIZE(sun50i_h5_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500655 .first_bank = SUNXI_GPIO_A,
656 .num_banks = 7,
657};
658
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500659static const struct sunxi_pinctrl_function sun50i_h6_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500660 { "emac", 5 }, /* PD0-PD20 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500661 { "gpio_in", 0 },
662 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500663 { "i2c0", 2 }, /* PD25-PD26 */
664 { "i2c1", 4 }, /* PH5-PH6 */
Samuel Holland1c17f412021-08-28 16:51:03 -0500665 { "mmc0", 2 }, /* PF0-PF5 */
666 { "mmc1", 2 }, /* PG0-PG5 */
667 { "mmc2", 3 }, /* PC1-PC14 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500668 { "spi0", 4 }, /* PC0-PC7 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500669#if IS_ENABLED(CONFIG_UART0_PORT_F)
670 { "uart0", 3 }, /* PF2-PF4 */
671#else
672 { "uart0", 2 }, /* PH0-PH1 */
673#endif
674 { "uart1", 2 }, /* PG6-PG7 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500675};
676
Samuel Hollande3095022021-08-12 20:09:43 -0500677static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h6_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500678 .functions = sun50i_h6_pinctrl_functions,
679 .num_functions = ARRAY_SIZE(sun50i_h6_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500680 .first_bank = SUNXI_GPIO_A,
681 .num_banks = 8,
682};
683
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500684static const struct sunxi_pinctrl_function sun50i_h6_r_pinctrl_functions[] = {
685 { "gpio_in", 0 },
686 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500687 { "s_i2c", 3 }, /* PL0-PL1 */
Samuel Hollandd98ccb82022-11-17 22:22:27 -0600688 { "s_rsb", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500689 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500690};
691
Samuel Hollande3095022021-08-12 20:09:43 -0500692static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h6_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500693 .functions = sun50i_h6_r_pinctrl_functions,
694 .num_functions = ARRAY_SIZE(sun50i_h6_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500695 .first_bank = SUNXI_GPIO_L,
696 .num_banks = 2,
697};
698
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500699static const struct sunxi_pinctrl_function sun50i_h616_pinctrl_functions[] = {
Samuel Hollanda8cbf472021-08-28 13:34:29 -0500700 { "emac0", 2 }, /* PI0-PI16 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500701 { "gpio_in", 0 },
702 { "gpio_out", 1 },
Samuel Holland1c17f412021-08-28 16:51:03 -0500703 { "mmc0", 2 }, /* PF0-PF5 */
704 { "mmc1", 2 }, /* PG0-PG5 */
705 { "mmc2", 3 }, /* PC0-PC16 */
Samuel Holland96b75d22021-08-28 17:05:35 -0500706 { "spi0", 4 }, /* PC0-PC7, PC15-PC16 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500707#if IS_ENABLED(CONFIG_UART0_PORT_F)
708 { "uart0", 3 }, /* PF2-PF4 */
709#else
710 { "uart0", 2 }, /* PH0-PH1 */
711#endif
712 { "uart1", 2 }, /* PG6-PG7 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500713};
714
Samuel Hollande3095022021-08-12 20:09:43 -0500715static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h616_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500716 .functions = sun50i_h616_pinctrl_functions,
717 .num_functions = ARRAY_SIZE(sun50i_h616_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500718 .first_bank = SUNXI_GPIO_A,
719 .num_banks = 9,
720};
721
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500722static const struct sunxi_pinctrl_function sun50i_h616_r_pinctrl_functions[] = {
723 { "gpio_in", 0 },
724 { "gpio_out", 1 },
Samuel Holland4b10d252021-08-28 15:17:32 -0500725 { "s_i2c", 3 }, /* PL0-PL1 */
Samuel Hollandd98ccb82022-11-17 22:22:27 -0600726 { "s_rsb", 2 }, /* PL0-PL1 */
Samuel Holland5a08d412021-08-28 13:00:45 -0500727 { "s_uart", 2 }, /* PL2-PL3 */
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500728};
729
Samuel Hollande3095022021-08-12 20:09:43 -0500730static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h616_r_pinctrl_desc = {
Samuel Hollandecbbedb2021-08-16 23:56:47 -0500731 .functions = sun50i_h616_r_pinctrl_functions,
732 .num_functions = ARRAY_SIZE(sun50i_h616_r_pinctrl_functions),
Samuel Hollande3095022021-08-12 20:09:43 -0500733 .first_bank = SUNXI_GPIO_L,
734 .num_banks = 1,
735};
736
737static const struct udevice_id sunxi_pinctrl_ids[] = {
738#ifdef CONFIG_PINCTRL_SUNIV_F1C100S
739 {
740 .compatible = "allwinner,suniv-f1c100s-pinctrl",
741 .data = (ulong)&suniv_f1c100s_pinctrl_desc,
742 },
743#endif
744#ifdef CONFIG_PINCTRL_SUN4I_A10
745 {
746 .compatible = "allwinner,sun4i-a10-pinctrl",
747 .data = (ulong)&sun4i_a10_pinctrl_desc,
748 },
749#endif
750#ifdef CONFIG_PINCTRL_SUN5I_A13
751 {
752 .compatible = "allwinner,sun5i-a10s-pinctrl",
753 .data = (ulong)&sun5i_a13_pinctrl_desc,
754 },
755 {
756 .compatible = "allwinner,sun5i-a13-pinctrl",
757 .data = (ulong)&sun5i_a13_pinctrl_desc,
758 },
759#endif
760#ifdef CONFIG_PINCTRL_SUN6I_A31
761 {
762 .compatible = "allwinner,sun6i-a31-pinctrl",
763 .data = (ulong)&sun6i_a31_pinctrl_desc,
764 },
765 {
766 .compatible = "allwinner,sun6i-a31s-pinctrl",
767 .data = (ulong)&sun6i_a31_pinctrl_desc,
768 },
769#endif
770#ifdef CONFIG_PINCTRL_SUN6I_A31_R
771 {
772 .compatible = "allwinner,sun6i-a31-r-pinctrl",
773 .data = (ulong)&sun6i_a31_r_pinctrl_desc,
774 },
775#endif
776#ifdef CONFIG_PINCTRL_SUN7I_A20
777 {
778 .compatible = "allwinner,sun7i-a20-pinctrl",
779 .data = (ulong)&sun7i_a20_pinctrl_desc,
780 },
781#endif
782#ifdef CONFIG_PINCTRL_SUN8I_A23
783 {
784 .compatible = "allwinner,sun8i-a23-pinctrl",
785 .data = (ulong)&sun8i_a23_pinctrl_desc,
786 },
787#endif
788#ifdef CONFIG_PINCTRL_SUN8I_A23_R
789 {
790 .compatible = "allwinner,sun8i-a23-r-pinctrl",
791 .data = (ulong)&sun8i_a23_r_pinctrl_desc,
792 },
793#endif
794#ifdef CONFIG_PINCTRL_SUN8I_A33
795 {
796 .compatible = "allwinner,sun8i-a33-pinctrl",
797 .data = (ulong)&sun8i_a33_pinctrl_desc,
798 },
799#endif
800#ifdef CONFIG_PINCTRL_SUN8I_A83T
801 {
802 .compatible = "allwinner,sun8i-a83t-pinctrl",
803 .data = (ulong)&sun8i_a83t_pinctrl_desc,
804 },
805#endif
806#ifdef CONFIG_PINCTRL_SUN8I_A83T_R
807 {
808 .compatible = "allwinner,sun8i-a83t-r-pinctrl",
809 .data = (ulong)&sun8i_a83t_r_pinctrl_desc,
810 },
811#endif
812#ifdef CONFIG_PINCTRL_SUN8I_H3
813 {
814 .compatible = "allwinner,sun8i-h3-pinctrl",
815 .data = (ulong)&sun8i_h3_pinctrl_desc,
816 },
817#endif
818#ifdef CONFIG_PINCTRL_SUN8I_H3_R
819 {
820 .compatible = "allwinner,sun8i-h3-r-pinctrl",
821 .data = (ulong)&sun8i_h3_r_pinctrl_desc,
822 },
823#endif
824#ifdef CONFIG_PINCTRL_SUN7I_A20
825 {
826 .compatible = "allwinner,sun8i-r40-pinctrl",
827 .data = (ulong)&sun7i_a20_pinctrl_desc,
828 },
829#endif
830#ifdef CONFIG_PINCTRL_SUN8I_V3S
831 {
832 .compatible = "allwinner,sun8i-v3-pinctrl",
833 .data = (ulong)&sun8i_v3s_pinctrl_desc,
834 },
835 {
836 .compatible = "allwinner,sun8i-v3s-pinctrl",
837 .data = (ulong)&sun8i_v3s_pinctrl_desc,
838 },
839#endif
840#ifdef CONFIG_PINCTRL_SUN9I_A80
841 {
842 .compatible = "allwinner,sun9i-a80-pinctrl",
843 .data = (ulong)&sun9i_a80_pinctrl_desc,
844 },
845#endif
846#ifdef CONFIG_PINCTRL_SUN9I_A80_R
847 {
848 .compatible = "allwinner,sun9i-a80-r-pinctrl",
849 .data = (ulong)&sun9i_a80_r_pinctrl_desc,
850 },
851#endif
852#ifdef CONFIG_PINCTRL_SUN50I_A64
853 {
854 .compatible = "allwinner,sun50i-a64-pinctrl",
855 .data = (ulong)&sun50i_a64_pinctrl_desc,
856 },
857#endif
858#ifdef CONFIG_PINCTRL_SUN50I_A64_R
859 {
860 .compatible = "allwinner,sun50i-a64-r-pinctrl",
861 .data = (ulong)&sun50i_a64_r_pinctrl_desc,
862 },
863#endif
864#ifdef CONFIG_PINCTRL_SUN50I_H5
865 {
866 .compatible = "allwinner,sun50i-h5-pinctrl",
867 .data = (ulong)&sun50i_h5_pinctrl_desc,
868 },
869#endif
870#ifdef CONFIG_PINCTRL_SUN50I_H6
871 {
872 .compatible = "allwinner,sun50i-h6-pinctrl",
873 .data = (ulong)&sun50i_h6_pinctrl_desc,
874 },
875#endif
876#ifdef CONFIG_PINCTRL_SUN50I_H6_R
877 {
878 .compatible = "allwinner,sun50i-h6-r-pinctrl",
879 .data = (ulong)&sun50i_h6_r_pinctrl_desc,
880 },
881#endif
882#ifdef CONFIG_PINCTRL_SUN50I_H616
883 {
884 .compatible = "allwinner,sun50i-h616-pinctrl",
885 .data = (ulong)&sun50i_h616_pinctrl_desc,
886 },
887#endif
888#ifdef CONFIG_PINCTRL_SUN50I_H616_R
889 {
890 .compatible = "allwinner,sun50i-h616-r-pinctrl",
891 .data = (ulong)&sun50i_h616_r_pinctrl_desc,
892 },
893#endif
894 {}
895};
896
897U_BOOT_DRIVER(sunxi_pinctrl) = {
898 .name = "sunxi-pinctrl",
899 .id = UCLASS_PINCTRL,
900 .of_match = sunxi_pinctrl_ids,
901 .bind = sunxi_pinctrl_bind,
902 .probe = sunxi_pinctrl_probe,
903 .plat_auto = sizeof(struct sunxi_pinctrl_plat),
904 .ops = &sunxi_pinctrl_ops,
905};