* [PATCH] Revert "pinctrl: stm32: fix the reported number of GPIO lines per bank"
@ 2021-12-11 18:53 Christoph Fritz
2021-12-14 14:17 ` Fabien DESSENNE
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Fritz @ 2021-12-11 18:53 UTC (permalink / raw)
To: Alexandre Torgue, Maxime Coquelin, Linus Walleij
Cc: Fabien Dessenne, linux-gpio, linux-stm32, linux-arm-kernel
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>;
};
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
drivers/pinctrl/stm32/pinctrl-stm32.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 24764ebcc936..73f49c596cef 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -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;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "pinctrl: stm32: fix the reported number of GPIO lines per bank"
2021-12-11 18:53 [PATCH] Revert "pinctrl: stm32: fix the reported number of GPIO lines per bank" Christoph Fritz
@ 2021-12-14 14:17 ` Fabien DESSENNE
2021-12-15 1:30 ` Christoph Fritz
0 siblings, 1 reply; 3+ messages in thread
From: Fabien DESSENNE @ 2021-12-14 14:17 UTC (permalink / raw)
To: chf.fritz, Alexandre Torgue, Maxime Coquelin, Linus Walleij
Cc: linux-gpio, linux-stm32, linux-arm-kernel
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
On 11/12/2021 19:53, Christoph Fritz wrote:
> 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>;
> };
>
> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
> ---
> drivers/pinctrl/stm32/pinctrl-stm32.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index 24764ebcc936..73f49c596cef 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "pinctrl: stm32: fix the reported number of GPIO lines per bank"
2021-12-14 14:17 ` Fabien DESSENNE
@ 2021-12-15 1:30 ` Christoph Fritz
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Fritz @ 2021-12-15 1:30 UTC (permalink / raw)
To: Fabien Dessenne, Alexandre Torgue, Maxime Coquelin, Linus Walleij
Cc: linux-gpio, linux-stm32, linux-arm-kernel
On Tue, 2021-12-14 at 15:17 +0100, Fabien DESSENNE wrote:
> 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.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-15 1:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-11 18:53 [PATCH] Revert "pinctrl: stm32: fix the reported number of GPIO lines per bank" Christoph Fritz
2021-12-14 14:17 ` Fabien DESSENNE
2021-12-15 1:30 ` Christoph Fritz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).