linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabien DESSENNE <fabien.dessenne@foss.st.com>
To: <chf.fritz@googlemail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: <linux-gpio@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] Revert "pinctrl: stm32: fix the reported number of GPIO lines per bank"
Date: Tue, 14 Dec 2021 15:17:47 +0100	[thread overview]
Message-ID: <46f07510-b6aa-4619-9c54-048464bfbaf3@foss.st.com> (raw)
In-Reply-To: <a5b8e3ea13de0b2976bb9622dd410dd110f3f66c.camel@googlemail.com>

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;
> 

  reply	other threads:[~2021-12-14 14:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-12-15  1:30   ` Christoph Fritz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46f07510-b6aa-4619-9c54-048464bfbaf3@foss.st.com \
    --to=fabien.dessenne@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=chf.fritz@googlemail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).