Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 1 | // 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 | |
| 13 | extern U_BOOT_DRIVER(gpio_sunxi); |
| 14 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 15 | /* |
| 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 | */ |
| 25 | struct sunxi_pinctrl_function { |
| 26 | const char name[sizeof("gpio_out")]; |
| 27 | u8 mux; |
| 28 | }; |
| 29 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 30 | struct sunxi_pinctrl_desc { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 31 | const struct sunxi_pinctrl_function *functions; |
| 32 | u8 num_functions; |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 33 | u8 first_bank; |
| 34 | u8 num_banks; |
| 35 | }; |
| 36 | |
| 37 | struct sunxi_pinctrl_plat { |
| 38 | struct sunxi_gpio __iomem *base; |
| 39 | }; |
| 40 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 41 | static 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 | |
| 48 | static 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 | |
| 61 | static 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 | |
| 68 | static 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 | |
| 76 | static 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 Holland | 50c195e | 2021-08-28 21:10:47 -0500 | [diff] [blame] | 95 | static 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 | |
| 102 | static 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 | |
| 112 | static 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 | |
| 126 | static 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 Holland | d4b3882 | 2021-08-17 00:52:00 -0500 | [diff] [blame] | 145 | static 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 Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 171 | static const struct pinctrl_ops sunxi_pinctrl_ops = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 172 | .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 Holland | 50c195e | 2021-08-28 21:10:47 -0500 | [diff] [blame] | 177 | .pinconf_num_params = ARRAY_SIZE(sunxi_pinctrl_pinconf_params), |
| 178 | .pinconf_params = sunxi_pinctrl_pinconf_params, |
| 179 | .pinconf_set = sunxi_pinctrl_pinconf_set, |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 180 | .set_state = pinctrl_generic_set_state, |
Samuel Holland | d4b3882 | 2021-08-17 00:52:00 -0500 | [diff] [blame] | 181 | .get_pin_muxing = sunxi_pinctrl_get_pin_muxing, |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 182 | }; |
| 183 | |
| 184 | static 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 | |
| 224 | static 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 Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 235 | static const struct sunxi_pinctrl_function suniv_f1c100s_pinctrl_functions[] = { |
| 236 | { "gpio_in", 0 }, |
| 237 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 238 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 239 | { "uart0", 3 }, /* PF2-PF4 */ |
| 240 | #else |
| 241 | { "uart0", 5 }, /* PE0-PE1 */ |
| 242 | #endif |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 243 | }; |
| 244 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 245 | static const struct sunxi_pinctrl_desc __maybe_unused suniv_f1c100s_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 246 | .functions = suniv_f1c100s_pinctrl_functions, |
| 247 | .num_functions = ARRAY_SIZE(suniv_f1c100s_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 248 | .first_bank = SUNXI_GPIO_A, |
| 249 | .num_banks = 6, |
| 250 | }; |
| 251 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 252 | static const struct sunxi_pinctrl_function sun4i_a10_pinctrl_functions[] = { |
Samuel Holland | fcdbbd6 | 2021-08-28 13:21:36 -0500 | [diff] [blame] | 253 | { "emac", 2 }, /* PA0-PA17 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 254 | { "gpio_in", 0 }, |
| 255 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 256 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 257 | { "uart0", 4 }, /* PF2-PF4 */ |
| 258 | #else |
| 259 | { "uart0", 2 }, /* PB22-PB23 */ |
| 260 | #endif |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 261 | }; |
| 262 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 263 | static const struct sunxi_pinctrl_desc __maybe_unused sun4i_a10_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 264 | .functions = sun4i_a10_pinctrl_functions, |
| 265 | .num_functions = ARRAY_SIZE(sun4i_a10_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 266 | .first_bank = SUNXI_GPIO_A, |
| 267 | .num_banks = 9, |
| 268 | }; |
| 269 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 270 | static const struct sunxi_pinctrl_function sun5i_a13_pinctrl_functions[] = { |
Samuel Holland | fcdbbd6 | 2021-08-28 13:21:36 -0500 | [diff] [blame] | 271 | { "emac", 2 }, /* PA0-PA17 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 272 | { "gpio_in", 0 }, |
| 273 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 274 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 275 | { "uart0", 4 }, /* PF2-PF4 */ |
| 276 | #else |
| 277 | { "uart0", 2 }, /* PB19-PB20 */ |
| 278 | #endif |
| 279 | { "uart1", 4 }, /* PG3-PG4 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 280 | }; |
| 281 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 282 | static const struct sunxi_pinctrl_desc __maybe_unused sun5i_a13_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 283 | .functions = sun5i_a13_pinctrl_functions, |
| 284 | .num_functions = ARRAY_SIZE(sun5i_a13_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 285 | .first_bank = SUNXI_GPIO_A, |
| 286 | .num_banks = 7, |
| 287 | }; |
| 288 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 289 | static const struct sunxi_pinctrl_function sun6i_a31_pinctrl_functions[] = { |
Samuel Holland | 7a93644 | 2021-08-28 13:13:52 -0500 | [diff] [blame] | 290 | { "gmac", 2 }, /* PA0-PA27 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 291 | { "gpio_in", 0 }, |
| 292 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 293 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 294 | { "uart0", 3 }, /* PF2-PF4 */ |
| 295 | #else |
| 296 | { "uart0", 2 }, /* PH20-PH21 */ |
| 297 | #endif |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 298 | }; |
| 299 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 300 | static const struct sunxi_pinctrl_desc __maybe_unused sun6i_a31_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 301 | .functions = sun6i_a31_pinctrl_functions, |
| 302 | .num_functions = ARRAY_SIZE(sun6i_a31_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 303 | .first_bank = SUNXI_GPIO_A, |
| 304 | .num_banks = 8, |
| 305 | }; |
| 306 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 307 | static const struct sunxi_pinctrl_function sun6i_a31_r_pinctrl_functions[] = { |
| 308 | { "gpio_in", 0 }, |
| 309 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 310 | { "s_uart", 2 }, /* PL2-PL3 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 311 | }; |
| 312 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 313 | static const struct sunxi_pinctrl_desc __maybe_unused sun6i_a31_r_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 314 | .functions = sun6i_a31_r_pinctrl_functions, |
| 315 | .num_functions = ARRAY_SIZE(sun6i_a31_r_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 316 | .first_bank = SUNXI_GPIO_L, |
| 317 | .num_banks = 2, |
| 318 | }; |
| 319 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 320 | static const struct sunxi_pinctrl_function sun7i_a20_pinctrl_functions[] = { |
Samuel Holland | fcdbbd6 | 2021-08-28 13:21:36 -0500 | [diff] [blame] | 321 | { "emac", 2 }, /* PA0-PA17 */ |
Samuel Holland | 7a93644 | 2021-08-28 13:13:52 -0500 | [diff] [blame] | 322 | { "gmac", 5 }, /* PA0-PA17 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 323 | { "gpio_in", 0 }, |
| 324 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 325 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 326 | { "uart0", 4 }, /* PF2-PF4 */ |
| 327 | #else |
| 328 | { "uart0", 2 }, /* PB22-PB23 */ |
| 329 | #endif |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 330 | }; |
| 331 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 332 | static const struct sunxi_pinctrl_desc __maybe_unused sun7i_a20_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 333 | .functions = sun7i_a20_pinctrl_functions, |
| 334 | .num_functions = ARRAY_SIZE(sun7i_a20_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 335 | .first_bank = SUNXI_GPIO_A, |
| 336 | .num_banks = 9, |
| 337 | }; |
| 338 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 339 | static const struct sunxi_pinctrl_function sun8i_a23_pinctrl_functions[] = { |
| 340 | { "gpio_in", 0 }, |
| 341 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 342 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 343 | { "uart0", 3 }, /* PF2-PF4 */ |
| 344 | #endif |
| 345 | { "uart1", 2 }, /* PG6-PG7 */ |
| 346 | { "uart2", 2 }, /* PB0-PB1 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 347 | }; |
| 348 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 349 | static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a23_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 350 | .functions = sun8i_a23_pinctrl_functions, |
| 351 | .num_functions = ARRAY_SIZE(sun8i_a23_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 352 | .first_bank = SUNXI_GPIO_A, |
| 353 | .num_banks = 8, |
| 354 | }; |
| 355 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 356 | static const struct sunxi_pinctrl_function sun8i_a23_r_pinctrl_functions[] = { |
| 357 | { "gpio_in", 0 }, |
| 358 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 359 | { "s_uart", 2 }, /* PL2-PL3 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 360 | }; |
| 361 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 362 | static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a23_r_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 363 | .functions = sun8i_a23_r_pinctrl_functions, |
| 364 | .num_functions = ARRAY_SIZE(sun8i_a23_r_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 365 | .first_bank = SUNXI_GPIO_L, |
| 366 | .num_banks = 1, |
| 367 | }; |
| 368 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 369 | static const struct sunxi_pinctrl_function sun8i_a33_pinctrl_functions[] = { |
| 370 | { "gpio_in", 0 }, |
| 371 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 372 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 373 | { "uart0", 3 }, /* PF2-PF4 */ |
| 374 | #else |
| 375 | { "uart0", 3 }, /* PB0-PB1 */ |
| 376 | #endif |
| 377 | { "uart1", 2 }, /* PG6-PG7 */ |
| 378 | { "uart2", 2 }, /* PB0-PB1 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 379 | }; |
| 380 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 381 | static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a33_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 382 | .functions = sun8i_a33_pinctrl_functions, |
| 383 | .num_functions = ARRAY_SIZE(sun8i_a33_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 384 | .first_bank = SUNXI_GPIO_A, |
| 385 | .num_banks = 8, |
| 386 | }; |
| 387 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 388 | static const struct sunxi_pinctrl_function sun8i_a83t_pinctrl_functions[] = { |
Samuel Holland | 37b3de4 | 2021-08-28 13:34:29 -0500 | [diff] [blame] | 389 | { "gmac", 4 }, /* PD2-PD23 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 390 | { "gpio_in", 0 }, |
| 391 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 392 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 393 | { "uart0", 3 }, /* PF2-PF4 */ |
| 394 | #else |
| 395 | { "uart0", 2 }, /* PB9-PB10 */ |
| 396 | #endif |
| 397 | { "uart1", 2 }, /* PG6-PG7 */ |
| 398 | { "uart2", 2 }, /* PB0-PB1 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 399 | }; |
| 400 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 401 | static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a83t_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 402 | .functions = sun8i_a83t_pinctrl_functions, |
| 403 | .num_functions = ARRAY_SIZE(sun8i_a83t_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 404 | .first_bank = SUNXI_GPIO_A, |
| 405 | .num_banks = 8, |
| 406 | }; |
| 407 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 408 | static const struct sunxi_pinctrl_function sun8i_a83t_r_pinctrl_functions[] = { |
| 409 | { "gpio_in", 0 }, |
| 410 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 411 | { "s_uart", 2 }, /* PL2-PL3 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 412 | }; |
| 413 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 414 | static const struct sunxi_pinctrl_desc __maybe_unused sun8i_a83t_r_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 415 | .functions = sun8i_a83t_r_pinctrl_functions, |
| 416 | .num_functions = ARRAY_SIZE(sun8i_a83t_r_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 417 | .first_bank = SUNXI_GPIO_L, |
| 418 | .num_banks = 1, |
| 419 | }; |
| 420 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 421 | static const struct sunxi_pinctrl_function sun8i_h3_pinctrl_functions[] = { |
Samuel Holland | 37b3de4 | 2021-08-28 13:34:29 -0500 | [diff] [blame] | 422 | { "emac", 2 }, /* PD0-PD17 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 423 | { "gpio_in", 0 }, |
| 424 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 425 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 426 | { "uart0", 3 }, /* PF2-PF4 */ |
| 427 | #else |
| 428 | { "uart0", 2 }, /* PA4-PA5 */ |
| 429 | #endif |
| 430 | { "uart1", 2 }, /* PG6-PG7 */ |
| 431 | { "uart2", 2 }, /* PA0-PA1 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 432 | }; |
| 433 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 434 | static const struct sunxi_pinctrl_desc __maybe_unused sun8i_h3_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 435 | .functions = sun8i_h3_pinctrl_functions, |
| 436 | .num_functions = ARRAY_SIZE(sun8i_h3_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 437 | .first_bank = SUNXI_GPIO_A, |
| 438 | .num_banks = 7, |
| 439 | }; |
| 440 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 441 | static const struct sunxi_pinctrl_function sun8i_h3_r_pinctrl_functions[] = { |
| 442 | { "gpio_in", 0 }, |
| 443 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 444 | { "s_uart", 2 }, /* PL2-PL3 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 445 | }; |
| 446 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 447 | static const struct sunxi_pinctrl_desc __maybe_unused sun8i_h3_r_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 448 | .functions = sun8i_h3_r_pinctrl_functions, |
| 449 | .num_functions = ARRAY_SIZE(sun8i_h3_r_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 450 | .first_bank = SUNXI_GPIO_L, |
| 451 | .num_banks = 1, |
| 452 | }; |
| 453 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 454 | static const struct sunxi_pinctrl_function sun8i_v3s_pinctrl_functions[] = { |
Samuel Holland | 37b3de4 | 2021-08-28 13:34:29 -0500 | [diff] [blame] | 455 | { "emac", 4 }, /* PD0-PD17 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 456 | { "gpio_in", 0 }, |
| 457 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 458 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 459 | { "uart0", 3 }, /* PF2-PF4 */ |
| 460 | #else |
| 461 | { "uart0", 3 }, /* PB8-PB9 */ |
| 462 | #endif |
| 463 | { "uart1", 2 }, /* PG6-PG7 */ |
| 464 | { "uart2", 2 }, /* PB0-PB1 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 465 | }; |
| 466 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 467 | static const struct sunxi_pinctrl_desc __maybe_unused sun8i_v3s_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 468 | .functions = sun8i_v3s_pinctrl_functions, |
| 469 | .num_functions = ARRAY_SIZE(sun8i_v3s_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 470 | .first_bank = SUNXI_GPIO_A, |
| 471 | .num_banks = 7, |
| 472 | }; |
| 473 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 474 | static const struct sunxi_pinctrl_function sun9i_a80_pinctrl_functions[] = { |
Samuel Holland | 7a93644 | 2021-08-28 13:13:52 -0500 | [diff] [blame] | 475 | { "gmac", 2 }, /* PA0-PA17 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 476 | { "gpio_in", 0 }, |
| 477 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 478 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 479 | { "uart0", 4 }, /* PF2-PF4 */ |
| 480 | #else |
| 481 | { "uart0", 2 }, /* PH12-PH13 */ |
| 482 | #endif |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 483 | }; |
| 484 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 485 | static const struct sunxi_pinctrl_desc __maybe_unused sun9i_a80_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 486 | .functions = sun9i_a80_pinctrl_functions, |
| 487 | .num_functions = ARRAY_SIZE(sun9i_a80_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 488 | .first_bank = SUNXI_GPIO_A, |
| 489 | .num_banks = 8, |
| 490 | }; |
| 491 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 492 | static const struct sunxi_pinctrl_function sun9i_a80_r_pinctrl_functions[] = { |
| 493 | { "gpio_in", 0 }, |
| 494 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 495 | { "s_uart", 3 }, /* PL0-PL1 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 496 | }; |
| 497 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 498 | static const struct sunxi_pinctrl_desc __maybe_unused sun9i_a80_r_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 499 | .functions = sun9i_a80_r_pinctrl_functions, |
| 500 | .num_functions = ARRAY_SIZE(sun9i_a80_r_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 501 | .first_bank = SUNXI_GPIO_L, |
| 502 | .num_banks = 3, |
| 503 | }; |
| 504 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 505 | static const struct sunxi_pinctrl_function sun50i_a64_pinctrl_functions[] = { |
Samuel Holland | 37b3de4 | 2021-08-28 13:34:29 -0500 | [diff] [blame] | 506 | { "emac", 4 }, /* PD8-PD23 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 507 | { "gpio_in", 0 }, |
| 508 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 509 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 510 | { "uart0", 3 }, /* PF2-PF4 */ |
| 511 | #else |
| 512 | { "uart0", 4 }, /* PB8-PB9 */ |
| 513 | #endif |
| 514 | { "uart1", 2 }, /* PG6-PG7 */ |
| 515 | { "uart2", 2 }, /* PB0-PB1 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 516 | }; |
| 517 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 518 | static const struct sunxi_pinctrl_desc __maybe_unused sun50i_a64_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 519 | .functions = sun50i_a64_pinctrl_functions, |
| 520 | .num_functions = ARRAY_SIZE(sun50i_a64_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 521 | .first_bank = SUNXI_GPIO_A, |
| 522 | .num_banks = 8, |
| 523 | }; |
| 524 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 525 | static const struct sunxi_pinctrl_function sun50i_a64_r_pinctrl_functions[] = { |
| 526 | { "gpio_in", 0 }, |
| 527 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 528 | { "s_uart", 2 }, /* PL2-PL3 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 529 | }; |
| 530 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 531 | static const struct sunxi_pinctrl_desc __maybe_unused sun50i_a64_r_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 532 | .functions = sun50i_a64_r_pinctrl_functions, |
| 533 | .num_functions = ARRAY_SIZE(sun50i_a64_r_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 534 | .first_bank = SUNXI_GPIO_L, |
| 535 | .num_banks = 1, |
| 536 | }; |
| 537 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 538 | static const struct sunxi_pinctrl_function sun50i_h5_pinctrl_functions[] = { |
Samuel Holland | 37b3de4 | 2021-08-28 13:34:29 -0500 | [diff] [blame] | 539 | { "emac", 2 }, /* PD0-PD17 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 540 | { "gpio_in", 0 }, |
| 541 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 542 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 543 | { "uart0", 3 }, /* PF2-PF4 */ |
| 544 | #else |
| 545 | { "uart0", 2 }, /* PA4-PA5 */ |
| 546 | #endif |
| 547 | { "uart1", 2 }, /* PG6-PG7 */ |
| 548 | { "uart2", 2 }, /* PA0-PA1 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 549 | }; |
| 550 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 551 | static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h5_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 552 | .functions = sun50i_h5_pinctrl_functions, |
| 553 | .num_functions = ARRAY_SIZE(sun50i_h5_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 554 | .first_bank = SUNXI_GPIO_A, |
| 555 | .num_banks = 7, |
| 556 | }; |
| 557 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 558 | static const struct sunxi_pinctrl_function sun50i_h6_pinctrl_functions[] = { |
Samuel Holland | 37b3de4 | 2021-08-28 13:34:29 -0500 | [diff] [blame] | 559 | { "emac", 5 }, /* PD0-PD20 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 560 | { "gpio_in", 0 }, |
| 561 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 562 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 563 | { "uart0", 3 }, /* PF2-PF4 */ |
| 564 | #else |
| 565 | { "uart0", 2 }, /* PH0-PH1 */ |
| 566 | #endif |
| 567 | { "uart1", 2 }, /* PG6-PG7 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 568 | }; |
| 569 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 570 | static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h6_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 571 | .functions = sun50i_h6_pinctrl_functions, |
| 572 | .num_functions = ARRAY_SIZE(sun50i_h6_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 573 | .first_bank = SUNXI_GPIO_A, |
| 574 | .num_banks = 8, |
| 575 | }; |
| 576 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 577 | static const struct sunxi_pinctrl_function sun50i_h6_r_pinctrl_functions[] = { |
| 578 | { "gpio_in", 0 }, |
| 579 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 580 | { "s_uart", 2 }, /* PL2-PL3 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 581 | }; |
| 582 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 583 | static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h6_r_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 584 | .functions = sun50i_h6_r_pinctrl_functions, |
| 585 | .num_functions = ARRAY_SIZE(sun50i_h6_r_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 586 | .first_bank = SUNXI_GPIO_L, |
| 587 | .num_banks = 2, |
| 588 | }; |
| 589 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 590 | static const struct sunxi_pinctrl_function sun50i_h616_pinctrl_functions[] = { |
Samuel Holland | 37b3de4 | 2021-08-28 13:34:29 -0500 | [diff] [blame] | 591 | { "emac0", 2 }, /* PI0-PI16 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 592 | { "gpio_in", 0 }, |
| 593 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 594 | #if IS_ENABLED(CONFIG_UART0_PORT_F) |
| 595 | { "uart0", 3 }, /* PF2-PF4 */ |
| 596 | #else |
| 597 | { "uart0", 2 }, /* PH0-PH1 */ |
| 598 | #endif |
| 599 | { "uart1", 2 }, /* PG6-PG7 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 600 | }; |
| 601 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 602 | static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h616_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 603 | .functions = sun50i_h616_pinctrl_functions, |
| 604 | .num_functions = ARRAY_SIZE(sun50i_h616_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 605 | .first_bank = SUNXI_GPIO_A, |
| 606 | .num_banks = 9, |
| 607 | }; |
| 608 | |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 609 | static const struct sunxi_pinctrl_function sun50i_h616_r_pinctrl_functions[] = { |
| 610 | { "gpio_in", 0 }, |
| 611 | { "gpio_out", 1 }, |
Samuel Holland | 470a7bd | 2021-08-28 13:00:45 -0500 | [diff] [blame] | 612 | { "s_uart", 2 }, /* PL2-PL3 */ |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 613 | }; |
| 614 | |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 615 | static const struct sunxi_pinctrl_desc __maybe_unused sun50i_h616_r_pinctrl_desc = { |
Samuel Holland | 29babfd | 2021-08-16 23:56:47 -0500 | [diff] [blame] | 616 | .functions = sun50i_h616_r_pinctrl_functions, |
| 617 | .num_functions = ARRAY_SIZE(sun50i_h616_r_pinctrl_functions), |
Samuel Holland | b799eab | 2021-08-12 20:09:43 -0500 | [diff] [blame] | 618 | .first_bank = SUNXI_GPIO_L, |
| 619 | .num_banks = 1, |
| 620 | }; |
| 621 | |
| 622 | static const struct udevice_id sunxi_pinctrl_ids[] = { |
| 623 | #ifdef CONFIG_PINCTRL_SUNIV_F1C100S |
| 624 | { |
| 625 | .compatible = "allwinner,suniv-f1c100s-pinctrl", |
| 626 | .data = (ulong)&suniv_f1c100s_pinctrl_desc, |
| 627 | }, |
| 628 | #endif |
| 629 | #ifdef CONFIG_PINCTRL_SUN4I_A10 |
| 630 | { |
| 631 | .compatible = "allwinner,sun4i-a10-pinctrl", |
| 632 | .data = (ulong)&sun4i_a10_pinctrl_desc, |
| 633 | }, |
| 634 | #endif |
| 635 | #ifdef CONFIG_PINCTRL_SUN5I_A13 |
| 636 | { |
| 637 | .compatible = "allwinner,sun5i-a10s-pinctrl", |
| 638 | .data = (ulong)&sun5i_a13_pinctrl_desc, |
| 639 | }, |
| 640 | { |
| 641 | .compatible = "allwinner,sun5i-a13-pinctrl", |
| 642 | .data = (ulong)&sun5i_a13_pinctrl_desc, |
| 643 | }, |
| 644 | #endif |
| 645 | #ifdef CONFIG_PINCTRL_SUN6I_A31 |
| 646 | { |
| 647 | .compatible = "allwinner,sun6i-a31-pinctrl", |
| 648 | .data = (ulong)&sun6i_a31_pinctrl_desc, |
| 649 | }, |
| 650 | { |
| 651 | .compatible = "allwinner,sun6i-a31s-pinctrl", |
| 652 | .data = (ulong)&sun6i_a31_pinctrl_desc, |
| 653 | }, |
| 654 | #endif |
| 655 | #ifdef CONFIG_PINCTRL_SUN6I_A31_R |
| 656 | { |
| 657 | .compatible = "allwinner,sun6i-a31-r-pinctrl", |
| 658 | .data = (ulong)&sun6i_a31_r_pinctrl_desc, |
| 659 | }, |
| 660 | #endif |
| 661 | #ifdef CONFIG_PINCTRL_SUN7I_A20 |
| 662 | { |
| 663 | .compatible = "allwinner,sun7i-a20-pinctrl", |
| 664 | .data = (ulong)&sun7i_a20_pinctrl_desc, |
| 665 | }, |
| 666 | #endif |
| 667 | #ifdef CONFIG_PINCTRL_SUN8I_A23 |
| 668 | { |
| 669 | .compatible = "allwinner,sun8i-a23-pinctrl", |
| 670 | .data = (ulong)&sun8i_a23_pinctrl_desc, |
| 671 | }, |
| 672 | #endif |
| 673 | #ifdef CONFIG_PINCTRL_SUN8I_A23_R |
| 674 | { |
| 675 | .compatible = "allwinner,sun8i-a23-r-pinctrl", |
| 676 | .data = (ulong)&sun8i_a23_r_pinctrl_desc, |
| 677 | }, |
| 678 | #endif |
| 679 | #ifdef CONFIG_PINCTRL_SUN8I_A33 |
| 680 | { |
| 681 | .compatible = "allwinner,sun8i-a33-pinctrl", |
| 682 | .data = (ulong)&sun8i_a33_pinctrl_desc, |
| 683 | }, |
| 684 | #endif |
| 685 | #ifdef CONFIG_PINCTRL_SUN8I_A83T |
| 686 | { |
| 687 | .compatible = "allwinner,sun8i-a83t-pinctrl", |
| 688 | .data = (ulong)&sun8i_a83t_pinctrl_desc, |
| 689 | }, |
| 690 | #endif |
| 691 | #ifdef CONFIG_PINCTRL_SUN8I_A83T_R |
| 692 | { |
| 693 | .compatible = "allwinner,sun8i-a83t-r-pinctrl", |
| 694 | .data = (ulong)&sun8i_a83t_r_pinctrl_desc, |
| 695 | }, |
| 696 | #endif |
| 697 | #ifdef CONFIG_PINCTRL_SUN8I_H3 |
| 698 | { |
| 699 | .compatible = "allwinner,sun8i-h3-pinctrl", |
| 700 | .data = (ulong)&sun8i_h3_pinctrl_desc, |
| 701 | }, |
| 702 | #endif |
| 703 | #ifdef CONFIG_PINCTRL_SUN8I_H3_R |
| 704 | { |
| 705 | .compatible = "allwinner,sun8i-h3-r-pinctrl", |
| 706 | .data = (ulong)&sun8i_h3_r_pinctrl_desc, |
| 707 | }, |
| 708 | #endif |
| 709 | #ifdef CONFIG_PINCTRL_SUN7I_A20 |
| 710 | { |
| 711 | .compatible = "allwinner,sun8i-r40-pinctrl", |
| 712 | .data = (ulong)&sun7i_a20_pinctrl_desc, |
| 713 | }, |
| 714 | #endif |
| 715 | #ifdef CONFIG_PINCTRL_SUN8I_V3S |
| 716 | { |
| 717 | .compatible = "allwinner,sun8i-v3-pinctrl", |
| 718 | .data = (ulong)&sun8i_v3s_pinctrl_desc, |
| 719 | }, |
| 720 | { |
| 721 | .compatible = "allwinner,sun8i-v3s-pinctrl", |
| 722 | .data = (ulong)&sun8i_v3s_pinctrl_desc, |
| 723 | }, |
| 724 | #endif |
| 725 | #ifdef CONFIG_PINCTRL_SUN9I_A80 |
| 726 | { |
| 727 | .compatible = "allwinner,sun9i-a80-pinctrl", |
| 728 | .data = (ulong)&sun9i_a80_pinctrl_desc, |
| 729 | }, |
| 730 | #endif |
| 731 | #ifdef CONFIG_PINCTRL_SUN9I_A80_R |
| 732 | { |
| 733 | .compatible = "allwinner,sun9i-a80-r-pinctrl", |
| 734 | .data = (ulong)&sun9i_a80_r_pinctrl_desc, |
| 735 | }, |
| 736 | #endif |
| 737 | #ifdef CONFIG_PINCTRL_SUN50I_A64 |
| 738 | { |
| 739 | .compatible = "allwinner,sun50i-a64-pinctrl", |
| 740 | .data = (ulong)&sun50i_a64_pinctrl_desc, |
| 741 | }, |
| 742 | #endif |
| 743 | #ifdef CONFIG_PINCTRL_SUN50I_A64_R |
| 744 | { |
| 745 | .compatible = "allwinner,sun50i-a64-r-pinctrl", |
| 746 | .data = (ulong)&sun50i_a64_r_pinctrl_desc, |
| 747 | }, |
| 748 | #endif |
| 749 | #ifdef CONFIG_PINCTRL_SUN50I_H5 |
| 750 | { |
| 751 | .compatible = "allwinner,sun50i-h5-pinctrl", |
| 752 | .data = (ulong)&sun50i_h5_pinctrl_desc, |
| 753 | }, |
| 754 | #endif |
| 755 | #ifdef CONFIG_PINCTRL_SUN50I_H6 |
| 756 | { |
| 757 | .compatible = "allwinner,sun50i-h6-pinctrl", |
| 758 | .data = (ulong)&sun50i_h6_pinctrl_desc, |
| 759 | }, |
| 760 | #endif |
| 761 | #ifdef CONFIG_PINCTRL_SUN50I_H6_R |
| 762 | { |
| 763 | .compatible = "allwinner,sun50i-h6-r-pinctrl", |
| 764 | .data = (ulong)&sun50i_h6_r_pinctrl_desc, |
| 765 | }, |
| 766 | #endif |
| 767 | #ifdef CONFIG_PINCTRL_SUN50I_H616 |
| 768 | { |
| 769 | .compatible = "allwinner,sun50i-h616-pinctrl", |
| 770 | .data = (ulong)&sun50i_h616_pinctrl_desc, |
| 771 | }, |
| 772 | #endif |
| 773 | #ifdef CONFIG_PINCTRL_SUN50I_H616_R |
| 774 | { |
| 775 | .compatible = "allwinner,sun50i-h616-r-pinctrl", |
| 776 | .data = (ulong)&sun50i_h616_r_pinctrl_desc, |
| 777 | }, |
| 778 | #endif |
| 779 | {} |
| 780 | }; |
| 781 | |
| 782 | U_BOOT_DRIVER(sunxi_pinctrl) = { |
| 783 | .name = "sunxi-pinctrl", |
| 784 | .id = UCLASS_PINCTRL, |
| 785 | .of_match = sunxi_pinctrl_ids, |
| 786 | .bind = sunxi_pinctrl_bind, |
| 787 | .probe = sunxi_pinctrl_probe, |
| 788 | .plat_auto = sizeof(struct sunxi_pinctrl_plat), |
| 789 | .ops = &sunxi_pinctrl_ops, |
| 790 | }; |