Re: [PATCH] pinctrl: renesas: rza1: Check pin state before configuring

From: Wolfram Sang
Date: Wed Jul 23 2025 - 03:02:31 EST


Hi Magnus,

On Sat, Jul 12, 2025 at 05:25:38PM +0200, Magnus Damm wrote:
> From: Magnus Damm <damm@xxxxxxxxxxxxx>
>
> Add code to the RZ/A1 pinctrl driver to check the state of the pin before
> writing any registers. As it is without this patch, resetting the pin state
> for every pin regardless of preious state might negatively be affecting
> certain shared pins like for instance address and data bus pins.
>
> Signed-off-by: Magnus Damm <damm@xxxxxxxxxxxxx>
> ---
>
> This makes the following patch work with Linux:
> [PATCH] Update r7s72100 Genmai DTS to include NOR Flash pinctrl

True that.

Tested-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

I can't say if it is feasible to have this code in the driver. I leave
this for Geert or the RZ team. But I can say it works with the above DTS
patch.

> +static int rza1_pin_mux_needs_update(struct rza1_pinctrl *rza1_pctl,
> + struct rza1_mux_conf *mux_conf)

Minor: I'd make this a bool, though...

> + if (!!(mux_flags & MUX_FLAGS_BIDIR) !=
> + !!rza1_get_bit(port, RZA1_PBDC_REG, pin))
> + return 1;

... and treturn true / false.

Happy hacking,

Wolfram

Attachment: signature.asc
Description: PGP signature