summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>2026-05-13 14:53:12 +0300
committerGeert Uytterhoeven <geert+renesas@glider.be>2026-05-25 13:00:23 +0300
commitf9fb67bc77d322568bf573e81335be0e9be2a7c8 (patch)
tree8efd682f312245beffea3756d3bf85d085adcf79
parentccf707ca74cbb1d7ad0f99877518d2e3fe58611a (diff)
downloadlinux-f9fb67bc77d322568bf573e81335be0e9be2a7c8.tar.xz
pinctrl: renesas: rzt2h: Skip PFC mode configuration if already set
In rzt2h_pinctrl_set_pfc_mode(), read the PMC and PFC registers upfront and skip the pin function configuration if the pin is already in peripheral mode with the desired function. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://patch.msgid.link/20260513115312.1574367-3-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-rw-r--r--drivers/pinctrl/renesas/pinctrl-rzt2h.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pinctrl/renesas/pinctrl-rzt2h.c b/drivers/pinctrl/renesas/pinctrl-rzt2h.c
index 4b790fa72b49..eb70aee39f1a 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzt2h.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzt2h.c
@@ -191,6 +191,12 @@ static void rzt2h_pinctrl_set_pfc_mode(struct rzt2h_pinctrl *pctrl,
guard(raw_spinlock_irqsave)(&pctrl->lock);
+ reg64 = rzt2h_pinctrl_readq(pctrl, port, PFC(port));
+ /* Check if pin is already configured to the desired function */
+ if ((rzt2h_pinctrl_readb(pctrl, port, PMC(port)) & BIT(pin)) &&
+ field_get(PFC_PIN_MASK(pin), reg64) == func)
+ return;
+
/* Set pin to 'Non-use (Hi-Z input protection)' */
reg16 = rzt2h_pinctrl_readw(pctrl, port, PM(port));
reg16 &= ~PM_PIN_MASK(pin);
@@ -200,7 +206,6 @@ static void rzt2h_pinctrl_set_pfc_mode(struct rzt2h_pinctrl *pctrl,
rzt2h_pinctrl_set_gpio_en(pctrl, port, pin, true);
/* Select Pin function mode with PFC register */
- reg64 = rzt2h_pinctrl_readq(pctrl, port, PFC(port));
reg64 &= ~PFC_PIN_MASK(pin);
rzt2h_pinctrl_writeq(pctrl, port, reg64 | ((u64)func << (pin * 8)), PFC(port));