Re: [PATCH v3] pinctrl: renesas: rzg2l: Drop the unnecessary pin configurations
From: Geert Uytterhoeven
Date: Tue Sep 30 2025 - 06:24:54 EST
Hi Biju,
On Tue, 9 Sept 2025 at 12:42, Biju <biju.das.au@xxxxxxxxx> wrote:
> From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
>
> There is no need to reconfigure the pin if the pin's configuration values
> are same as the reset values. E.g.: PS0 pin configuration for NMI function
> is PMC = 1 and PFC = 0 and is same as that of reset values. Currently the
> code is first setting it to GPIO HI-Z state and then again reconfiguring
> to NMI function leading to spurious IRQ. Drop the unnecessary pin
> configurations from the driver.
>
> Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -541,9 +541,16 @@ static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl,
> u8 pin, u8 off, u8 func)
> {
> unsigned long flags;
> - u32 reg;
> + u32 reg, pfc;
>
> + /* Switching to GPIO is not required if reset value is same as func */
> + reg = readb(pctrl->base + PMC(off));
I am updating the commit to move this assignment inside the spinlock
below.
> spin_lock_irqsave(&pctrl->lock, flags);
> + pfc = readl(pctrl->base + PFC(off));
> + if ((reg & BIT(pin)) && (((pfc >> (pin * 4)) & PFC_MASK) == func)) {
> + spin_unlock_irqrestore(&pctrl->lock, flags);
> + return;
> + }
To ease backporting "[PATCH v2] pinctrl: renesas: rzg2l: Fix ISEL
restore on resume"[1], I am rebasing this commit on top of the latter.
>
> /* Set pin to 'Non-use (Hi-Z input protection)' */
> reg = readw(pctrl->base + PM(off));
[1] https://lore.kernel.org/20250912095308.3603704-1-claudiu.beznea.uj@xxxxxxxxxxxxxx
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds