Commit 3f7a4d08 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

clk: renesas: rcar-gen3: Restore R clock during resume

On R-Car Gen3 systems, PSCI system suspend powers down the SoC, losing
clock configuration.  Register a notifier to save/restore the RCKCR
register during system suspend/resume.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Tested-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
parent 9f55b17f
...@@ -373,18 +373,27 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, ...@@ -373,18 +373,27 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
case CLK_TYPE_GEN3_R: case CLK_TYPE_GEN3_R:
if (cpg_quirks & RCKCR_CKSEL) { if (cpg_quirks & RCKCR_CKSEL) {
struct cpg_simple_notifier *csn;
csn = kzalloc(sizeof(*csn), GFP_KERNEL);
if (!csn)
return ERR_PTR(-ENOMEM);
csn->reg = base + CPG_RCKCR;
/* /*
* RINT is default. * RINT is default.
* Only if EXTALR is populated, we switch to it. * Only if EXTALR is populated, we switch to it.
*/ */
value = readl(base + CPG_RCKCR) & 0x3f; value = readl(csn->reg) & 0x3f;
if (clk_get_rate(clks[cpg_clk_extalr])) { if (clk_get_rate(clks[cpg_clk_extalr])) {
parent = clks[cpg_clk_extalr]; parent = clks[cpg_clk_extalr];
value |= BIT(15); value |= BIT(15);
} }
writel(value, base + CPG_RCKCR); writel(value, csn->reg);
cpg_simple_notifier_register(notifiers, csn);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment