Revert "pinctrl: stm32: fix the reported number of GPIO lines per bank"
Subsystems (4)
PATCH 1/1 Revert "pinctrl: stm32: fix the reported number of GPIO lines per bank"
This reverts commit 67e2996f72c71ebe4ac2fcbcf77e54479bb7aa11 because it breaks pin usage for gpio-nodes with an offset in gpio-ranges (like &gpiof from stm32mp15xxab-pinctrl.dtsi).
For example the following reset gpio of a wifi module on a stm32mp153c board works again after applying this revert patch:
wifi_pwrseq: wifi-pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&gpiof 9 GPIO_ACTIVE_LOW>;
};--- drivers/pinctrl/stm32/pinctrl-stm32.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +2 -7
@@ -1225,7 +1225,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,struct device *dev = pctl->dev;struct resource res;int npins =STM32_GPIO_PINS_PER_BANK ; -int bank_nr, err, i =0 ; +int bank_nr, err;if (!IS_ERR (bank->rstc))reset_control_deassert (bank->rstc);
@@ -1247,14 +1247,9 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,of_property_read_string (np,"st,bank-name" , &bank->gpio_chip.label); -if (!of_parse_phandle_with_fixed_args (np,"gpio-ranges" ,3 , i, &args)) { +if (!of_parse_phandle_with_fixed_args (np,"gpio-ranges" ,3 ,0 , &args)) { bank_nr = args.args[1 ] /STM32_GPIO_PINS_PER_BANK ; bank->gpio_chip.base = args.args[1 ]; - - npins = args.args[2 ]; -while (!of_parse_phandle_with_fixed_args (np,"gpio-ranges" ,3 , - ++i, &args)) - npins += args.args[2 ]; }else { bank_nr = pctl->nbanks; bank->gpio_chip.base = bank_nr *STM32_GPIO_PINS_PER_BANK ;
Signature · 1 line
2.30.2
Hi Christoph
I have been able to reproduce the issue you reported.
Instead of reverting the guilty patch, I am working to fix it.
I am currently testing a candidate patch, and will share it in the coming days. BR
Fabien
Quoted 47 lines · Christoph Fritz
This reverts commit
67e2996f72c71ebe4ac2fcbcf77e54479bb7aa11because it breaks pin usage for gpio-nodes with an offset in gpio-ranges (like &gpiof fromstm32mp15xxab-pinctrl.dtsi).For example the following reset gpio of a wifi module on a stm32mp153c board works again after applying this revert patch:
wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&gpiof 9 GPIO_ACTIVE_LOW>; };Signed-off-by Christoph Fritz <[email protected]>--- drivers/pinctrl/stm32/pinctrl-stm32.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)drivers/pinctrl/stm32/pinctrl-stm32.c +2
-7@@ -1225,7 +1225,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,struct device *dev = pctl->dev;struct resource res;int npins =STM32_GPIO_PINS_PER_BANK ; -int bank_nr, err, i =0 ; +int bank_nr, err;if (!IS_ERR (bank->rstc))reset_control_deassert (bank->rstc);@@ -1247,14 +1247,9 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,of_property_read_string (np,"st,bank-name" , &bank->gpio_chip.label); -if (!of_parse_phandle_with_fixed_args (np,"gpio-ranges" ,3 , i, &args)) { +if (!of_parse_phandle_with_fixed_args (np,"gpio-ranges" ,3 ,0 , &args)) { bank_nr = args.args[1 ] /STM32_GPIO_PINS_PER_BANK ; bank->gpio_chip.base = args.args[1 ]; - - npins = args.args[2 ]; -while (!of_parse_phandle_with_fixed_args (np,"gpio-ranges" ,3 , - ++i, &args)) - npins += args.args[2 ]; }else { bank_nr = pctl->nbanks; bank->gpio_chip.base = bank_nr *STM32_GPIO_PINS_PER_BANK ;
Quoted 4 lines · Fabien DESSENNE
I have been able to reproduce the issue you reported. Instead of reverting the guilty patch, I am working to fix it. I am currently testing a candidate patch, and will share it in the coming days.
FYI, the regression was also merged into most of the stable and longterm stable releases: 5.15, 5.10, 5.4 and 4.19.