Skip to content

Commit ace3420

Browse files
committed
clk: renesas: cpg-mssr: Fix STBCR suspend/resume handling
On SoCs with Standby Control Registers (STBCRs) instead of Module Stop Control Registers (MSTPCRs), the suspend handler saves the wrong registers, and the resume handler prints the wrong register in an error message. Fortunately this cannot happen yet, as the suspend/resume code is used on PSCI systems only, and systems with STBCRs (RZ/A1 and RZ/A2) do not use PSCI. Still, it is better to fix this, to avoid this becoming a problem in the future. Distinguish between STBCRs and MSTPCRs where needed. Replace the useless printing of the virtual register address in the resume error message by printing the register index. Fixes: fde35c9 ("clk: renesas: cpg-mssr: Add R7S9210 support") Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent e2f022c commit ace3420

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/clk/renesas/renesas-cpg-mssr.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,8 @@ static int cpg_mssr_suspend_noirq(struct device *dev)
818818
/* Save module registers with bits under our control */
819819
for (reg = 0; reg < ARRAY_SIZE(priv->smstpcr_saved); reg++) {
820820
if (priv->smstpcr_saved[reg].mask)
821-
priv->smstpcr_saved[reg].val =
821+
priv->smstpcr_saved[reg].val = priv->stbyctrl ?
822+
readb(priv->base + STBCR(reg)) :
822823
readl(priv->base + SMSTPCR(reg));
823824
}
824825

@@ -878,8 +879,9 @@ static int cpg_mssr_resume_noirq(struct device *dev)
878879
}
879880

880881
if (!i)
881-
dev_warn(dev, "Failed to enable SMSTP %p[0x%x]\n",
882-
priv->base + SMSTPCR(reg), oldval & mask);
882+
dev_warn(dev, "Failed to enable %s%u[0x%x]\n",
883+
priv->stbyctrl ? "STB" : "SMSTP", reg,
884+
oldval & mask);
883885
}
884886

885887
return 0;

0 commit comments

Comments
 (0)