mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
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>
This commit is contained in:
parent
ccf707ca74
commit
f9fb67bc77
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user