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

pinctrl: bcm: Convert drivers to use struct pingroup and PINCTRL_PINGROUP()

The pin control header provides struct pingroup and PINCTRL_PINGROUP() macro.
Utilize them instead of open coded variants in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220620165053.74170-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andy Shevchenko and committed by
Linus Walleij
0e3db163 e6cbbe42

+258 -319
+54 -67
drivers/pinctrl/bcm/pinctrl-bcm6318.c
··· 27 27 #define BCM6318_PAD_REG 0x54 28 28 #define BCM6328_PAD_MASK GENMASK(3, 0) 29 29 30 - struct bcm6318_pingroup { 31 - const char *name; 32 - const unsigned * const pins; 33 - const unsigned num_pins; 34 - }; 35 - 36 30 struct bcm6318_function { 37 31 const char *name; 38 32 const char * const *groups; ··· 140 146 static unsigned gpio48_pins[] = { 48 }; 141 147 static unsigned gpio49_pins[] = { 49 }; 142 148 143 - #define BCM6318_GROUP(n) \ 144 - { \ 145 - .name = #n, \ 146 - .pins = n##_pins, \ 147 - .num_pins = ARRAY_SIZE(n##_pins), \ 148 - } 149 - 150 - static struct bcm6318_pingroup bcm6318_groups[] = { 151 - BCM6318_GROUP(gpio0), 152 - BCM6318_GROUP(gpio1), 153 - BCM6318_GROUP(gpio2), 154 - BCM6318_GROUP(gpio3), 155 - BCM6318_GROUP(gpio4), 156 - BCM6318_GROUP(gpio5), 157 - BCM6318_GROUP(gpio6), 158 - BCM6318_GROUP(gpio7), 159 - BCM6318_GROUP(gpio8), 160 - BCM6318_GROUP(gpio9), 161 - BCM6318_GROUP(gpio10), 162 - BCM6318_GROUP(gpio11), 163 - BCM6318_GROUP(gpio12), 164 - BCM6318_GROUP(gpio13), 165 - BCM6318_GROUP(gpio14), 166 - BCM6318_GROUP(gpio15), 167 - BCM6318_GROUP(gpio16), 168 - BCM6318_GROUP(gpio17), 169 - BCM6318_GROUP(gpio18), 170 - BCM6318_GROUP(gpio19), 171 - BCM6318_GROUP(gpio20), 172 - BCM6318_GROUP(gpio21), 173 - BCM6318_GROUP(gpio22), 174 - BCM6318_GROUP(gpio23), 175 - BCM6318_GROUP(gpio24), 176 - BCM6318_GROUP(gpio25), 177 - BCM6318_GROUP(gpio26), 178 - BCM6318_GROUP(gpio27), 179 - BCM6318_GROUP(gpio28), 180 - BCM6318_GROUP(gpio29), 181 - BCM6318_GROUP(gpio30), 182 - BCM6318_GROUP(gpio31), 183 - BCM6318_GROUP(gpio32), 184 - BCM6318_GROUP(gpio33), 185 - BCM6318_GROUP(gpio34), 186 - BCM6318_GROUP(gpio35), 187 - BCM6318_GROUP(gpio36), 188 - BCM6318_GROUP(gpio37), 189 - BCM6318_GROUP(gpio38), 190 - BCM6318_GROUP(gpio39), 191 - BCM6318_GROUP(gpio40), 192 - BCM6318_GROUP(gpio41), 193 - BCM6318_GROUP(gpio42), 194 - BCM6318_GROUP(gpio43), 195 - BCM6318_GROUP(gpio44), 196 - BCM6318_GROUP(gpio45), 197 - BCM6318_GROUP(gpio46), 198 - BCM6318_GROUP(gpio47), 199 - BCM6318_GROUP(gpio48), 200 - BCM6318_GROUP(gpio49), 149 + static struct pingroup bcm6318_groups[] = { 150 + BCM_PIN_GROUP(gpio0), 151 + BCM_PIN_GROUP(gpio1), 152 + BCM_PIN_GROUP(gpio2), 153 + BCM_PIN_GROUP(gpio3), 154 + BCM_PIN_GROUP(gpio4), 155 + BCM_PIN_GROUP(gpio5), 156 + BCM_PIN_GROUP(gpio6), 157 + BCM_PIN_GROUP(gpio7), 158 + BCM_PIN_GROUP(gpio8), 159 + BCM_PIN_GROUP(gpio9), 160 + BCM_PIN_GROUP(gpio10), 161 + BCM_PIN_GROUP(gpio11), 162 + BCM_PIN_GROUP(gpio12), 163 + BCM_PIN_GROUP(gpio13), 164 + BCM_PIN_GROUP(gpio14), 165 + BCM_PIN_GROUP(gpio15), 166 + BCM_PIN_GROUP(gpio16), 167 + BCM_PIN_GROUP(gpio17), 168 + BCM_PIN_GROUP(gpio18), 169 + BCM_PIN_GROUP(gpio19), 170 + BCM_PIN_GROUP(gpio20), 171 + BCM_PIN_GROUP(gpio21), 172 + BCM_PIN_GROUP(gpio22), 173 + BCM_PIN_GROUP(gpio23), 174 + BCM_PIN_GROUP(gpio24), 175 + BCM_PIN_GROUP(gpio25), 176 + BCM_PIN_GROUP(gpio26), 177 + BCM_PIN_GROUP(gpio27), 178 + BCM_PIN_GROUP(gpio28), 179 + BCM_PIN_GROUP(gpio29), 180 + BCM_PIN_GROUP(gpio30), 181 + BCM_PIN_GROUP(gpio31), 182 + BCM_PIN_GROUP(gpio32), 183 + BCM_PIN_GROUP(gpio33), 184 + BCM_PIN_GROUP(gpio34), 185 + BCM_PIN_GROUP(gpio35), 186 + BCM_PIN_GROUP(gpio36), 187 + BCM_PIN_GROUP(gpio37), 188 + BCM_PIN_GROUP(gpio38), 189 + BCM_PIN_GROUP(gpio39), 190 + BCM_PIN_GROUP(gpio40), 191 + BCM_PIN_GROUP(gpio41), 192 + BCM_PIN_GROUP(gpio42), 193 + BCM_PIN_GROUP(gpio43), 194 + BCM_PIN_GROUP(gpio44), 195 + BCM_PIN_GROUP(gpio45), 196 + BCM_PIN_GROUP(gpio46), 197 + BCM_PIN_GROUP(gpio47), 198 + BCM_PIN_GROUP(gpio48), 199 + BCM_PIN_GROUP(gpio49), 201 200 }; 202 201 203 202 /* GPIO_MODE */ ··· 355 368 356 369 static int bcm6318_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 357 370 unsigned group, const unsigned **pins, 358 - unsigned *num_pins) 371 + unsigned *npins) 359 372 { 360 373 *pins = bcm6318_groups[group].pins; 361 - *num_pins = bcm6318_groups[group].num_pins; 374 + *npins = bcm6318_groups[group].npins; 362 375 363 376 return 0; 364 377 } ··· 411 424 unsigned selector, unsigned group) 412 425 { 413 426 struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 414 - const struct bcm6318_pingroup *pg = &bcm6318_groups[group]; 427 + const struct pingroup *pg = &bcm6318_groups[group]; 415 428 const struct bcm6318_function *f = &bcm6318_funcs[selector]; 416 429 417 430 bcm6318_rmw_mux(pc, pg->pins[0], f->mode_val, f->mux_val);
+63 -76
drivers/pinctrl/bcm/pinctrl-bcm63268.c
··· 40 40 BCM63268_BASEMODE, 41 41 }; 42 42 43 - struct bcm63268_pingroup { 44 - const char *name; 45 - const unsigned * const pins; 46 - const unsigned num_pins; 47 - }; 48 - 49 43 struct bcm63268_function { 50 44 const char *name; 51 45 const char * const *groups; ··· 179 185 static unsigned vdsl_phy2_grp_pins[] = { 24, 25 }; 180 186 static unsigned vdsl_phy3_grp_pins[] = { 26, 27 }; 181 187 182 - #define BCM63268_GROUP(n) \ 183 - { \ 184 - .name = #n, \ 185 - .pins = n##_pins, \ 186 - .num_pins = ARRAY_SIZE(n##_pins), \ 187 - } 188 - 189 - static struct bcm63268_pingroup bcm63268_groups[] = { 190 - BCM63268_GROUP(gpio0), 191 - BCM63268_GROUP(gpio1), 192 - BCM63268_GROUP(gpio2), 193 - BCM63268_GROUP(gpio3), 194 - BCM63268_GROUP(gpio4), 195 - BCM63268_GROUP(gpio5), 196 - BCM63268_GROUP(gpio6), 197 - BCM63268_GROUP(gpio7), 198 - BCM63268_GROUP(gpio8), 199 - BCM63268_GROUP(gpio9), 200 - BCM63268_GROUP(gpio10), 201 - BCM63268_GROUP(gpio11), 202 - BCM63268_GROUP(gpio12), 203 - BCM63268_GROUP(gpio13), 204 - BCM63268_GROUP(gpio14), 205 - BCM63268_GROUP(gpio15), 206 - BCM63268_GROUP(gpio16), 207 - BCM63268_GROUP(gpio17), 208 - BCM63268_GROUP(gpio18), 209 - BCM63268_GROUP(gpio19), 210 - BCM63268_GROUP(gpio20), 211 - BCM63268_GROUP(gpio21), 212 - BCM63268_GROUP(gpio22), 213 - BCM63268_GROUP(gpio23), 214 - BCM63268_GROUP(gpio24), 215 - BCM63268_GROUP(gpio25), 216 - BCM63268_GROUP(gpio26), 217 - BCM63268_GROUP(gpio27), 218 - BCM63268_GROUP(gpio28), 219 - BCM63268_GROUP(gpio29), 220 - BCM63268_GROUP(gpio30), 221 - BCM63268_GROUP(gpio31), 222 - BCM63268_GROUP(gpio32), 223 - BCM63268_GROUP(gpio33), 224 - BCM63268_GROUP(gpio34), 225 - BCM63268_GROUP(gpio35), 226 - BCM63268_GROUP(gpio36), 227 - BCM63268_GROUP(gpio37), 228 - BCM63268_GROUP(gpio38), 229 - BCM63268_GROUP(gpio39), 230 - BCM63268_GROUP(gpio40), 231 - BCM63268_GROUP(gpio41), 232 - BCM63268_GROUP(gpio42), 233 - BCM63268_GROUP(gpio43), 234 - BCM63268_GROUP(gpio44), 235 - BCM63268_GROUP(gpio45), 236 - BCM63268_GROUP(gpio46), 237 - BCM63268_GROUP(gpio47), 238 - BCM63268_GROUP(gpio48), 239 - BCM63268_GROUP(gpio49), 240 - BCM63268_GROUP(gpio50), 241 - BCM63268_GROUP(gpio51), 188 + static struct pingroup bcm63268_groups[] = { 189 + BCM_PIN_GROUP(gpio0), 190 + BCM_PIN_GROUP(gpio1), 191 + BCM_PIN_GROUP(gpio2), 192 + BCM_PIN_GROUP(gpio3), 193 + BCM_PIN_GROUP(gpio4), 194 + BCM_PIN_GROUP(gpio5), 195 + BCM_PIN_GROUP(gpio6), 196 + BCM_PIN_GROUP(gpio7), 197 + BCM_PIN_GROUP(gpio8), 198 + BCM_PIN_GROUP(gpio9), 199 + BCM_PIN_GROUP(gpio10), 200 + BCM_PIN_GROUP(gpio11), 201 + BCM_PIN_GROUP(gpio12), 202 + BCM_PIN_GROUP(gpio13), 203 + BCM_PIN_GROUP(gpio14), 204 + BCM_PIN_GROUP(gpio15), 205 + BCM_PIN_GROUP(gpio16), 206 + BCM_PIN_GROUP(gpio17), 207 + BCM_PIN_GROUP(gpio18), 208 + BCM_PIN_GROUP(gpio19), 209 + BCM_PIN_GROUP(gpio20), 210 + BCM_PIN_GROUP(gpio21), 211 + BCM_PIN_GROUP(gpio22), 212 + BCM_PIN_GROUP(gpio23), 213 + BCM_PIN_GROUP(gpio24), 214 + BCM_PIN_GROUP(gpio25), 215 + BCM_PIN_GROUP(gpio26), 216 + BCM_PIN_GROUP(gpio27), 217 + BCM_PIN_GROUP(gpio28), 218 + BCM_PIN_GROUP(gpio29), 219 + BCM_PIN_GROUP(gpio30), 220 + BCM_PIN_GROUP(gpio31), 221 + BCM_PIN_GROUP(gpio32), 222 + BCM_PIN_GROUP(gpio33), 223 + BCM_PIN_GROUP(gpio34), 224 + BCM_PIN_GROUP(gpio35), 225 + BCM_PIN_GROUP(gpio36), 226 + BCM_PIN_GROUP(gpio37), 227 + BCM_PIN_GROUP(gpio38), 228 + BCM_PIN_GROUP(gpio39), 229 + BCM_PIN_GROUP(gpio40), 230 + BCM_PIN_GROUP(gpio41), 231 + BCM_PIN_GROUP(gpio42), 232 + BCM_PIN_GROUP(gpio43), 233 + BCM_PIN_GROUP(gpio44), 234 + BCM_PIN_GROUP(gpio45), 235 + BCM_PIN_GROUP(gpio46), 236 + BCM_PIN_GROUP(gpio47), 237 + BCM_PIN_GROUP(gpio48), 238 + BCM_PIN_GROUP(gpio49), 239 + BCM_PIN_GROUP(gpio50), 240 + BCM_PIN_GROUP(gpio51), 242 241 243 242 /* multi pin groups */ 244 - BCM63268_GROUP(nand_grp), 245 - BCM63268_GROUP(dectpd_grp), 246 - BCM63268_GROUP(vdsl_phy0_grp), 247 - BCM63268_GROUP(vdsl_phy1_grp), 248 - BCM63268_GROUP(vdsl_phy2_grp), 249 - BCM63268_GROUP(vdsl_phy3_grp), 243 + BCM_PIN_GROUP(nand_grp), 244 + BCM_PIN_GROUP(dectpd_grp), 245 + BCM_PIN_GROUP(vdsl_phy0_grp), 246 + BCM_PIN_GROUP(vdsl_phy1_grp), 247 + BCM_PIN_GROUP(vdsl_phy2_grp), 248 + BCM_PIN_GROUP(vdsl_phy3_grp), 250 249 }; 251 250 252 251 static const char * const led_groups[] = { ··· 474 487 static int bcm63268_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 475 488 unsigned group, 476 489 const unsigned **pins, 477 - unsigned *num_pins) 490 + unsigned *npins) 478 491 { 479 492 *pins = bcm63268_groups[group].pins; 480 - *num_pins = bcm63268_groups[group].num_pins; 493 + *npins = bcm63268_groups[group].npins; 481 494 482 495 return 0; 483 496 } ··· 532 545 unsigned selector, unsigned group) 533 546 { 534 547 struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 535 - const struct bcm63268_pingroup *pg = &bcm63268_groups[group]; 548 + const struct pingroup *pg = &bcm63268_groups[group]; 536 549 const struct bcm63268_function *f = &bcm63268_funcs[selector]; 537 550 unsigned i; 538 551 unsigned int reg; 539 552 unsigned int val, mask; 540 553 541 - for (i = 0; i < pg->num_pins; i++) 554 + for (i = 0; i < pg->npins; i++) 542 555 bcm63268_set_gpio(pc, pg->pins[i]); 543 556 544 557 switch (f->reg) {
+38 -45
drivers/pinctrl/bcm/pinctrl-bcm6328.c
··· 125 125 static unsigned hsspi_cs1_pins[] = { 36 }; 126 126 static unsigned usb_port1_pins[] = { 38 }; 127 127 128 - #define BCM6328_GROUP(n) \ 129 - { \ 130 - .name = #n, \ 131 - .pins = n##_pins, \ 132 - .num_pins = ARRAY_SIZE(n##_pins), \ 133 - } 128 + static struct pingroup bcm6328_groups[] = { 129 + BCM_PIN_GROUP(gpio0), 130 + BCM_PIN_GROUP(gpio1), 131 + BCM_PIN_GROUP(gpio2), 132 + BCM_PIN_GROUP(gpio3), 133 + BCM_PIN_GROUP(gpio4), 134 + BCM_PIN_GROUP(gpio5), 135 + BCM_PIN_GROUP(gpio6), 136 + BCM_PIN_GROUP(gpio7), 137 + BCM_PIN_GROUP(gpio8), 138 + BCM_PIN_GROUP(gpio9), 139 + BCM_PIN_GROUP(gpio10), 140 + BCM_PIN_GROUP(gpio11), 141 + BCM_PIN_GROUP(gpio12), 142 + BCM_PIN_GROUP(gpio13), 143 + BCM_PIN_GROUP(gpio14), 144 + BCM_PIN_GROUP(gpio15), 145 + BCM_PIN_GROUP(gpio16), 146 + BCM_PIN_GROUP(gpio17), 147 + BCM_PIN_GROUP(gpio18), 148 + BCM_PIN_GROUP(gpio19), 149 + BCM_PIN_GROUP(gpio20), 150 + BCM_PIN_GROUP(gpio21), 151 + BCM_PIN_GROUP(gpio22), 152 + BCM_PIN_GROUP(gpio23), 153 + BCM_PIN_GROUP(gpio24), 154 + BCM_PIN_GROUP(gpio25), 155 + BCM_PIN_GROUP(gpio26), 156 + BCM_PIN_GROUP(gpio27), 157 + BCM_PIN_GROUP(gpio28), 158 + BCM_PIN_GROUP(gpio29), 159 + BCM_PIN_GROUP(gpio30), 160 + BCM_PIN_GROUP(gpio31), 134 161 135 - static struct bcm6328_pingroup bcm6328_groups[] = { 136 - BCM6328_GROUP(gpio0), 137 - BCM6328_GROUP(gpio1), 138 - BCM6328_GROUP(gpio2), 139 - BCM6328_GROUP(gpio3), 140 - BCM6328_GROUP(gpio4), 141 - BCM6328_GROUP(gpio5), 142 - BCM6328_GROUP(gpio6), 143 - BCM6328_GROUP(gpio7), 144 - BCM6328_GROUP(gpio8), 145 - BCM6328_GROUP(gpio9), 146 - BCM6328_GROUP(gpio10), 147 - BCM6328_GROUP(gpio11), 148 - BCM6328_GROUP(gpio12), 149 - BCM6328_GROUP(gpio13), 150 - BCM6328_GROUP(gpio14), 151 - BCM6328_GROUP(gpio15), 152 - BCM6328_GROUP(gpio16), 153 - BCM6328_GROUP(gpio17), 154 - BCM6328_GROUP(gpio18), 155 - BCM6328_GROUP(gpio19), 156 - BCM6328_GROUP(gpio20), 157 - BCM6328_GROUP(gpio21), 158 - BCM6328_GROUP(gpio22), 159 - BCM6328_GROUP(gpio23), 160 - BCM6328_GROUP(gpio24), 161 - BCM6328_GROUP(gpio25), 162 - BCM6328_GROUP(gpio26), 163 - BCM6328_GROUP(gpio27), 164 - BCM6328_GROUP(gpio28), 165 - BCM6328_GROUP(gpio29), 166 - BCM6328_GROUP(gpio30), 167 - BCM6328_GROUP(gpio31), 168 - 169 - BCM6328_GROUP(hsspi_cs1), 170 - BCM6328_GROUP(usb_port1), 162 + BCM_PIN_GROUP(hsspi_cs1), 163 + BCM_PIN_GROUP(usb_port1), 171 164 }; 172 165 173 166 /* GPIO_MODE */ ··· 285 292 286 293 static int bcm6328_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 287 294 unsigned group, const unsigned **pins, 288 - unsigned *num_pins) 295 + unsigned *npins) 289 296 { 290 297 *pins = bcm6328_groups[group].pins; 291 - *num_pins = bcm6328_groups[group].num_pins; 298 + *npins = bcm6328_groups[group].npins; 292 299 293 300 return 0; 294 301 } ··· 331 338 unsigned selector, unsigned group) 332 339 { 333 340 struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 334 - const struct bcm6328_pingroup *pg = &bcm6328_groups[group]; 341 + const struct pingroup *pg = &bcm6328_groups[group]; 335 342 const struct bcm6328_function *f = &bcm6328_funcs[selector]; 336 343 337 344 bcm6328_rmw_mux(pc, pg->pins[0], f->mode_val, f->mux_val);
+8 -12
drivers/pinctrl/bcm/pinctrl-bcm6358.c
··· 35 35 #define BCM6358_MODE_MUX_SYS_IRQ BIT(15) 36 36 37 37 struct bcm6358_pingroup { 38 - const char *name; 39 - const unsigned * const pins; 40 - const unsigned num_pins; 38 + struct pingroup grp; 41 39 42 40 const uint16_t mode_val; 43 41 ··· 129 131 130 132 #define BCM6358_GPIO_MUX_GROUP(n, bit, dir) \ 131 133 { \ 132 - .name = #n, \ 133 - .pins = n##_pins, \ 134 - .num_pins = ARRAY_SIZE(n##_pins), \ 134 + .grp = BCM_PIN_GROUP(n), \ 135 135 .mode_val = BCM6358_MODE_MUX_##bit, \ 136 136 .direction = dir, \ 137 137 } ··· 215 219 static const char *bcm6358_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 216 220 unsigned group) 217 221 { 218 - return bcm6358_groups[group].name; 222 + return bcm6358_groups[group].grp.name; 219 223 } 220 224 221 225 static int bcm6358_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 222 226 unsigned group, const unsigned **pins, 223 - unsigned *num_pins) 227 + unsigned *npins) 224 228 { 225 - *pins = bcm6358_groups[group].pins; 226 - *num_pins = bcm6358_groups[group].num_pins; 229 + *pins = bcm6358_groups[group].grp.pins; 230 + *npins = bcm6358_groups[group].grp.npins; 227 231 228 232 return 0; 229 233 } ··· 260 264 unsigned int mask = val; 261 265 unsigned pin; 262 266 263 - for (pin = 0; pin < pg->num_pins; pin++) 267 + for (pin = 0; pin < pg->grp.npins; pin++) 264 268 mask |= (unsigned long)bcm6358_pins[pin].drv_data; 265 269 266 270 regmap_field_update_bits(priv->overlays, mask, val); 267 271 268 - for (pin = 0; pin < pg->num_pins; pin++) { 272 + for (pin = 0; pin < pg->grp.npins; pin++) { 269 273 struct pinctrl_gpio_range *range; 270 274 unsigned int hw_gpio = bcm6358_pins[pin].number; 271 275
+54 -67
drivers/pinctrl/bcm/pinctrl-bcm6362.c
··· 35 35 BCM6362_BASEMODE, 36 36 }; 37 37 38 - struct bcm6362_pingroup { 39 - const char *name; 40 - const unsigned * const pins; 41 - const unsigned num_pins; 42 - }; 43 - 44 38 struct bcm6362_function { 45 39 const char *name; 46 40 const char * const *groups; ··· 156 162 18, 19, 20, 21, 22, 23, 27, 157 163 }; 158 164 159 - #define BCM6362_GROUP(n) \ 160 - { \ 161 - .name = #n, \ 162 - .pins = n##_pins, \ 163 - .num_pins = ARRAY_SIZE(n##_pins), \ 164 - } 165 - 166 - static struct bcm6362_pingroup bcm6362_groups[] = { 167 - BCM6362_GROUP(gpio0), 168 - BCM6362_GROUP(gpio1), 169 - BCM6362_GROUP(gpio2), 170 - BCM6362_GROUP(gpio3), 171 - BCM6362_GROUP(gpio4), 172 - BCM6362_GROUP(gpio5), 173 - BCM6362_GROUP(gpio6), 174 - BCM6362_GROUP(gpio7), 175 - BCM6362_GROUP(gpio8), 176 - BCM6362_GROUP(gpio9), 177 - BCM6362_GROUP(gpio10), 178 - BCM6362_GROUP(gpio11), 179 - BCM6362_GROUP(gpio12), 180 - BCM6362_GROUP(gpio13), 181 - BCM6362_GROUP(gpio14), 182 - BCM6362_GROUP(gpio15), 183 - BCM6362_GROUP(gpio16), 184 - BCM6362_GROUP(gpio17), 185 - BCM6362_GROUP(gpio18), 186 - BCM6362_GROUP(gpio19), 187 - BCM6362_GROUP(gpio20), 188 - BCM6362_GROUP(gpio21), 189 - BCM6362_GROUP(gpio22), 190 - BCM6362_GROUP(gpio23), 191 - BCM6362_GROUP(gpio24), 192 - BCM6362_GROUP(gpio25), 193 - BCM6362_GROUP(gpio26), 194 - BCM6362_GROUP(gpio27), 195 - BCM6362_GROUP(gpio28), 196 - BCM6362_GROUP(gpio29), 197 - BCM6362_GROUP(gpio30), 198 - BCM6362_GROUP(gpio31), 199 - BCM6362_GROUP(gpio32), 200 - BCM6362_GROUP(gpio33), 201 - BCM6362_GROUP(gpio34), 202 - BCM6362_GROUP(gpio35), 203 - BCM6362_GROUP(gpio36), 204 - BCM6362_GROUP(gpio37), 205 - BCM6362_GROUP(gpio38), 206 - BCM6362_GROUP(gpio39), 207 - BCM6362_GROUP(gpio40), 208 - BCM6362_GROUP(gpio41), 209 - BCM6362_GROUP(gpio42), 210 - BCM6362_GROUP(gpio43), 211 - BCM6362_GROUP(gpio44), 212 - BCM6362_GROUP(gpio45), 213 - BCM6362_GROUP(gpio46), 214 - BCM6362_GROUP(gpio47), 215 - BCM6362_GROUP(nand_grp), 165 + static struct pingroup bcm6362_groups[] = { 166 + BCM_PIN_GROUP(gpio0), 167 + BCM_PIN_GROUP(gpio1), 168 + BCM_PIN_GROUP(gpio2), 169 + BCM_PIN_GROUP(gpio3), 170 + BCM_PIN_GROUP(gpio4), 171 + BCM_PIN_GROUP(gpio5), 172 + BCM_PIN_GROUP(gpio6), 173 + BCM_PIN_GROUP(gpio7), 174 + BCM_PIN_GROUP(gpio8), 175 + BCM_PIN_GROUP(gpio9), 176 + BCM_PIN_GROUP(gpio10), 177 + BCM_PIN_GROUP(gpio11), 178 + BCM_PIN_GROUP(gpio12), 179 + BCM_PIN_GROUP(gpio13), 180 + BCM_PIN_GROUP(gpio14), 181 + BCM_PIN_GROUP(gpio15), 182 + BCM_PIN_GROUP(gpio16), 183 + BCM_PIN_GROUP(gpio17), 184 + BCM_PIN_GROUP(gpio18), 185 + BCM_PIN_GROUP(gpio19), 186 + BCM_PIN_GROUP(gpio20), 187 + BCM_PIN_GROUP(gpio21), 188 + BCM_PIN_GROUP(gpio22), 189 + BCM_PIN_GROUP(gpio23), 190 + BCM_PIN_GROUP(gpio24), 191 + BCM_PIN_GROUP(gpio25), 192 + BCM_PIN_GROUP(gpio26), 193 + BCM_PIN_GROUP(gpio27), 194 + BCM_PIN_GROUP(gpio28), 195 + BCM_PIN_GROUP(gpio29), 196 + BCM_PIN_GROUP(gpio30), 197 + BCM_PIN_GROUP(gpio31), 198 + BCM_PIN_GROUP(gpio32), 199 + BCM_PIN_GROUP(gpio33), 200 + BCM_PIN_GROUP(gpio34), 201 + BCM_PIN_GROUP(gpio35), 202 + BCM_PIN_GROUP(gpio36), 203 + BCM_PIN_GROUP(gpio37), 204 + BCM_PIN_GROUP(gpio38), 205 + BCM_PIN_GROUP(gpio39), 206 + BCM_PIN_GROUP(gpio40), 207 + BCM_PIN_GROUP(gpio41), 208 + BCM_PIN_GROUP(gpio42), 209 + BCM_PIN_GROUP(gpio43), 210 + BCM_PIN_GROUP(gpio44), 211 + BCM_PIN_GROUP(gpio45), 212 + BCM_PIN_GROUP(gpio46), 213 + BCM_PIN_GROUP(gpio47), 214 + BCM_PIN_GROUP(nand_grp), 216 215 }; 217 216 218 217 static const char * const led_groups[] = { ··· 450 463 451 464 static int bcm6362_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 452 465 unsigned group, const unsigned **pins, 453 - unsigned *num_pins) 466 + unsigned *npins) 454 467 { 455 468 *pins = bcm6362_groups[group].pins; 456 - *num_pins = bcm6362_groups[group].num_pins; 469 + *npins = bcm6362_groups[group].npins; 457 470 458 471 return 0; 459 472 } ··· 506 519 unsigned selector, unsigned group) 507 520 { 508 521 struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 509 - const struct bcm6362_pingroup *pg = &bcm6362_groups[group]; 522 + const struct pingroup *pg = &bcm6362_groups[group]; 510 523 const struct bcm6362_function *f = &bcm6362_funcs[selector]; 511 524 unsigned i; 512 525 unsigned int reg; 513 526 unsigned int val, mask; 514 527 515 - for (i = 0; i < pg->num_pins; i++) 528 + for (i = 0; i < pg->npins; i++) 516 529 bcm6362_set_gpio(pc, pg->pins[i]); 517 530 518 531 switch (f->reg) {
+39 -52
drivers/pinctrl/bcm/pinctrl-bcm6368.c
··· 26 26 #define BCM6368_BASEMODE_GPIO 0x0 27 27 #define BCM6368_BASEMODE_UART1 0x1 28 28 29 - struct bcm6368_pingroup { 30 - const char *name; 31 - const unsigned * const pins; 32 - const unsigned num_pins; 33 - }; 34 - 35 29 struct bcm6368_function { 36 30 const char *name; 37 31 const char * const *groups; ··· 121 127 static unsigned gpio31_pins[] = { 31 }; 122 128 static unsigned uart1_grp_pins[] = { 30, 31, 32, 33 }; 123 129 124 - #define BCM6368_GROUP(n) \ 125 - { \ 126 - .name = #n, \ 127 - .pins = n##_pins, \ 128 - .num_pins = ARRAY_SIZE(n##_pins), \ 129 - } 130 - 131 - static struct bcm6368_pingroup bcm6368_groups[] = { 132 - BCM6368_GROUP(gpio0), 133 - BCM6368_GROUP(gpio1), 134 - BCM6368_GROUP(gpio2), 135 - BCM6368_GROUP(gpio3), 136 - BCM6368_GROUP(gpio4), 137 - BCM6368_GROUP(gpio5), 138 - BCM6368_GROUP(gpio6), 139 - BCM6368_GROUP(gpio7), 140 - BCM6368_GROUP(gpio8), 141 - BCM6368_GROUP(gpio9), 142 - BCM6368_GROUP(gpio10), 143 - BCM6368_GROUP(gpio11), 144 - BCM6368_GROUP(gpio12), 145 - BCM6368_GROUP(gpio13), 146 - BCM6368_GROUP(gpio14), 147 - BCM6368_GROUP(gpio15), 148 - BCM6368_GROUP(gpio16), 149 - BCM6368_GROUP(gpio17), 150 - BCM6368_GROUP(gpio18), 151 - BCM6368_GROUP(gpio19), 152 - BCM6368_GROUP(gpio20), 153 - BCM6368_GROUP(gpio21), 154 - BCM6368_GROUP(gpio22), 155 - BCM6368_GROUP(gpio23), 156 - BCM6368_GROUP(gpio24), 157 - BCM6368_GROUP(gpio25), 158 - BCM6368_GROUP(gpio26), 159 - BCM6368_GROUP(gpio27), 160 - BCM6368_GROUP(gpio28), 161 - BCM6368_GROUP(gpio29), 162 - BCM6368_GROUP(gpio30), 163 - BCM6368_GROUP(gpio31), 164 - BCM6368_GROUP(uart1_grp), 130 + static struct pingroup bcm6368_groups[] = { 131 + BCM_PIN_GROUP(gpio0), 132 + BCM_PIN_GROUP(gpio1), 133 + BCM_PIN_GROUP(gpio2), 134 + BCM_PIN_GROUP(gpio3), 135 + BCM_PIN_GROUP(gpio4), 136 + BCM_PIN_GROUP(gpio5), 137 + BCM_PIN_GROUP(gpio6), 138 + BCM_PIN_GROUP(gpio7), 139 + BCM_PIN_GROUP(gpio8), 140 + BCM_PIN_GROUP(gpio9), 141 + BCM_PIN_GROUP(gpio10), 142 + BCM_PIN_GROUP(gpio11), 143 + BCM_PIN_GROUP(gpio12), 144 + BCM_PIN_GROUP(gpio13), 145 + BCM_PIN_GROUP(gpio14), 146 + BCM_PIN_GROUP(gpio15), 147 + BCM_PIN_GROUP(gpio16), 148 + BCM_PIN_GROUP(gpio17), 149 + BCM_PIN_GROUP(gpio18), 150 + BCM_PIN_GROUP(gpio19), 151 + BCM_PIN_GROUP(gpio20), 152 + BCM_PIN_GROUP(gpio21), 153 + BCM_PIN_GROUP(gpio22), 154 + BCM_PIN_GROUP(gpio23), 155 + BCM_PIN_GROUP(gpio24), 156 + BCM_PIN_GROUP(gpio25), 157 + BCM_PIN_GROUP(gpio26), 158 + BCM_PIN_GROUP(gpio27), 159 + BCM_PIN_GROUP(gpio28), 160 + BCM_PIN_GROUP(gpio29), 161 + BCM_PIN_GROUP(gpio30), 162 + BCM_PIN_GROUP(gpio31), 163 + BCM_PIN_GROUP(uart1_grp), 165 164 }; 166 165 167 166 static const char * const analog_afe_0_groups[] = { ··· 345 358 346 359 static int bcm6368_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 347 360 unsigned group, const unsigned **pins, 348 - unsigned *num_pins) 361 + unsigned *npins) 349 362 { 350 363 *pins = bcm6368_groups[group].pins; 351 - *num_pins = bcm6368_groups[group].num_pins; 364 + *npins = bcm6368_groups[group].npins; 352 365 353 366 return 0; 354 367 } ··· 380 393 { 381 394 struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 382 395 struct bcm6368_priv *priv = pc->driver_data; 383 - const struct bcm6368_pingroup *pg = &bcm6368_groups[group]; 396 + const struct pingroup *pg = &bcm6368_groups[group]; 384 397 const struct bcm6368_function *fun = &bcm6368_funcs[selector]; 385 398 int i, pin; 386 399 387 400 if (fun->basemode) { 388 401 unsigned int mask = 0; 389 402 390 - for (i = 0; i < pg->num_pins; i++) { 403 + for (i = 0; i < pg->npins; i++) { 391 404 pin = pg->pins[i]; 392 405 if (pin < BCM63XX_BANK_GPIOS) 393 406 mask |= BIT(pin); ··· 406 419 BIT(pin)); 407 420 } 408 421 409 - for (pin = 0; pin < pg->num_pins; pin++) { 422 + for (pin = 0; pin < pg->npins; pin++) { 410 423 struct pinctrl_gpio_range *range; 411 424 int hw_gpio = bcm6368_pins[pin].number; 412 425
+2
drivers/pinctrl/bcm/pinctrl-bcm63xx.h
··· 21 21 unsigned int ngpios; 22 22 }; 23 23 24 + #define BCM_PIN_GROUP(n) PINCTRL_PINGROUP(#n, n##_pins, ARRAY_SIZE(n##_pins)) 25 + 24 26 struct bcm63xx_pinctrl { 25 27 struct device *dev; 26 28 struct regmap *regs;