Message ID | 20241207223335.17535-1-kylehendrydev@gmail.com |
---|---|
State | New |
Headers | show |
Series | pinctrl: bcm63268: Add gpio function | expand |
Hi Kyle, kernel test robot noticed the following build warnings: [auto build test WARNING on linusw-pinctrl/devel] [also build test WARNING on linusw-pinctrl/for-next linus/master v6.13-rc1 next-20241206] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Kyle-Hendry/pinctrl-bcm63268-Add-gpio-function/20241208-063718 base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel patch link: https://lore.kernel.org/r/20241207223335.17535-1-kylehendrydev%40gmail.com patch subject: [PATCH] pinctrl: bcm63268: Add gpio function config: x86_64-buildonly-randconfig-005-20241208 (https://download.01.org/0day-ci/archive/20241208/202412081215.VyJuftPL-lkp@intel.com/config) compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241208/202412081215.VyJuftPL-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202412081215.VyJuftPL-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/pinctrl/bcm/pinctrl-bcm63268.c:630:7: warning: variable 'reg' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized] 630 | case BCM63268_NOREG: | ^~~~~~~~~~~~~~ drivers/pinctrl/bcm/pinctrl-bcm63268.c:638:31: note: uninitialized use occurs here 638 | regmap_update_bits(pc->regs, reg, mask, val); | ^~~ drivers/pinctrl/bcm/pinctrl-bcm63268.c:603:18: note: initialize the variable 'reg' to silence this warning 603 | unsigned int reg; | ^ | = 0 >> drivers/pinctrl/bcm/pinctrl-bcm63268.c:630:7: warning: variable 'mask' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized] 630 | case BCM63268_NOREG: | ^~~~~~~~~~~~~~ drivers/pinctrl/bcm/pinctrl-bcm63268.c:638:36: note: uninitialized use occurs here 638 | regmap_update_bits(pc->regs, reg, mask, val); | ^~~~ drivers/pinctrl/bcm/pinctrl-bcm63268.c:604:24: note: initialize the variable 'mask' to silence this warning 604 | unsigned int val, mask; | ^ | = 0 >> drivers/pinctrl/bcm/pinctrl-bcm63268.c:630:7: warning: variable 'val' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized] 630 | case BCM63268_NOREG: | ^~~~~~~~~~~~~~ drivers/pinctrl/bcm/pinctrl-bcm63268.c:638:42: note: uninitialized use occurs here 638 | regmap_update_bits(pc->regs, reg, mask, val); | ^~~ drivers/pinctrl/bcm/pinctrl-bcm63268.c:604:18: note: initialize the variable 'val' to silence this warning 604 | unsigned int val, mask; | ^ | = 0 3 warnings generated. vim +/reg +630 drivers/pinctrl/bcm/pinctrl-bcm63268.c 595 596 static int bcm63268_pinctrl_set_mux(struct pinctrl_dev *pctldev, 597 unsigned selector, unsigned group) 598 { 599 struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 600 const struct pingroup *pg = &bcm63268_groups[group]; 601 const struct bcm63268_function *f = &bcm63268_funcs[selector]; 602 unsigned i; 603 unsigned int reg; 604 unsigned int val, mask; 605 606 for (i = 0; i < pg->npins; i++) 607 bcm63268_set_gpio(pc, pg->pins[i]); 608 609 switch (f->reg) { 610 case BCM63268_LEDCTRL: 611 reg = BCM63268_LED_REG; 612 mask = BIT(pg->pins[0]); 613 val = BIT(pg->pins[0]); 614 break; 615 case BCM63268_MODE: 616 reg = BCM63268_MODE_REG; 617 mask = BIT(pg->pins[0]); 618 val = BIT(pg->pins[0]); 619 break; 620 case BCM63268_CTRL: 621 reg = BCM63268_CTRL_REG; 622 mask = BIT(pg->pins[0]); 623 val = 0; 624 break; 625 case BCM63268_BASEMODE: 626 reg = BCM63268_BASEMODE_REG; 627 mask = f->mask; 628 val = f->mask; 629 break; > 630 case BCM63268_NOREG: 631 /*Do nothing, leave registers as default*/ 632 break; 633 default: 634 WARN_ON(1); 635 return -EINVAL; 636 } 637 638 regmap_update_bits(pc->regs, reg, mask, val); 639 640 return 0; 641 } 642
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm63268.c b/drivers/pinctrl/bcm/pinctrl-bcm63268.c index 80c2fc55ffa2..5ad86b40f0b3 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm63268.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm63268.c @@ -38,6 +38,7 @@ enum bcm63268_pinctrl_reg { BCM63268_MODE, BCM63268_CTRL, BCM63268_BASEMODE, + BCM63268_NOREG, }; struct bcm63268_function { @@ -242,6 +243,61 @@ static struct pingroup bcm63268_groups[] = { BCM_PIN_GROUP(vdsl_phy3_grp), }; +static const char * const gpio_groups[] = { + "gpio0", + "gpio1", + "gpio2", + "gpio3", + "gpio4", + "gpio5", + "gpio6", + "gpio7", + "gpio8", + "gpio9", + "gpio10", + "gpio11", + "gpio12", + "gpio13", + "gpio14", + "gpio15", + "gpio16", + "gpio17", + "gpio18", + "gpio19", + "gpio20", + "gpio21", + "gpio22", + "gpio23", + "gpio24", + "gpio25", + "gpio26", + "gpio27", + "gpio28", + "gpio29", + "gpio30", + "gpio31", + "gpio32", + "gpio33", + "gpio34", + "gpio35", + "gpio36", + "gpio37", + "gpio38", + "gpio39", + "gpio40", + "gpio41", + "gpio42", + "gpio43", + "gpio44", + "gpio45", + "gpio46", + "gpio47", + "gpio48", + "gpio49", + "gpio50", + "gpio51", +}; + static const char * const led_groups[] = { "gpio0", "gpio1", @@ -427,7 +483,16 @@ static const char * const vdsl_phy_override_3_groups[] = { .mask = val, \ } +#define BCM63268_NOMODE_FUN(n) \ + { \ + .name = #n, \ + .groups = n##_groups, \ + .num_groups = ARRAY_SIZE(n##_groups), \ + .reg = BCM63268_NOREG, \ + } + static const struct bcm63268_function bcm63268_funcs[] = { + BCM63268_NOMODE_FUN(gpio), BCM63268_LED_FUN(led), BCM63268_MODE_FUN(serial_led_clk), BCM63268_MODE_FUN(serial_led_data), @@ -562,6 +627,9 @@ static int bcm63268_pinctrl_set_mux(struct pinctrl_dev *pctldev, mask = f->mask; val = f->mask; break; + case BCM63268_NOREG: + /*Do nothing, leave registers as default*/ + break; default: WARN_ON(1); return -EINVAL;
There is no guarantee that the bootloader will leave the pin configuration in a known default state, so pinctrl needs to be explicitly set in some cases. This patch adds a gpio function for drivers that need it, i.e. gpio-leds. Signed-off-by: Kyle Hendry <kylehendrydev@gmail.com> --- drivers/pinctrl/bcm/pinctrl-bcm63268.c | 68 ++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)