Skip to content

Commit bf497e7

Browse files
bijudasgeertu
authored andcommitted
clk: renesas: rzg2l: Re-enable critical module clocks during resume
After a suspend/resume cycle, critical module clocks (CLK_IS_CRITICAL) may be left disabled as there is no owning driver to restore them, unlike regular clocks. Add rzg2l_mod_enable_crit_clock_init_mstop() which walks all module clocks on resume, re-enables any critical clock found disabled, and then restores the MSTOP state for clocks that have one via the existing helper. This replaces the direct call to rzg2l_mod_clock_init_mstop() in rzg2l_cpg_resume(), preserving the correct clock-before-MSTOP restore ordering. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://patch.msgid.link/20260324114329.268249-7-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent fa3e973 commit bf497e7

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

drivers/clk/renesas/rzg2l-cpg.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,15 +1599,30 @@ static void rzg2l_mod_clock_init_mstop_helper(struct rzg2l_cpg_priv *priv,
15991599
{
16001600
/*
16011601
* Out of reset all modules are enabled. Set module state in case
1602-
* associated clocks are disabled at probe. Otherwise module is in
1603-
* invalid HW state.
1602+
* associated clocks are disabled at probe/resume. Otherwise module
1603+
* is in invalid HW state.
16041604
*/
16051605
scoped_guard(spinlock_irqsave, &priv->rmw_lock) {
16061606
if (!rzg2l_mod_clock_is_enabled(&clk->hw))
16071607
rzg2l_mod_clock_module_set_state(clk, true);
16081608
}
16091609
}
16101610

1611+
static void rzg2l_mod_enable_crit_clock_init_mstop(struct rzg2l_cpg_priv *priv)
1612+
{
1613+
struct mod_clock *clk;
1614+
struct clk_hw *hw;
1615+
1616+
for_each_mod_clock(clk, hw, priv) {
1617+
if ((clk_hw_get_flags(&clk->hw) & CLK_IS_CRITICAL) &&
1618+
(!rzg2l_mod_clock_is_enabled(&clk->hw)))
1619+
rzg2l_mod_clock_endisable_helper(&clk->hw, true, false);
1620+
1621+
if (clk->mstop)
1622+
rzg2l_mod_clock_init_mstop_helper(priv, clk);
1623+
}
1624+
}
1625+
16111626
static void rzg2l_mod_clock_init_mstop(struct rzg2l_cpg_priv *priv)
16121627
{
16131628
struct mod_clock *clk;
@@ -2103,7 +2118,7 @@ static int rzg2l_cpg_resume(struct device *dev)
21032118
if (ret)
21042119
return ret;
21052120

2106-
rzg2l_mod_clock_init_mstop(priv);
2121+
rzg2l_mod_enable_crit_clock_init_mstop(priv);
21072122

21082123
return 0;
21092124
}

0 commit comments

Comments
 (0)