Re: [RFC PATCH] pinctrl: renesas: rcar: don't enforce GPIO if already muxed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Wolfram,

On Fri, Dec 10, 2021 at 12:32 PM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> For Renesas PFCs not setting .strict, we can snoop GPIOs which are
> already muxed to some other function. To actually make use of that, we
> shouldn't mux them back to GPIO if they have been already muxed to
> something.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

Thanks for your patch!

> ---
>
> Not sure if this is a proper solution, but at least this is a
> proof-of-concept. It makes the sloppy GPIO analyzer work by assigning it
> GPIOs which are already muxed to, say, I2C or PWM. I didn't see any
> side-effects, but there may be some I missed. Tested on a Salvator-XS
> with R-Car M3-N where the only occasions of MUX+GPIO at the same time
> were the logic analyzer. AFAIU if '.strict' is set, the request will be
> rejected at higher levels, so on those systems should be no harm.
>
>  drivers/pinctrl/renesas/pinctrl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/renesas/pinctrl.c b/drivers/pinctrl/renesas/pinctrl.c
> index f3eecb20c086..8d4541ac43a9 100644
> --- a/drivers/pinctrl/renesas/pinctrl.c
> +++ b/drivers/pinctrl/renesas/pinctrl.c
> @@ -397,7 +397,7 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
>
>         spin_lock_irqsave(&pfc->lock, flags);
>
> -       if (!pfc->gpio) {
> +       if (!pfc->gpio && !cfg->mux_mark) {
>                 /* If GPIOs are handled externally the pin mux type needs to be
>                  * set to GPIO here.
>                  */

I can confirm this works fine to get the sloppy GPIO analyzer going.
I tested it on koelsch (R-Car M2-W), with additional debug prints
to see the full impact on PFC register configuration, and everything
looked fine.  I also gave it a run on the variety of Renesas hardware
I have access to, and there seem to be no ill effects.

Hence I think it is safe to queue in renesas-pinctrl-for-v5.18.
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

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



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux