Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: fde35c9c7db5732c ("clk: renesas: cpg-mssr: Add R7S9210 support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20200507074713.30113-1-geert+renesas@glider.be

+5 -3
+5 -3
drivers/clk/renesas/renesas-cpg-mssr.c
··· 818 818 /* Save module registers with bits under our control */ 819 819 for (reg = 0; reg < ARRAY_SIZE(priv->smstpcr_saved); reg++) { 820 820 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)) : 822 823 readl(priv->base + SMSTPCR(reg)); 823 824 } 824 825 ··· 879 878 } 880 879 881 880 if (!i) 882 - dev_warn(dev, "Failed to enable SMSTP %p[0x%x]\n", 883 - priv->base + SMSTPCR(reg), oldval & mask); 881 + dev_warn(dev, "Failed to enable %s%u[0x%x]\n", 882 + priv->stbyctrl ? "STB" : "SMSTP", reg, 883 + oldval & mask); 884 884 } 885 885 886 886 return 0;