Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: bcm: Add STB family pin controller driver

This driver provide pin muxing and configuration functionality
for BCM2712 SoC used by RPi5. According to [1] this chip is an
instance of the one used in Broadcom STB product line.

[1] https://lore.kernel.org/lkml/f6601f73-cb22-4ba3-88c5-241be8421fc3@broadcom.com/

Cc: Jonathan Bell <jonathan@raspberrypi.com>
Cc: Phil Elwell <phil@raspberrypi.com>
Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
Reviewed-by: Phil Elwell <phil@raspberrypi.com>
Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
[linusw: Enable also for ARCH_BCM2835]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Ivan T. Ivanov and committed by
Linus Walleij
657cbf9b 07333899

+1306
+12
drivers/pinctrl/bcm/Kconfig
··· 106 106 help 107 107 Say Y here to enable the Broadcom BCM63268 GPIO driver. 108 108 109 + config PINCTRL_BRCMSTB 110 + tristate "Broadcom STB product line pin controller driver" 111 + depends on OF && (ARCH_BCM2835 || ARCH_BRCMSTB || COMPILE_TEST) 112 + select PINMUX 113 + select PINCONF 114 + select GENERIC_PINCONF 115 + help 116 + Enable pin muxing and configuration functionality 117 + for Broadcom STB product line chipsets. 118 + 119 + source "drivers/pinctrl/bcm/Kconfig.stb" 120 + 109 121 config PINCTRL_IPROC_GPIO 110 122 bool "Broadcom iProc GPIO (with PINCONF) driver" 111 123 depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
+10
drivers/pinctrl/bcm/Kconfig.stb
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + if PINCTRL_BRCMSTB 3 + 4 + config PINCTRL_BCM2712 5 + tristate "BCM2712 SoC pin controller driver" 6 + help 7 + Driver for BCM2712 integrated pin controller, 8 + commonly found on Raspberry Pi 5. 9 + 10 + endif
+2
drivers/pinctrl/bcm/Makefile
··· 11 11 obj-$(CONFIG_PINCTRL_BCM6362) += pinctrl-bcm6362.o 12 12 obj-$(CONFIG_PINCTRL_BCM6368) += pinctrl-bcm6368.o 13 13 obj-$(CONFIG_PINCTRL_BCM63268) += pinctrl-bcm63268.o 14 + obj-$(CONFIG_PINCTRL_BRCMSTB) += pinctrl-brcmstb.o 15 + obj-$(CONFIG_PINCTRL_BCM2712) += pinctrl-brcmstb-bcm2712.o 14 16 obj-$(CONFIG_PINCTRL_IPROC_GPIO) += pinctrl-iproc-gpio.o 15 17 obj-$(CONFIG_PINCTRL_CYGNUS_MUX) += pinctrl-cygnus-mux.o 16 18 obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o
+747
drivers/pinctrl/bcm/pinctrl-brcmstb-bcm2712.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Driver for Broadcom brcmstb GPIO units (pinctrl only) 4 + * 5 + * Copyright (C) 2024-2025 Ivan T. Ivanov, Andrea della Porta 6 + * Copyright (C) 2021-3 Raspberry Pi Ltd. 7 + * Copyright (C) 2012 Chris Boot, Simon Arlott, Stephen Warren 8 + * 9 + * Based heavily on the BCM2835 GPIO & pinctrl driver, which was inspired by: 10 + * pinctrl-nomadik.c, please see original file for copyright information 11 + * pinctrl-tegra.c, please see original file for copyright information 12 + */ 13 + 14 + #include <linux/pinctrl/pinctrl.h> 15 + #include <linux/of.h> 16 + #include "pinctrl-brcmstb.h" 17 + 18 + #define BRCMSTB_FSEL_COUNT 8 19 + #define BRCMSTB_FSEL_MASK 0xf 20 + 21 + #define BRCMSTB_PIN(i, f1, f2, f3, f4, f5, f6, f7, f8) \ 22 + [i] = { \ 23 + .funcs = (u8[]) { \ 24 + func_##f1, \ 25 + func_##f2, \ 26 + func_##f3, \ 27 + func_##f4, \ 28 + func_##f5, \ 29 + func_##f6, \ 30 + func_##f7, \ 31 + func_##f8, \ 32 + }, \ 33 + .n_funcs = BRCMSTB_FSEL_COUNT, \ 34 + .func_mask = BRCMSTB_FSEL_MASK, \ 35 + } 36 + 37 + enum bcm2712_funcs { 38 + func_gpio, 39 + func_alt1, 40 + func_alt2, 41 + func_alt3, 42 + func_alt4, 43 + func_alt5, 44 + func_alt6, 45 + func_alt7, 46 + func_alt8, 47 + func_aon_cpu_standbyb, 48 + func_aon_fp_4sec_resetb, 49 + func_aon_gpclk, 50 + func_aon_pwm, 51 + func_arm_jtag, 52 + func_aud_fs_clk0, 53 + func_avs_pmu_bsc, 54 + func_bsc_m0, 55 + func_bsc_m1, 56 + func_bsc_m2, 57 + func_bsc_m3, 58 + func_clk_observe, 59 + func_ctl_hdmi_5v, 60 + func_enet0, 61 + func_enet0_mii, 62 + func_enet0_rgmii, 63 + func_ext_sc_clk, 64 + func_fl0, 65 + func_fl1, 66 + func_gpclk0, 67 + func_gpclk1, 68 + func_gpclk2, 69 + func_hdmi_tx0_auto_i2c, 70 + func_hdmi_tx0_bsc, 71 + func_hdmi_tx1_auto_i2c, 72 + func_hdmi_tx1_bsc, 73 + func_i2s_in, 74 + func_i2s_out, 75 + func_ir_in, 76 + func_mtsif, 77 + func_mtsif_alt, 78 + func_mtsif_alt1, 79 + func_pdm, 80 + func_pkt, 81 + func_pm_led_out, 82 + func_sc0, 83 + func_sd0, 84 + func_sd2, 85 + func_sd_card_a, 86 + func_sd_card_b, 87 + func_sd_card_c, 88 + func_sd_card_d, 89 + func_sd_card_e, 90 + func_sd_card_f, 91 + func_sd_card_g, 92 + func_spdif_out, 93 + func_spi_m, 94 + func_spi_s, 95 + func_sr_edm_sense, 96 + func_te0, 97 + func_te1, 98 + func_tsio, 99 + func_uart0, 100 + func_uart1, 101 + func_uart2, 102 + func_usb_pwr, 103 + func_usb_vbus, 104 + func_uui, 105 + func_vc_i2c0, 106 + func_vc_i2c3, 107 + func_vc_i2c4, 108 + func_vc_i2c5, 109 + func_vc_i2csl, 110 + func_vc_pcm, 111 + func_vc_pwm0, 112 + func_vc_pwm1, 113 + func_vc_spi0, 114 + func_vc_spi3, 115 + func_vc_spi4, 116 + func_vc_spi5, 117 + func_vc_uart0, 118 + func_vc_uart2, 119 + func_vc_uart3, 120 + func_vc_uart4, 121 + func__, 122 + func_count = func__ 123 + }; 124 + 125 + static const struct pin_regs bcm2712_c0_gpio_pin_regs[] = { 126 + GPIO_REGS(0, 0, 0, 7, 7), 127 + GPIO_REGS(1, 0, 1, 7, 8), 128 + GPIO_REGS(2, 0, 2, 7, 9), 129 + GPIO_REGS(3, 0, 3, 7, 10), 130 + GPIO_REGS(4, 0, 4, 7, 11), 131 + GPIO_REGS(5, 0, 5, 7, 12), 132 + GPIO_REGS(6, 0, 6, 7, 13), 133 + GPIO_REGS(7, 0, 7, 7, 14), 134 + GPIO_REGS(8, 1, 0, 8, 0), 135 + GPIO_REGS(9, 1, 1, 8, 1), 136 + GPIO_REGS(10, 1, 2, 8, 2), 137 + GPIO_REGS(11, 1, 3, 8, 3), 138 + GPIO_REGS(12, 1, 4, 8, 4), 139 + GPIO_REGS(13, 1, 5, 8, 5), 140 + GPIO_REGS(14, 1, 6, 8, 6), 141 + GPIO_REGS(15, 1, 7, 8, 7), 142 + GPIO_REGS(16, 2, 0, 8, 8), 143 + GPIO_REGS(17, 2, 1, 8, 9), 144 + GPIO_REGS(18, 2, 2, 8, 10), 145 + GPIO_REGS(19, 2, 3, 8, 11), 146 + GPIO_REGS(20, 2, 4, 8, 12), 147 + GPIO_REGS(21, 2, 5, 8, 13), 148 + GPIO_REGS(22, 2, 6, 8, 14), 149 + GPIO_REGS(23, 2, 7, 9, 0), 150 + GPIO_REGS(24, 3, 0, 9, 1), 151 + GPIO_REGS(25, 3, 1, 9, 2), 152 + GPIO_REGS(26, 3, 2, 9, 3), 153 + GPIO_REGS(27, 3, 3, 9, 4), 154 + GPIO_REGS(28, 3, 4, 9, 5), 155 + GPIO_REGS(29, 3, 5, 9, 6), 156 + GPIO_REGS(30, 3, 6, 9, 7), 157 + GPIO_REGS(31, 3, 7, 9, 8), 158 + GPIO_REGS(32, 4, 0, 9, 9), 159 + GPIO_REGS(33, 4, 1, 9, 10), 160 + GPIO_REGS(34, 4, 2, 9, 11), 161 + GPIO_REGS(35, 4, 3, 9, 12), 162 + GPIO_REGS(36, 4, 4, 9, 13), 163 + GPIO_REGS(37, 4, 5, 9, 14), 164 + GPIO_REGS(38, 4, 6, 10, 0), 165 + GPIO_REGS(39, 4, 7, 10, 1), 166 + GPIO_REGS(40, 5, 0, 10, 2), 167 + GPIO_REGS(41, 5, 1, 10, 3), 168 + GPIO_REGS(42, 5, 2, 10, 4), 169 + GPIO_REGS(43, 5, 3, 10, 5), 170 + GPIO_REGS(44, 5, 4, 10, 6), 171 + GPIO_REGS(45, 5, 5, 10, 7), 172 + GPIO_REGS(46, 5, 6, 10, 8), 173 + GPIO_REGS(47, 5, 7, 10, 9), 174 + GPIO_REGS(48, 6, 0, 10, 10), 175 + GPIO_REGS(49, 6, 1, 10, 11), 176 + GPIO_REGS(50, 6, 2, 10, 12), 177 + GPIO_REGS(51, 6, 3, 10, 13), 178 + GPIO_REGS(52, 6, 4, 10, 14), 179 + GPIO_REGS(53, 6, 5, 11, 0), 180 + EMMC_REGS(54, 11, 1), /* EMMC_CMD */ 181 + EMMC_REGS(55, 11, 2), /* EMMC_DS */ 182 + EMMC_REGS(56, 11, 3), /* EMMC_CLK */ 183 + EMMC_REGS(57, 11, 4), /* EMMC_DAT0 */ 184 + EMMC_REGS(58, 11, 5), /* EMMC_DAT1 */ 185 + EMMC_REGS(59, 11, 6), /* EMMC_DAT2 */ 186 + EMMC_REGS(60, 11, 7), /* EMMC_DAT3 */ 187 + EMMC_REGS(61, 11, 8), /* EMMC_DAT4 */ 188 + EMMC_REGS(62, 11, 9), /* EMMC_DAT5 */ 189 + EMMC_REGS(63, 11, 10), /* EMMC_DAT6 */ 190 + EMMC_REGS(64, 11, 11), /* EMMC_DAT7 */ 191 + }; 192 + 193 + static struct pin_regs bcm2712_c0_aon_gpio_pin_regs[] = { 194 + AON_GPIO_REGS(0, 3, 0, 6, 10), 195 + AON_GPIO_REGS(1, 3, 1, 6, 11), 196 + AON_GPIO_REGS(2, 3, 2, 6, 12), 197 + AON_GPIO_REGS(3, 3, 3, 6, 13), 198 + AON_GPIO_REGS(4, 3, 4, 6, 14), 199 + AON_GPIO_REGS(5, 3, 5, 7, 0), 200 + AON_GPIO_REGS(6, 3, 6, 7, 1), 201 + AON_GPIO_REGS(7, 3, 7, 7, 2), 202 + AON_GPIO_REGS(8, 4, 0, 7, 3), 203 + AON_GPIO_REGS(9, 4, 1, 7, 4), 204 + AON_GPIO_REGS(10, 4, 2, 7, 5), 205 + AON_GPIO_REGS(11, 4, 3, 7, 6), 206 + AON_GPIO_REGS(12, 4, 4, 7, 7), 207 + AON_GPIO_REGS(13, 4, 5, 7, 8), 208 + AON_GPIO_REGS(14, 4, 6, 7, 9), 209 + AON_GPIO_REGS(15, 4, 7, 7, 10), 210 + AON_GPIO_REGS(16, 5, 0, 7, 11), 211 + AON_SGPIO_REGS(0, 0, 0), 212 + AON_SGPIO_REGS(1, 0, 1), 213 + AON_SGPIO_REGS(2, 0, 2), 214 + AON_SGPIO_REGS(3, 0, 3), 215 + AON_SGPIO_REGS(4, 1, 0), 216 + AON_SGPIO_REGS(5, 2, 0), 217 + }; 218 + 219 + static const struct pinctrl_pin_desc bcm2712_c0_gpio_pins[] = { 220 + GPIO_PIN(0), 221 + GPIO_PIN(1), 222 + GPIO_PIN(2), 223 + GPIO_PIN(3), 224 + GPIO_PIN(4), 225 + GPIO_PIN(5), 226 + GPIO_PIN(6), 227 + GPIO_PIN(7), 228 + GPIO_PIN(8), 229 + GPIO_PIN(9), 230 + GPIO_PIN(10), 231 + GPIO_PIN(11), 232 + GPIO_PIN(12), 233 + GPIO_PIN(13), 234 + GPIO_PIN(14), 235 + GPIO_PIN(15), 236 + GPIO_PIN(16), 237 + GPIO_PIN(17), 238 + GPIO_PIN(18), 239 + GPIO_PIN(19), 240 + GPIO_PIN(20), 241 + GPIO_PIN(21), 242 + GPIO_PIN(22), 243 + GPIO_PIN(23), 244 + GPIO_PIN(24), 245 + GPIO_PIN(25), 246 + GPIO_PIN(26), 247 + GPIO_PIN(27), 248 + GPIO_PIN(28), 249 + GPIO_PIN(29), 250 + GPIO_PIN(30), 251 + GPIO_PIN(31), 252 + GPIO_PIN(32), 253 + GPIO_PIN(33), 254 + GPIO_PIN(34), 255 + GPIO_PIN(35), 256 + GPIO_PIN(36), 257 + GPIO_PIN(37), 258 + GPIO_PIN(38), 259 + GPIO_PIN(39), 260 + GPIO_PIN(40), 261 + GPIO_PIN(41), 262 + GPIO_PIN(42), 263 + GPIO_PIN(43), 264 + GPIO_PIN(44), 265 + GPIO_PIN(45), 266 + GPIO_PIN(46), 267 + GPIO_PIN(47), 268 + GPIO_PIN(48), 269 + GPIO_PIN(49), 270 + GPIO_PIN(50), 271 + GPIO_PIN(51), 272 + GPIO_PIN(52), 273 + GPIO_PIN(53), 274 + PINCTRL_PIN(54, "emmc_cmd"), 275 + PINCTRL_PIN(55, "emmc_ds"), 276 + PINCTRL_PIN(56, "emmc_clk"), 277 + PINCTRL_PIN(57, "emmc_dat0"), 278 + PINCTRL_PIN(58, "emmc_dat1"), 279 + PINCTRL_PIN(59, "emmc_dat2"), 280 + PINCTRL_PIN(60, "emmc_dat3"), 281 + PINCTRL_PIN(61, "emmc_dat4"), 282 + PINCTRL_PIN(62, "emmc_dat5"), 283 + PINCTRL_PIN(63, "emmc_dat6"), 284 + PINCTRL_PIN(64, "emmc_dat7"), 285 + }; 286 + 287 + static struct pinctrl_pin_desc bcm2712_c0_aon_gpio_pins[] = { 288 + AON_GPIO_PIN(0), AON_GPIO_PIN(1), AON_GPIO_PIN(2), AON_GPIO_PIN(3), 289 + AON_GPIO_PIN(4), AON_GPIO_PIN(5), AON_GPIO_PIN(6), AON_GPIO_PIN(7), 290 + AON_GPIO_PIN(8), AON_GPIO_PIN(9), AON_GPIO_PIN(10), AON_GPIO_PIN(11), 291 + AON_GPIO_PIN(12), AON_GPIO_PIN(13), AON_GPIO_PIN(14), AON_GPIO_PIN(15), 292 + AON_GPIO_PIN(16), AON_SGPIO_PIN(0), AON_SGPIO_PIN(1), AON_SGPIO_PIN(2), 293 + AON_SGPIO_PIN(3), AON_SGPIO_PIN(4), AON_SGPIO_PIN(5), 294 + }; 295 + 296 + static const struct pin_regs bcm2712_d0_gpio_pin_regs[] = { 297 + GPIO_REGS(1, 0, 0, 4, 5), 298 + GPIO_REGS(2, 0, 1, 4, 6), 299 + GPIO_REGS(3, 0, 2, 4, 7), 300 + GPIO_REGS(4, 0, 3, 4, 8), 301 + GPIO_REGS(10, 0, 4, 4, 9), 302 + GPIO_REGS(11, 0, 5, 4, 10), 303 + GPIO_REGS(12, 0, 6, 4, 11), 304 + GPIO_REGS(13, 0, 7, 4, 12), 305 + GPIO_REGS(14, 1, 0, 4, 13), 306 + GPIO_REGS(15, 1, 1, 4, 14), 307 + GPIO_REGS(18, 1, 2, 5, 0), 308 + GPIO_REGS(19, 1, 3, 5, 1), 309 + GPIO_REGS(20, 1, 4, 5, 2), 310 + GPIO_REGS(21, 1, 5, 5, 3), 311 + GPIO_REGS(22, 1, 6, 5, 4), 312 + GPIO_REGS(23, 1, 7, 5, 5), 313 + GPIO_REGS(24, 2, 0, 5, 6), 314 + GPIO_REGS(25, 2, 1, 5, 7), 315 + GPIO_REGS(26, 2, 2, 5, 8), 316 + GPIO_REGS(27, 2, 3, 5, 9), 317 + GPIO_REGS(28, 2, 4, 5, 10), 318 + GPIO_REGS(29, 2, 5, 5, 11), 319 + GPIO_REGS(30, 2, 6, 5, 12), 320 + GPIO_REGS(31, 2, 7, 5, 13), 321 + GPIO_REGS(32, 3, 0, 5, 14), 322 + GPIO_REGS(33, 3, 1, 6, 0), 323 + GPIO_REGS(34, 3, 2, 6, 1), 324 + GPIO_REGS(35, 3, 3, 6, 2), 325 + EMMC_REGS(36, 6, 3), /* EMMC_CMD */ 326 + EMMC_REGS(37, 6, 4), /* EMMC_DS */ 327 + EMMC_REGS(38, 6, 5), /* EMMC_CLK */ 328 + EMMC_REGS(39, 6, 6), /* EMMC_DAT0 */ 329 + EMMC_REGS(40, 6, 7), /* EMMC_DAT1 */ 330 + EMMC_REGS(41, 6, 8), /* EMMC_DAT2 */ 331 + EMMC_REGS(42, 6, 9), /* EMMC_DAT3 */ 332 + EMMC_REGS(43, 6, 10), /* EMMC_DAT4 */ 333 + EMMC_REGS(44, 6, 11), /* EMMC_DAT5 */ 334 + EMMC_REGS(45, 6, 12), /* EMMC_DAT6 */ 335 + EMMC_REGS(46, 6, 13), /* EMMC_DAT7 */ 336 + }; 337 + 338 + static struct pin_regs bcm2712_d0_aon_gpio_pin_regs[] = { 339 + AON_GPIO_REGS(0, 3, 0, 5, 9), 340 + AON_GPIO_REGS(1, 3, 1, 5, 10), 341 + AON_GPIO_REGS(2, 3, 2, 5, 11), 342 + AON_GPIO_REGS(3, 3, 3, 5, 12), 343 + AON_GPIO_REGS(4, 3, 4, 5, 13), 344 + AON_GPIO_REGS(5, 3, 5, 5, 14), 345 + AON_GPIO_REGS(6, 3, 6, 6, 0), 346 + AON_GPIO_REGS(8, 3, 7, 6, 1), 347 + AON_GPIO_REGS(9, 4, 0, 6, 2), 348 + AON_GPIO_REGS(12, 4, 1, 6, 3), 349 + AON_GPIO_REGS(13, 4, 2, 6, 4), 350 + AON_GPIO_REGS(14, 4, 3, 6, 5), 351 + AON_SGPIO_REGS(0, 0, 0), 352 + AON_SGPIO_REGS(1, 0, 1), 353 + AON_SGPIO_REGS(2, 0, 2), 354 + AON_SGPIO_REGS(3, 0, 3), 355 + AON_SGPIO_REGS(4, 1, 0), 356 + AON_SGPIO_REGS(5, 2, 0), 357 + }; 358 + 359 + static const struct pinctrl_pin_desc bcm2712_d0_gpio_pins[] = { 360 + GPIO_PIN(1), 361 + GPIO_PIN(2), 362 + GPIO_PIN(3), 363 + GPIO_PIN(4), 364 + GPIO_PIN(10), 365 + GPIO_PIN(11), 366 + GPIO_PIN(12), 367 + GPIO_PIN(13), 368 + GPIO_PIN(14), 369 + GPIO_PIN(15), 370 + GPIO_PIN(18), 371 + GPIO_PIN(19), 372 + GPIO_PIN(20), 373 + GPIO_PIN(21), 374 + GPIO_PIN(22), 375 + GPIO_PIN(23), 376 + GPIO_PIN(24), 377 + GPIO_PIN(25), 378 + GPIO_PIN(26), 379 + GPIO_PIN(27), 380 + GPIO_PIN(28), 381 + GPIO_PIN(29), 382 + GPIO_PIN(30), 383 + GPIO_PIN(31), 384 + GPIO_PIN(32), 385 + GPIO_PIN(33), 386 + GPIO_PIN(34), 387 + GPIO_PIN(35), 388 + PINCTRL_PIN(36, "emmc_cmd"), 389 + PINCTRL_PIN(37, "emmc_ds"), 390 + PINCTRL_PIN(38, "emmc_clk"), 391 + PINCTRL_PIN(39, "emmc_dat0"), 392 + PINCTRL_PIN(40, "emmc_dat1"), 393 + PINCTRL_PIN(41, "emmc_dat2"), 394 + PINCTRL_PIN(42, "emmc_dat3"), 395 + PINCTRL_PIN(43, "emmc_dat4"), 396 + PINCTRL_PIN(44, "emmc_dat5"), 397 + PINCTRL_PIN(45, "emmc_dat6"), 398 + PINCTRL_PIN(46, "emmc_dat7"), 399 + }; 400 + 401 + static struct pinctrl_pin_desc bcm2712_d0_aon_gpio_pins[] = { 402 + AON_GPIO_PIN(0), AON_GPIO_PIN(1), AON_GPIO_PIN(2), AON_GPIO_PIN(3), 403 + AON_GPIO_PIN(4), AON_GPIO_PIN(5), AON_GPIO_PIN(6), AON_GPIO_PIN(8), 404 + AON_GPIO_PIN(9), AON_GPIO_PIN(12), AON_GPIO_PIN(13), AON_GPIO_PIN(14), 405 + AON_SGPIO_PIN(0), AON_SGPIO_PIN(1), AON_SGPIO_PIN(2), 406 + AON_SGPIO_PIN(3), AON_SGPIO_PIN(4), AON_SGPIO_PIN(5), 407 + }; 408 + 409 + static const char * const bcm2712_func_names[] = { 410 + BRCMSTB_FUNC(gpio), 411 + BRCMSTB_FUNC(alt1), 412 + BRCMSTB_FUNC(alt2), 413 + BRCMSTB_FUNC(alt3), 414 + BRCMSTB_FUNC(alt4), 415 + BRCMSTB_FUNC(alt5), 416 + BRCMSTB_FUNC(alt6), 417 + BRCMSTB_FUNC(alt7), 418 + BRCMSTB_FUNC(alt8), 419 + BRCMSTB_FUNC(aon_cpu_standbyb), 420 + BRCMSTB_FUNC(aon_fp_4sec_resetb), 421 + BRCMSTB_FUNC(aon_gpclk), 422 + BRCMSTB_FUNC(aon_pwm), 423 + BRCMSTB_FUNC(arm_jtag), 424 + BRCMSTB_FUNC(aud_fs_clk0), 425 + BRCMSTB_FUNC(avs_pmu_bsc), 426 + BRCMSTB_FUNC(bsc_m0), 427 + BRCMSTB_FUNC(bsc_m1), 428 + BRCMSTB_FUNC(bsc_m2), 429 + BRCMSTB_FUNC(bsc_m3), 430 + BRCMSTB_FUNC(clk_observe), 431 + BRCMSTB_FUNC(ctl_hdmi_5v), 432 + BRCMSTB_FUNC(enet0), 433 + BRCMSTB_FUNC(enet0_mii), 434 + BRCMSTB_FUNC(enet0_rgmii), 435 + BRCMSTB_FUNC(ext_sc_clk), 436 + BRCMSTB_FUNC(fl0), 437 + BRCMSTB_FUNC(fl1), 438 + BRCMSTB_FUNC(gpclk0), 439 + BRCMSTB_FUNC(gpclk1), 440 + BRCMSTB_FUNC(gpclk2), 441 + BRCMSTB_FUNC(hdmi_tx0_auto_i2c), 442 + BRCMSTB_FUNC(hdmi_tx0_bsc), 443 + BRCMSTB_FUNC(hdmi_tx1_auto_i2c), 444 + BRCMSTB_FUNC(hdmi_tx1_bsc), 445 + BRCMSTB_FUNC(i2s_in), 446 + BRCMSTB_FUNC(i2s_out), 447 + BRCMSTB_FUNC(ir_in), 448 + BRCMSTB_FUNC(mtsif), 449 + BRCMSTB_FUNC(mtsif_alt), 450 + BRCMSTB_FUNC(mtsif_alt1), 451 + BRCMSTB_FUNC(pdm), 452 + BRCMSTB_FUNC(pkt), 453 + BRCMSTB_FUNC(pm_led_out), 454 + BRCMSTB_FUNC(sc0), 455 + BRCMSTB_FUNC(sd0), 456 + BRCMSTB_FUNC(sd2), 457 + BRCMSTB_FUNC(sd_card_a), 458 + BRCMSTB_FUNC(sd_card_b), 459 + BRCMSTB_FUNC(sd_card_c), 460 + BRCMSTB_FUNC(sd_card_d), 461 + BRCMSTB_FUNC(sd_card_e), 462 + BRCMSTB_FUNC(sd_card_f), 463 + BRCMSTB_FUNC(sd_card_g), 464 + BRCMSTB_FUNC(spdif_out), 465 + BRCMSTB_FUNC(spi_m), 466 + BRCMSTB_FUNC(spi_s), 467 + BRCMSTB_FUNC(sr_edm_sense), 468 + BRCMSTB_FUNC(te0), 469 + BRCMSTB_FUNC(te1), 470 + BRCMSTB_FUNC(tsio), 471 + BRCMSTB_FUNC(uart0), 472 + BRCMSTB_FUNC(uart1), 473 + BRCMSTB_FUNC(uart2), 474 + BRCMSTB_FUNC(usb_pwr), 475 + BRCMSTB_FUNC(usb_vbus), 476 + BRCMSTB_FUNC(uui), 477 + BRCMSTB_FUNC(vc_i2c0), 478 + BRCMSTB_FUNC(vc_i2c3), 479 + BRCMSTB_FUNC(vc_i2c4), 480 + BRCMSTB_FUNC(vc_i2c5), 481 + BRCMSTB_FUNC(vc_i2csl), 482 + BRCMSTB_FUNC(vc_pcm), 483 + BRCMSTB_FUNC(vc_pwm0), 484 + BRCMSTB_FUNC(vc_pwm1), 485 + BRCMSTB_FUNC(vc_spi0), 486 + BRCMSTB_FUNC(vc_spi3), 487 + BRCMSTB_FUNC(vc_spi4), 488 + BRCMSTB_FUNC(vc_spi5), 489 + BRCMSTB_FUNC(vc_uart0), 490 + BRCMSTB_FUNC(vc_uart2), 491 + BRCMSTB_FUNC(vc_uart3), 492 + BRCMSTB_FUNC(vc_uart4), 493 + }; 494 + 495 + static const struct brcmstb_pin_funcs bcm2712_c0_aon_gpio_pin_funcs[] = { 496 + BRCMSTB_PIN(0, ir_in, vc_spi0, vc_uart3, vc_i2c3, te0, vc_i2c0, _, _), 497 + BRCMSTB_PIN(1, vc_pwm0, vc_spi0, vc_uart3, vc_i2c3, te1, aon_pwm, vc_i2c0, vc_pwm1), 498 + BRCMSTB_PIN(2, vc_pwm0, vc_spi0, vc_uart3, ctl_hdmi_5v, fl0, aon_pwm, ir_in, vc_pwm1), 499 + BRCMSTB_PIN(3, ir_in, vc_spi0, vc_uart3, aon_fp_4sec_resetb, fl1, sd_card_g, aon_gpclk, _), 500 + BRCMSTB_PIN(4, gpclk0, vc_spi0, vc_i2csl, aon_gpclk, pm_led_out, aon_pwm, sd_card_g, vc_pwm0), 501 + BRCMSTB_PIN(5, gpclk1, ir_in, vc_i2csl, clk_observe, aon_pwm, sd_card_g, vc_pwm0, _), 502 + BRCMSTB_PIN(6, uart1, vc_uart4, gpclk2, ctl_hdmi_5v, vc_uart0, vc_spi3, _, _), 503 + BRCMSTB_PIN(7, uart1, vc_uart4, gpclk0, aon_pwm, vc_uart0, vc_spi3, _, _), 504 + BRCMSTB_PIN(8, uart1, vc_uart4, vc_i2csl, ctl_hdmi_5v, vc_uart0, vc_spi3, _, _), 505 + BRCMSTB_PIN(9, uart1, vc_uart4, vc_i2csl, aon_pwm, vc_uart0, vc_spi3, _, _), 506 + BRCMSTB_PIN(10, tsio, ctl_hdmi_5v, sc0, spdif_out, vc_spi5, usb_pwr, aon_gpclk, sd_card_f), 507 + BRCMSTB_PIN(11, tsio, uart0, sc0, aud_fs_clk0, vc_spi5, usb_vbus, vc_uart2, sd_card_f), 508 + BRCMSTB_PIN(12, tsio, uart0, vc_uart0, tsio, vc_spi5, usb_pwr, vc_uart2, sd_card_f), 509 + BRCMSTB_PIN(13, bsc_m1, uart0, vc_uart0, uui, vc_spi5, arm_jtag, vc_uart2, vc_i2c3), 510 + BRCMSTB_PIN(14, bsc_m1, uart0, vc_uart0, uui, vc_spi5, arm_jtag, vc_uart2, vc_i2c3), 511 + BRCMSTB_PIN(15, ir_in, aon_fp_4sec_resetb, vc_uart0, pm_led_out, ctl_hdmi_5v, aon_pwm, aon_gpclk, _), 512 + BRCMSTB_PIN(16, aon_cpu_standbyb, gpclk0, pm_led_out, ctl_hdmi_5v, vc_pwm0, usb_pwr, aud_fs_clk0, _), 513 + }; 514 + 515 + static const struct brcmstb_pin_funcs bcm2712_c0_gpio_pin_funcs[] = { 516 + BRCMSTB_PIN(0, bsc_m3, vc_i2c0, gpclk0, enet0, vc_pwm1, vc_spi0, ir_in, _), 517 + BRCMSTB_PIN(1, bsc_m3, vc_i2c0, gpclk1, enet0, vc_pwm1, sr_edm_sense, vc_spi0, vc_uart3), 518 + BRCMSTB_PIN(2, pdm, i2s_in, gpclk2, vc_spi4, pkt, vc_spi0, vc_uart3, _), 519 + BRCMSTB_PIN(3, pdm, i2s_in, vc_spi4, pkt, vc_spi0, vc_uart3, _, _), 520 + BRCMSTB_PIN(4, pdm, i2s_in, arm_jtag, vc_spi4, pkt, vc_spi0, vc_uart3, _), 521 + BRCMSTB_PIN(5, pdm, vc_i2c3, arm_jtag, sd_card_e, vc_spi4, pkt, vc_pcm, vc_i2c5), 522 + BRCMSTB_PIN(6, pdm, vc_i2c3, arm_jtag, sd_card_e, vc_spi4, pkt, vc_pcm, vc_i2c5), 523 + BRCMSTB_PIN(7, i2s_out, spdif_out, arm_jtag, sd_card_e, vc_i2c3, enet0_rgmii, vc_pcm, vc_spi4), 524 + BRCMSTB_PIN(8, i2s_out, aud_fs_clk0, arm_jtag, sd_card_e, vc_i2c3, enet0_mii, vc_pcm, vc_spi4), 525 + BRCMSTB_PIN(9, i2s_out, aud_fs_clk0, arm_jtag, sd_card_e, enet0_mii, sd_card_c, vc_spi4, _), 526 + BRCMSTB_PIN(10, bsc_m3, mtsif_alt1, i2s_in, i2s_out, vc_spi5, enet0_mii, sd_card_c, vc_spi4), 527 + BRCMSTB_PIN(11, bsc_m3, mtsif_alt1, i2s_in, i2s_out, vc_spi5, enet0_mii, sd_card_c, vc_spi4), 528 + BRCMSTB_PIN(12, spi_s, mtsif_alt1, i2s_in, i2s_out, vc_spi5, vc_i2csl, sd0, sd_card_d), 529 + BRCMSTB_PIN(13, spi_s, mtsif_alt1, i2s_out, usb_vbus, vc_spi5, vc_i2csl, sd0, sd_card_d), 530 + BRCMSTB_PIN(14, spi_s, vc_i2csl, enet0_rgmii, arm_jtag, vc_spi5, vc_pwm0, vc_i2c4, sd_card_d), 531 + BRCMSTB_PIN(15, spi_s, vc_i2csl, vc_spi3, arm_jtag, vc_pwm0, vc_i2c4, gpclk0, _), 532 + BRCMSTB_PIN(16, sd_card_b, i2s_out, vc_spi3, i2s_in, sd0, enet0_rgmii, gpclk1, _), 533 + BRCMSTB_PIN(17, sd_card_b, i2s_out, vc_spi3, i2s_in, ext_sc_clk, sd0, enet0_rgmii, gpclk2), 534 + BRCMSTB_PIN(18, sd_card_b, i2s_out, vc_spi3, i2s_in, sd0, enet0_rgmii, vc_pwm1, _), 535 + BRCMSTB_PIN(19, sd_card_b, usb_pwr, vc_spi3, pkt, spdif_out, sd0, ir_in, vc_pwm1), 536 + BRCMSTB_PIN(20, sd_card_b, uui, vc_uart0, arm_jtag, uart2, usb_pwr, vc_pcm, vc_uart4), 537 + BRCMSTB_PIN(21, usb_pwr, uui, vc_uart0, arm_jtag, uart2, sd_card_b, vc_pcm, vc_uart4), 538 + BRCMSTB_PIN(22, usb_pwr, enet0, vc_uart0, mtsif, uart2, usb_vbus, vc_pcm, vc_i2c5), 539 + BRCMSTB_PIN(23, usb_vbus, enet0, vc_uart0, mtsif, uart2, i2s_out, vc_pcm, vc_i2c5), 540 + BRCMSTB_PIN(24, mtsif, pkt, uart0, enet0_rgmii, enet0_rgmii, vc_i2c4, vc_uart3, _), 541 + BRCMSTB_PIN(25, mtsif, pkt, sc0, uart0, enet0_rgmii, enet0_rgmii, vc_i2c4, vc_uart3), 542 + BRCMSTB_PIN(26, mtsif, pkt, sc0, uart0, enet0_rgmii, vc_uart4, vc_spi5, _), 543 + BRCMSTB_PIN(27, mtsif, pkt, sc0, uart0, enet0_rgmii, vc_uart4, vc_spi5, _), 544 + BRCMSTB_PIN(28, mtsif, pkt, sc0, enet0_rgmii, vc_uart4, vc_spi5, _, _), 545 + BRCMSTB_PIN(29, mtsif, pkt, sc0, enet0_rgmii, vc_uart4, vc_spi5, _, _), 546 + BRCMSTB_PIN(30, mtsif, pkt, sc0, sd2, enet0_rgmii, gpclk0, vc_pwm0, _), 547 + BRCMSTB_PIN(31, mtsif, pkt, sc0, sd2, enet0_rgmii, vc_spi3, vc_pwm0, _), 548 + BRCMSTB_PIN(32, mtsif, pkt, sc0, sd2, enet0_rgmii, vc_spi3, vc_uart3, _), 549 + BRCMSTB_PIN(33, mtsif, pkt, sd2, enet0_rgmii, vc_spi3, vc_uart3, _, _), 550 + BRCMSTB_PIN(34, mtsif, pkt, ext_sc_clk, sd2, enet0_rgmii, vc_spi3, vc_i2c5, _), 551 + BRCMSTB_PIN(35, mtsif, pkt, sd2, enet0_rgmii, vc_spi3, vc_i2c5, _, _), 552 + BRCMSTB_PIN(36, sd0, mtsif, sc0, i2s_in, vc_uart3, vc_uart2, _, _), 553 + BRCMSTB_PIN(37, sd0, mtsif, sc0, vc_spi0, i2s_in, vc_uart3, vc_uart2, _), 554 + BRCMSTB_PIN(38, sd0, mtsif_alt, sc0, vc_spi0, i2s_in, vc_uart3, vc_uart2, _), 555 + BRCMSTB_PIN(39, sd0, mtsif_alt, sc0, vc_spi0, vc_uart3, vc_uart2, _, _), 556 + BRCMSTB_PIN(40, sd0, mtsif_alt, sc0, vc_spi0, bsc_m3, _, _, _), 557 + BRCMSTB_PIN(41, sd0, mtsif_alt, sc0, vc_spi0, bsc_m3, _, _, _), 558 + BRCMSTB_PIN(42, vc_spi0, mtsif_alt, vc_i2c0, sd_card_a, mtsif_alt1, arm_jtag, pdm, spi_m), 559 + BRCMSTB_PIN(43, vc_spi0, mtsif_alt, vc_i2c0, sd_card_a, mtsif_alt1, arm_jtag, pdm, spi_m), 560 + BRCMSTB_PIN(44, vc_spi0, mtsif_alt, enet0, sd_card_a, mtsif_alt1, arm_jtag, pdm, spi_m), 561 + BRCMSTB_PIN(45, vc_spi0, mtsif_alt, enet0, sd_card_a, mtsif_alt1, arm_jtag, pdm, spi_m), 562 + BRCMSTB_PIN(46, vc_spi0, mtsif_alt, sd_card_a, mtsif_alt1, arm_jtag, pdm, spi_m, _), 563 + BRCMSTB_PIN(47, enet0, mtsif_alt, i2s_out, mtsif_alt1, arm_jtag, _, _, _), 564 + BRCMSTB_PIN(48, sc0, usb_pwr, spdif_out, mtsif, _, _, _, _), 565 + BRCMSTB_PIN(49, sc0, usb_pwr, aud_fs_clk0, mtsif, _, _, _, _), 566 + BRCMSTB_PIN(50, sc0, usb_vbus, sc0, _, _, _, _, _), 567 + BRCMSTB_PIN(51, sc0, enet0, sc0, sr_edm_sense, _, _, _, _), 568 + BRCMSTB_PIN(52, sc0, enet0, vc_pwm1, _, _, _, _, _), 569 + BRCMSTB_PIN(53, sc0, enet0_rgmii, ext_sc_clk, _, _, _, _, _), 570 + }; 571 + 572 + static const struct brcmstb_pin_funcs bcm2712_d0_aon_gpio_pin_funcs[] = { 573 + BRCMSTB_PIN(0, ir_in, vc_spi0, vc_uart0, vc_i2c3, uart0, vc_i2c0, _, _), 574 + BRCMSTB_PIN(1, vc_pwm0, vc_spi0, vc_uart0, vc_i2c3, uart0, aon_pwm, vc_i2c0, vc_pwm1), 575 + BRCMSTB_PIN(2, vc_pwm0, vc_spi0, vc_uart0, ctl_hdmi_5v, uart0, aon_pwm, ir_in, vc_pwm1), 576 + BRCMSTB_PIN(3, ir_in, vc_spi0, vc_uart0, uart0, sd_card_g, aon_gpclk, _, _), 577 + BRCMSTB_PIN(4, gpclk0, vc_spi0, pm_led_out, aon_pwm, sd_card_g, vc_pwm0, _, _), 578 + BRCMSTB_PIN(5, gpclk1, ir_in, aon_pwm, sd_card_g, vc_pwm0, _, _, _), 579 + BRCMSTB_PIN(6, uart1, vc_uart2, ctl_hdmi_5v, gpclk2, vc_spi3, _, _, _), 580 + BRCMSTB_PIN(7, _, _, _, _, _, _, _, _), /* non-existent on D0 silicon */ 581 + BRCMSTB_PIN(8, uart1, vc_uart2, ctl_hdmi_5v, vc_spi0, vc_spi3, _, _, _), 582 + BRCMSTB_PIN(9, uart1, vc_uart2, vc_uart0, aon_pwm, vc_spi0, vc_uart2, vc_spi3, _), 583 + BRCMSTB_PIN(10, _, _, _, _, _, _, _, _), /* non-existent on D0 silicon */ 584 + BRCMSTB_PIN(11, _, _, _, _, _, _, _, _), /* non-existent on D0 silicon */ 585 + BRCMSTB_PIN(12, uart1, vc_uart2, vc_uart0, vc_spi0, usb_pwr, vc_uart2, vc_spi3, _), 586 + BRCMSTB_PIN(13, bsc_m1, vc_uart0, uui, vc_spi0, arm_jtag, vc_uart2, vc_i2c3, _), 587 + BRCMSTB_PIN(14, bsc_m1, aon_gpclk, vc_uart0, uui, vc_spi0, arm_jtag, vc_uart2, vc_i2c3), 588 + }; 589 + 590 + static const struct brcmstb_pin_funcs bcm2712_d0_gpio_pin_funcs[] = { 591 + BRCMSTB_PIN(1, vc_i2c0, usb_pwr, gpclk0, sd_card_e, vc_spi3, sr_edm_sense, vc_spi0, vc_uart0), 592 + BRCMSTB_PIN(2, vc_i2c0, usb_pwr, gpclk1, sd_card_e, vc_spi3, clk_observe, vc_spi0, vc_uart0), 593 + BRCMSTB_PIN(3, vc_i2c3, usb_vbus, gpclk2, sd_card_e, vc_spi3, vc_spi0, vc_uart0, _), 594 + BRCMSTB_PIN(4, vc_i2c3, vc_pwm1, vc_spi3, sd_card_e, vc_spi3, vc_spi0, vc_uart0, _), 595 + BRCMSTB_PIN(10, bsc_m3, vc_pwm1, vc_spi3, sd_card_e, vc_spi3, gpclk0, _, _), 596 + BRCMSTB_PIN(11, bsc_m3, vc_spi3, clk_observe, sd_card_c, gpclk1, _, _, _), 597 + BRCMSTB_PIN(12, spi_s, vc_spi3, sd_card_c, sd_card_d, _, _, _, _), 598 + BRCMSTB_PIN(13, spi_s, vc_spi3, sd_card_c, sd_card_d, _, _, _, _), 599 + BRCMSTB_PIN(14, spi_s, uui, arm_jtag, vc_pwm0, vc_i2c0, sd_card_d, _, _), 600 + BRCMSTB_PIN(15, spi_s, uui, arm_jtag, vc_pwm0, vc_i2c0, gpclk0, _, _), 601 + BRCMSTB_PIN(18, sd_card_f, vc_pwm1, _, _, _, _, _, _), 602 + BRCMSTB_PIN(19, sd_card_f, usb_pwr, vc_pwm1, _, _, _, _, _), 603 + BRCMSTB_PIN(20, vc_i2c3, uui, vc_uart0, arm_jtag, vc_uart2, _, _, _), 604 + BRCMSTB_PIN(21, vc_i2c3, uui, vc_uart0, arm_jtag, vc_uart2, _, _, _), 605 + BRCMSTB_PIN(22, sd_card_f, vc_uart0, vc_i2c3, _, _, _, _, _), 606 + BRCMSTB_PIN(23, vc_uart0, vc_i2c3, _, _, _, _, _, _), 607 + BRCMSTB_PIN(24, sd_card_b, vc_spi0, arm_jtag, uart0, usb_pwr, vc_uart2, vc_uart0, _), 608 + BRCMSTB_PIN(25, sd_card_b, vc_spi0, arm_jtag, uart0, usb_pwr, vc_uart2, vc_uart0, _), 609 + BRCMSTB_PIN(26, sd_card_b, vc_spi0, arm_jtag, uart0, usb_vbus, vc_uart2, vc_spi0, _), 610 + BRCMSTB_PIN(27, sd_card_b, vc_spi0, arm_jtag, uart0, vc_uart2, vc_spi0, _, _), 611 + BRCMSTB_PIN(28, sd_card_b, vc_spi0, arm_jtag, vc_i2c0, vc_spi0, _, _, _), 612 + BRCMSTB_PIN(29, arm_jtag, vc_i2c0, vc_spi0, _, _, _, _, _), 613 + BRCMSTB_PIN(30, sd2, gpclk0, vc_pwm0, _, _, _, _, _), 614 + BRCMSTB_PIN(31, sd2, vc_spi3, vc_pwm0, _, _, _, _, _), 615 + BRCMSTB_PIN(32, sd2, vc_spi3, vc_uart3, _, _, _, _, _), 616 + BRCMSTB_PIN(33, sd2, vc_spi3, vc_uart3, _, _, _, _, _), 617 + BRCMSTB_PIN(34, sd2, vc_spi3, vc_i2c5, _, _, _, _, _), 618 + BRCMSTB_PIN(35, sd2, vc_spi3, vc_i2c5, _, _, _, _, _), 619 + }; 620 + 621 + static const struct pinctrl_desc bcm2712_c0_pinctrl_desc = { 622 + .name = "pinctrl-bcm2712", 623 + .pins = bcm2712_c0_gpio_pins, 624 + .npins = ARRAY_SIZE(bcm2712_c0_gpio_pins), 625 + }; 626 + 627 + static const struct pinctrl_desc bcm2712_c0_aon_pinctrl_desc = { 628 + .name = "aon-pinctrl-bcm2712", 629 + .pins = bcm2712_c0_aon_gpio_pins, 630 + .npins = ARRAY_SIZE(bcm2712_c0_aon_gpio_pins), 631 + }; 632 + 633 + static const struct pinctrl_desc bcm2712_d0_pinctrl_desc = { 634 + .name = "pinctrl-bcm2712", 635 + .pins = bcm2712_d0_gpio_pins, 636 + .npins = ARRAY_SIZE(bcm2712_d0_gpio_pins), 637 + }; 638 + 639 + static const struct pinctrl_desc bcm2712_d0_aon_pinctrl_desc = { 640 + .name = "aon-pinctrl-bcm2712", 641 + .pins = bcm2712_d0_aon_gpio_pins, 642 + .npins = ARRAY_SIZE(bcm2712_d0_aon_gpio_pins), 643 + }; 644 + 645 + static const struct pinctrl_gpio_range bcm2712_c0_pinctrl_gpio_range = { 646 + .name = "pinctrl-bcm2712", 647 + .npins = ARRAY_SIZE(bcm2712_c0_gpio_pins), 648 + }; 649 + 650 + static const struct pinctrl_gpio_range bcm2712_c0_aon_pinctrl_gpio_range = { 651 + .name = "aon-pinctrl-bcm2712", 652 + .npins = ARRAY_SIZE(bcm2712_c0_aon_gpio_pins), 653 + }; 654 + 655 + static const struct pinctrl_gpio_range bcm2712_d0_pinctrl_gpio_range = { 656 + .name = "pinctrl-bcm2712", 657 + .npins = ARRAY_SIZE(bcm2712_d0_gpio_pins), 658 + }; 659 + 660 + static const struct pinctrl_gpio_range bcm2712_d0_aon_pinctrl_gpio_range = { 661 + .name = "aon-pinctrl-bcm2712", 662 + .npins = ARRAY_SIZE(bcm2712_d0_aon_gpio_pins), 663 + }; 664 + 665 + static const struct brcmstb_pdata bcm2712_c0_pdata = { 666 + .pctl_desc = &bcm2712_c0_pinctrl_desc, 667 + .gpio_range = &bcm2712_c0_pinctrl_gpio_range, 668 + .pin_regs = bcm2712_c0_gpio_pin_regs, 669 + .pin_funcs = bcm2712_c0_gpio_pin_funcs, 670 + .func_count = func_count, 671 + .func_gpio = func_gpio, 672 + .func_names = bcm2712_func_names, 673 + }; 674 + 675 + static const struct brcmstb_pdata bcm2712_c0_aon_pdata = { 676 + .pctl_desc = &bcm2712_c0_aon_pinctrl_desc, 677 + .gpio_range = &bcm2712_c0_aon_pinctrl_gpio_range, 678 + .pin_regs = bcm2712_c0_aon_gpio_pin_regs, 679 + .pin_funcs = bcm2712_c0_aon_gpio_pin_funcs, 680 + .func_count = func_count, 681 + .func_gpio = func_gpio, 682 + .func_names = bcm2712_func_names, 683 + }; 684 + 685 + static const struct brcmstb_pdata bcm2712_d0_pdata = { 686 + .pctl_desc = &bcm2712_d0_pinctrl_desc, 687 + .gpio_range = &bcm2712_d0_pinctrl_gpio_range, 688 + .pin_regs = bcm2712_d0_gpio_pin_regs, 689 + .pin_funcs = bcm2712_d0_gpio_pin_funcs, 690 + .func_count = func_count, 691 + .func_gpio = func_gpio, 692 + .func_names = bcm2712_func_names, 693 + }; 694 + 695 + static const struct brcmstb_pdata bcm2712_d0_aon_pdata = { 696 + .pctl_desc = &bcm2712_d0_aon_pinctrl_desc, 697 + .gpio_range = &bcm2712_d0_aon_pinctrl_gpio_range, 698 + .pin_regs = bcm2712_d0_aon_gpio_pin_regs, 699 + .pin_funcs = bcm2712_d0_aon_gpio_pin_funcs, 700 + .func_count = func_count, 701 + .func_gpio = func_gpio, 702 + .func_names = bcm2712_func_names, 703 + }; 704 + 705 + static int bcm2712_pinctrl_probe(struct platform_device *pdev) 706 + { 707 + return brcmstb_pinctrl_probe(pdev); 708 + } 709 + 710 + static const struct of_device_id bcm2712_pinctrl_match[] = { 711 + { 712 + .compatible = "brcm,bcm2712c0-pinctrl", 713 + .data = &bcm2712_c0_pdata 714 + }, 715 + { 716 + .compatible = "brcm,bcm2712c0-aon-pinctrl", 717 + .data = &bcm2712_c0_aon_pdata 718 + }, 719 + 720 + { 721 + .compatible = "brcm,bcm2712d0-pinctrl", 722 + .data = &bcm2712_d0_pdata 723 + }, 724 + { 725 + .compatible = "brcm,bcm2712d0-aon-pinctrl", 726 + .data = &bcm2712_d0_aon_pdata 727 + }, 728 + { /* sentinel */ } 729 + }; 730 + MODULE_DEVICE_TABLE(of, bcm2712_pinctrl_match); 731 + 732 + static struct platform_driver bcm2712_pinctrl_driver = { 733 + .probe = bcm2712_pinctrl_probe, 734 + .driver = { 735 + .name = "pinctrl-bcm2712", 736 + .of_match_table = bcm2712_pinctrl_match, 737 + .suppress_bind_attrs = true, 738 + }, 739 + }; 740 + module_platform_driver(bcm2712_pinctrl_driver); 741 + 742 + MODULE_AUTHOR("Phil Elwell"); 743 + MODULE_AUTHOR("Jonathan Bell"); 744 + MODULE_AUTHOR("Ivan T. Ivanov"); 745 + MODULE_AUTHOR("Andrea della Porta"); 746 + MODULE_DESCRIPTION("Broadcom BCM2712 pinctrl driver"); 747 + MODULE_LICENSE("GPL");
+442
drivers/pinctrl/bcm/pinctrl-brcmstb.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Driver for Broadcom brcmstb GPIO units (pinctrl only) 4 + * 5 + * Copyright (C) 2024-2025 Ivan T. Ivanov, Andrea della Porta 6 + * Copyright (C) 2021-3 Raspberry Pi Ltd. 7 + * Copyright (C) 2012 Chris Boot, Simon Arlott, Stephen Warren 8 + * 9 + * Based heavily on the BCM2835 GPIO & pinctrl driver, which was inspired by: 10 + * pinctrl-nomadik.c, please see original file for copyright information 11 + * pinctrl-tegra.c, please see original file for copyright information 12 + */ 13 + 14 + #include <linux/device.h> 15 + #include <linux/err.h> 16 + #include <linux/init.h> 17 + #include <linux/io.h> 18 + #include <linux/of.h> 19 + #include <linux/pinctrl/pinconf.h> 20 + #include <linux/pinctrl/pinctrl.h> 21 + #include <linux/pinctrl/pinmux.h> 22 + #include <linux/pinctrl/pinconf-generic.h> 23 + #include <linux/seq_file.h> 24 + #include <linux/slab.h> 25 + #include <linux/spinlock.h> 26 + #include <linux/cleanup.h> 27 + 28 + #include "pinctrl-brcmstb.h" 29 + 30 + #define BRCMSTB_PULL_NONE 0 31 + #define BRCMSTB_PULL_DOWN 1 32 + #define BRCMSTB_PULL_UP 2 33 + #define BRCMSTB_PULL_MASK 0x3 34 + 35 + #define BIT_TO_REG(b) (((b) >> 5) << 2) 36 + #define BIT_TO_SHIFT(b) ((b) & 0x1f) 37 + 38 + struct brcmstb_pinctrl { 39 + struct device *dev; 40 + void __iomem *base; 41 + struct pinctrl_dev *pctl_dev; 42 + struct pinctrl_desc pctl_desc; 43 + const struct pin_regs *pin_regs; 44 + const struct brcmstb_pin_funcs *pin_funcs; 45 + const char * const *func_names; 46 + unsigned int func_count; 47 + unsigned int func_gpio; 48 + const char *const *gpio_groups; 49 + struct pinctrl_gpio_range gpio_range; 50 + /* Protect FSEL registers */ 51 + spinlock_t fsel_lock; 52 + }; 53 + 54 + static unsigned int brcmstb_pinctrl_fsel_get(struct brcmstb_pinctrl *pc, 55 + unsigned int pin) 56 + { 57 + u32 bit = pc->pin_regs[pin].mux_bit; 58 + unsigned int func; 59 + int fsel; 60 + u32 val; 61 + 62 + if (!bit) 63 + return pc->func_gpio; 64 + 65 + bit &= ~MUX_BIT_VALID; 66 + 67 + val = readl(pc->base + BIT_TO_REG(bit)); 68 + fsel = (val >> BIT_TO_SHIFT(bit)) & pc->pin_funcs[pin].func_mask; 69 + func = pc->pin_funcs[pin].funcs[fsel]; 70 + 71 + if (func >= pc->func_count) 72 + func = fsel; 73 + 74 + dev_dbg(pc->dev, "get %04x: %08x (%u => %s)\n", 75 + BIT_TO_REG(bit), val, pin, 76 + pc->func_names[func]); 77 + 78 + return func; 79 + } 80 + 81 + static int brcmstb_pinctrl_fsel_set(struct brcmstb_pinctrl *pc, 82 + unsigned int pin, unsigned int func) 83 + { 84 + u32 bit = pc->pin_regs[pin].mux_bit, val, fsel_mask; 85 + const u8 *pin_funcs; 86 + int fsel; 87 + int cur; 88 + int i; 89 + 90 + if (!bit || func >= pc->func_count) 91 + return -EINVAL; 92 + 93 + bit &= ~MUX_BIT_VALID; 94 + 95 + fsel = pc->pin_funcs[pin].n_funcs + 1; 96 + fsel_mask = pc->pin_funcs[pin].func_mask; 97 + 98 + if (func >= fsel) { 99 + /* Convert to an fsel number */ 100 + pin_funcs = pc->pin_funcs[pin].funcs; 101 + for (i = 1; i < fsel; i++) { 102 + if (pin_funcs[i - 1] == func) { 103 + fsel = i; 104 + break; 105 + } 106 + } 107 + } else { 108 + fsel = func; 109 + } 110 + 111 + if (fsel >= pc->pin_funcs[pin].n_funcs + 1) 112 + return -EINVAL; 113 + 114 + guard(spinlock_irqsave)(&pc->fsel_lock); 115 + 116 + val = readl(pc->base + BIT_TO_REG(bit)); 117 + cur = (val >> BIT_TO_SHIFT(bit)) & fsel_mask; 118 + 119 + dev_dbg(pc->dev, "read %04x: %08x (%u => %s)\n", 120 + BIT_TO_REG(bit), val, pin, 121 + pc->func_names[cur]); 122 + 123 + if (cur != fsel) { 124 + val &= ~(fsel_mask << BIT_TO_SHIFT(bit)); 125 + val |= fsel << BIT_TO_SHIFT(bit); 126 + 127 + dev_dbg(pc->dev, "write %04x: %08x (%u <= %s)\n", 128 + BIT_TO_REG(bit), val, pin, 129 + pc->func_names[fsel]); 130 + writel(val, pc->base + BIT_TO_REG(bit)); 131 + } 132 + 133 + return 0; 134 + } 135 + 136 + static int brcmstb_pctl_get_groups_count(struct pinctrl_dev *pctldev) 137 + { 138 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 139 + 140 + return pc->pctl_desc.npins; 141 + } 142 + 143 + static const char *brcmstb_pctl_get_group_name(struct pinctrl_dev *pctldev, 144 + unsigned int selector) 145 + { 146 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 147 + 148 + return pc->gpio_groups[selector]; 149 + } 150 + 151 + static int brcmstb_pctl_get_group_pins(struct pinctrl_dev *pctldev, 152 + unsigned int selector, 153 + const unsigned int **pins, 154 + unsigned int *num_pins) 155 + { 156 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 157 + 158 + *pins = &pc->pctl_desc.pins[selector].number; 159 + *num_pins = 1; 160 + 161 + return 0; 162 + } 163 + 164 + static void brcmstb_pctl_pin_dbg_show(struct pinctrl_dev *pctldev, 165 + struct seq_file *s, unsigned int offset) 166 + { 167 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 168 + unsigned int fsel = brcmstb_pinctrl_fsel_get(pc, offset); 169 + const char *fname = pc->func_names[fsel]; 170 + 171 + seq_printf(s, "function %s", fname); 172 + } 173 + 174 + static void brcmstb_pctl_dt_free_map(struct pinctrl_dev *pctldev, 175 + struct pinctrl_map *maps, 176 + unsigned int num_maps) 177 + { 178 + int i; 179 + 180 + for (i = 0; i < num_maps; i++) 181 + if (maps[i].type == PIN_MAP_TYPE_CONFIGS_PIN) 182 + kfree(maps[i].data.configs.configs); 183 + 184 + kfree(maps); 185 + } 186 + 187 + static const struct pinctrl_ops brcmstb_pctl_ops = { 188 + .get_groups_count = brcmstb_pctl_get_groups_count, 189 + .get_group_name = brcmstb_pctl_get_group_name, 190 + .get_group_pins = brcmstb_pctl_get_group_pins, 191 + .pin_dbg_show = brcmstb_pctl_pin_dbg_show, 192 + .dt_node_to_map = pinconf_generic_dt_node_to_map_all, 193 + .dt_free_map = brcmstb_pctl_dt_free_map, 194 + }; 195 + 196 + static int brcmstb_pmx_free(struct pinctrl_dev *pctldev, unsigned int offset) 197 + { 198 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 199 + 200 + /* disable by setting to GPIO */ 201 + return brcmstb_pinctrl_fsel_set(pc, offset, pc->func_gpio); 202 + } 203 + 204 + static int brcmstb_pmx_get_functions_count(struct pinctrl_dev *pctldev) 205 + { 206 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 207 + 208 + return pc->func_count; 209 + } 210 + 211 + static const char *brcmstb_pmx_get_function_name(struct pinctrl_dev *pctldev, 212 + unsigned int selector) 213 + { 214 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 215 + 216 + return (selector < pc->func_count) ? pc->func_names[selector] : NULL; 217 + } 218 + 219 + static int brcmstb_pmx_get_function_groups(struct pinctrl_dev *pctldev, 220 + unsigned int selector, 221 + const char *const **groups, 222 + unsigned *const num_groups) 223 + { 224 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 225 + 226 + *groups = pc->gpio_groups; 227 + *num_groups = pc->pctl_desc.npins; 228 + 229 + return 0; 230 + } 231 + 232 + static int brcmstb_pmx_set(struct pinctrl_dev *pctldev, 233 + unsigned int func_selector, 234 + unsigned int group_selector) 235 + { 236 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 237 + const struct pinctrl_desc *pctldesc = &pc->pctl_desc; 238 + const struct pinctrl_pin_desc *pindesc; 239 + 240 + if (group_selector >= pctldesc->npins) 241 + return -EINVAL; 242 + 243 + pindesc = &pctldesc->pins[group_selector]; 244 + return brcmstb_pinctrl_fsel_set(pc, pindesc->number, func_selector); 245 + } 246 + 247 + static int brcmstb_pmx_gpio_request_enable(struct pinctrl_dev *pctldev, 248 + struct pinctrl_gpio_range *range, 249 + unsigned int pin) 250 + { 251 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 252 + 253 + return brcmstb_pinctrl_fsel_set(pc, pin, pc->func_gpio); 254 + } 255 + 256 + static void brcmstb_pmx_gpio_disable_free(struct pinctrl_dev *pctldev, 257 + struct pinctrl_gpio_range *range, 258 + unsigned int offset) 259 + { 260 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 261 + 262 + /* disable by setting to GPIO */ 263 + (void)brcmstb_pinctrl_fsel_set(pc, offset, pc->func_gpio); 264 + } 265 + 266 + static bool brcmstb_pmx_function_is_gpio(struct pinctrl_dev *pctldev, 267 + unsigned int selector) 268 + { 269 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 270 + 271 + return pc->func_gpio == selector; 272 + } 273 + 274 + static const struct pinmux_ops brcmstb_pmx_ops = { 275 + .free = brcmstb_pmx_free, 276 + .get_functions_count = brcmstb_pmx_get_functions_count, 277 + .get_function_name = brcmstb_pmx_get_function_name, 278 + .get_function_groups = brcmstb_pmx_get_function_groups, 279 + .set_mux = brcmstb_pmx_set, 280 + .gpio_request_enable = brcmstb_pmx_gpio_request_enable, 281 + .gpio_disable_free = brcmstb_pmx_gpio_disable_free, 282 + .function_is_gpio = brcmstb_pmx_function_is_gpio, 283 + .strict = true, 284 + }; 285 + 286 + static unsigned int brcmstb_pull_config_get(struct brcmstb_pinctrl *pc, 287 + unsigned int pin) 288 + { 289 + u32 bit = pc->pin_regs[pin].pad_bit, val; 290 + 291 + if (bit == PAD_BIT_INVALID) 292 + return BRCMSTB_PULL_NONE; 293 + 294 + val = readl(pc->base + BIT_TO_REG(bit)); 295 + return (val >> BIT_TO_SHIFT(bit)) & BRCMSTB_PULL_MASK; 296 + } 297 + 298 + static int brcmstb_pull_config_set(struct brcmstb_pinctrl *pc, 299 + unsigned int pin, unsigned int arg) 300 + { 301 + u32 bit = pc->pin_regs[pin].pad_bit, val; 302 + 303 + if (bit == PAD_BIT_INVALID) { 304 + dev_warn(pc->dev, "Can't set pulls for %s\n", 305 + pc->gpio_groups[pin]); 306 + return -EINVAL; 307 + } 308 + 309 + guard(spinlock_irqsave)(&pc->fsel_lock); 310 + 311 + val = readl(pc->base + BIT_TO_REG(bit)); 312 + val &= ~(BRCMSTB_PULL_MASK << BIT_TO_SHIFT(bit)); 313 + val |= (arg << BIT_TO_SHIFT(bit)); 314 + writel(val, pc->base + BIT_TO_REG(bit)); 315 + 316 + return 0; 317 + } 318 + 319 + static int brcmstb_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, 320 + unsigned long *config) 321 + { 322 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 323 + enum pin_config_param param = pinconf_to_config_param(*config); 324 + u32 arg; 325 + 326 + switch (param) { 327 + case PIN_CONFIG_BIAS_DISABLE: 328 + arg = (brcmstb_pull_config_get(pc, pin) == BRCMSTB_PULL_NONE); 329 + break; 330 + case PIN_CONFIG_BIAS_PULL_DOWN: 331 + arg = (brcmstb_pull_config_get(pc, pin) == BRCMSTB_PULL_DOWN); 332 + break; 333 + case PIN_CONFIG_BIAS_PULL_UP: 334 + arg = (brcmstb_pull_config_get(pc, pin) == BRCMSTB_PULL_UP); 335 + break; 336 + default: 337 + return -ENOTSUPP; 338 + } 339 + 340 + *config = pinconf_to_config_packed(param, arg); 341 + 342 + return 0; 343 + } 344 + 345 + static int brcmstb_pinconf_set(struct pinctrl_dev *pctldev, 346 + unsigned int pin, unsigned long *configs, 347 + unsigned int num_configs) 348 + { 349 + struct brcmstb_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 350 + int ret = 0; 351 + u32 param; 352 + int i; 353 + 354 + for (i = 0; i < num_configs; i++) { 355 + param = pinconf_to_config_param(configs[i]); 356 + 357 + switch (param) { 358 + case PIN_CONFIG_BIAS_DISABLE: 359 + ret = brcmstb_pull_config_set(pc, pin, BRCMSTB_PULL_NONE); 360 + break; 361 + case PIN_CONFIG_BIAS_PULL_DOWN: 362 + ret = brcmstb_pull_config_set(pc, pin, BRCMSTB_PULL_DOWN); 363 + break; 364 + case PIN_CONFIG_BIAS_PULL_UP: 365 + ret = brcmstb_pull_config_set(pc, pin, BRCMSTB_PULL_UP); 366 + break; 367 + default: 368 + return -ENOTSUPP; 369 + } 370 + } 371 + 372 + return ret; 373 + } 374 + 375 + static const struct pinconf_ops brcmstb_pinconf_ops = { 376 + .is_generic = true, 377 + .pin_config_get = brcmstb_pinconf_get, 378 + .pin_config_set = brcmstb_pinconf_set, 379 + }; 380 + 381 + int brcmstb_pinctrl_probe(struct platform_device *pdev) 382 + { 383 + struct device *dev = &pdev->dev; 384 + struct device_node *np = dev->of_node; 385 + const struct brcmstb_pdata *pdata; 386 + struct brcmstb_pinctrl *pc; 387 + const char **names; 388 + int num_pins, i; 389 + 390 + pdata = of_device_get_match_data(dev); 391 + 392 + pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); 393 + if (!pc) 394 + return -ENOMEM; 395 + 396 + platform_set_drvdata(pdev, pc); 397 + pc->dev = dev; 398 + spin_lock_init(&pc->fsel_lock); 399 + 400 + pc->base = devm_of_iomap(dev, np, 0, NULL); 401 + if (IS_ERR(pc->base)) 402 + return dev_err_probe(&pdev->dev, PTR_ERR(pc->base), 403 + "Could not get IO memory\n"); 404 + 405 + pc->pctl_desc = *pdata->pctl_desc; 406 + pc->pctl_desc.pctlops = &brcmstb_pctl_ops; 407 + pc->pctl_desc.pmxops = &brcmstb_pmx_ops; 408 + pc->pctl_desc.confops = &brcmstb_pinconf_ops; 409 + pc->pctl_desc.owner = THIS_MODULE; 410 + num_pins = pc->pctl_desc.npins; 411 + names = devm_kmalloc_array(dev, num_pins, sizeof(const char *), 412 + GFP_KERNEL); 413 + if (!names) 414 + return -ENOMEM; 415 + 416 + for (i = 0; i < num_pins; i++) 417 + names[i] = pc->pctl_desc.pins[i].name; 418 + 419 + pc->gpio_groups = names; 420 + pc->pin_regs = pdata->pin_regs; 421 + pc->pin_funcs = pdata->pin_funcs; 422 + pc->func_count = pdata->func_count; 423 + pc->func_names = pdata->func_names; 424 + 425 + pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); 426 + if (IS_ERR(pc->pctl_dev)) 427 + return dev_err_probe(&pdev->dev, PTR_ERR(pc->pctl_dev), 428 + "Failed to register pinctrl device\n"); 429 + 430 + pc->gpio_range = *pdata->gpio_range; 431 + pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); 432 + 433 + return 0; 434 + } 435 + EXPORT_SYMBOL(brcmstb_pinctrl_probe); 436 + 437 + MODULE_AUTHOR("Phil Elwell"); 438 + MODULE_AUTHOR("Jonathan Bell"); 439 + MODULE_AUTHOR("Ivan T. Ivanov"); 440 + MODULE_AUTHOR("Andrea della Porta"); 441 + MODULE_DESCRIPTION("Broadcom brcmstb pinctrl driver"); 442 + MODULE_LICENSE("GPL");
+93
drivers/pinctrl/bcm/pinctrl-brcmstb.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + /* 3 + * Header for Broadcom brcmstb GPIO based drivers 4 + * 5 + * Copyright (C) 2024-2025 Ivan T. Ivanov, Andrea della Porta 6 + * Copyright (C) 2021-3 Raspberry Pi Ltd. 7 + * Copyright (C) 2012 Chris Boot, Simon Arlott, Stephen Warren 8 + * 9 + * Based heavily on the BCM2835 GPIO & pinctrl driver, which was inspired by: 10 + * pinctrl-nomadik.c, please see original file for copyright information 11 + * pinctrl-tegra.c, please see original file for copyright information 12 + */ 13 + 14 + #ifndef __PINCTRL_BRCMSTB_H__ 15 + #define __PINCTRL_BRCMSTB_H__ 16 + 17 + #include <linux/types.h> 18 + #include <linux/platform_device.h> 19 + 20 + #define BRCMSTB_FUNC(f) \ 21 + [func_##f] = #f 22 + 23 + #define MUX_BIT_VALID 0x8000 24 + #define PAD_BIT_INVALID 0xffff 25 + 26 + #define MUX_BIT(muxreg, muxshift) \ 27 + (MUX_BIT_VALID + ((muxreg) << 5) + ((muxshift) << 2)) 28 + #define PAD_BIT(padreg, padshift) \ 29 + (((padreg) << 5) + ((padshift) << 1)) 30 + 31 + #define GPIO_REGS(n, muxreg, muxshift, padreg, padshift) \ 32 + [n] = { MUX_BIT(muxreg, muxshift), PAD_BIT(padreg, padshift) } 33 + 34 + #define EMMC_REGS(n, padreg, padshift) \ 35 + [n] = { 0, PAD_BIT(padreg, padshift) } 36 + 37 + #define AON_GPIO_REGS(n, muxreg, muxshift, padreg, padshift) \ 38 + GPIO_REGS(n, muxreg, muxshift, padreg, padshift) 39 + 40 + #define AON_SGPIO_REGS(n, muxreg, muxshift) \ 41 + [(n) + 32] = { MUX_BIT(muxreg, muxshift), PAD_BIT_INVALID } 42 + 43 + #define GPIO_PIN(n) PINCTRL_PIN(n, "gpio" #n) 44 + /** 45 + * AON pins are in the Always-On power domain. SGPIOs are also 'Safe' 46 + * being 5V tolerant (necessary for the HDMI I2C pins), and can be driven 47 + * while the power is off. 48 + */ 49 + #define AON_GPIO_PIN(n) PINCTRL_PIN(n, "aon_gpio" #n) 50 + #define AON_SGPIO_PIN(n) PINCTRL_PIN((n) + 32, "aon_sgpio" #n) 51 + 52 + struct pin_regs { 53 + u16 mux_bit; 54 + u16 pad_bit; 55 + }; 56 + 57 + /** 58 + * struct brcmstb_pin_funcs - pins provide their primary/alternate 59 + * functions in this struct 60 + * @func_mask: mask representing valid bits of the function selector 61 + * in the registers 62 + * @funcs: array of function identifiers 63 + * @n_funcs: number of identifiers of the @funcs array above 64 + */ 65 + struct brcmstb_pin_funcs { 66 + const u32 func_mask; 67 + const u8 *funcs; 68 + const unsigned int n_funcs; 69 + }; 70 + 71 + /** 72 + * struct brcmstb_pdata - specific data for a pinctrl chip implementation 73 + * @pctl_desc: pin controller descriptor for this implementation 74 + * @gpio_range: range of GPIOs served by this controller 75 + * @pin_regs: array of register descriptors for each pin 76 + * @pin_funcs: array of all possible assignable function for each pin 77 + * @func_count: total number of functions 78 + * @func_gpio: which function number is GPIO (usually 0) 79 + * @func_names: an array listing all function names 80 + */ 81 + struct brcmstb_pdata { 82 + const struct pinctrl_desc *pctl_desc; 83 + const struct pinctrl_gpio_range *gpio_range; 84 + const struct pin_regs *pin_regs; 85 + const struct brcmstb_pin_funcs *pin_funcs; 86 + const unsigned int func_count; 87 + const unsigned int func_gpio; 88 + const char * const *func_names; 89 + }; 90 + 91 + int brcmstb_pinctrl_probe(struct platform_device *pdev); 92 + 93 + #endif