]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pinctrl: renesas: rzg2l: Fix save/restore of {IOLH,IEN,PUPD,SMT} registers
authorBiju Das <biju.das.jz@bp.renesas.com>
Thu, 26 Mar 2026 16:24:51 +0000 (16:24 +0000)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 26 Mar 2026 19:05:07 +0000 (20:05 +0100)
The rzg2l_pinctrl_pm_setup_regs() handles save/restore of
{IOLH,IEN,PUPD,SMT} registers during s2ram, but only for ports where all
pins share the same pincfg. Extend the code to also support ports with
variable pincfg per pin, so that {IOLH,IEN,PUPD,SMT} registers are
correctly saved and restored for all pins.

Fixes: 254203f9a94c ("pinctrl: renesas: rzg2l: Add suspend/resume support")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20260326162459.101414-1-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/pinctrl/renesas/pinctrl-rzg2l.c

index 863e779dda0285513d2b2386be100a3af3b1e844..55e35f63343c71ddefa3f18e9c6494993be92e63 100644 (file)
@@ -3012,6 +3012,13 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
                off = RZG2L_PIN_CFG_TO_PORT_OFFSET(cfg);
                pincnt = hweight8(FIELD_GET(PIN_CFG_PIN_MAP_MASK, cfg));
 
+               if (cfg & RZG2L_VARIABLE_CFG) {
+                       unsigned int pin = port * RZG2L_PINS_PER_PORT;
+
+                       for (unsigned int i = 0; i < RZG2L_PINS_PER_PORT; i++)
+                               cfg |= *(u64 *)pctrl->desc.pins[pin + i].drv_data;
+               }
+
                caps = FIELD_GET(PIN_CFG_MASK, cfg);
                has_iolh = !!(caps & (PIN_CFG_IOLH_A | PIN_CFG_IOLH_B | PIN_CFG_IOLH_C));
                has_ien = !!(caps & PIN_CFG_IEN);