Skip to content

Commit ed4a118

Browse files
Ulrich Hechtgeertu
authored andcommitted
clk: renesas: cpg-mssr: Mark clocks as critical only if on at boot
This allows us to add the RWDT clock to the list of critical clocks without keeping it enabled needlessly if not used. Changing the semantics of crit_mod_clks in this way is safe for the current user (INTC-AP) because it is never off at boot time. Signed-off-by: Ulrich Hecht <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent d9563c9 commit ed4a118

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,6 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod,
416416
init.name = mod->name;
417417
init.ops = &cpg_mstp_clock_ops;
418418
init.flags = CLK_SET_RATE_PARENT;
419-
for (i = 0; i < info->num_crit_mod_clks; i++)
420-
if (id == info->crit_mod_clks[i]) {
421-
dev_dbg(dev, "MSTP %s setting CLK_IS_CRITICAL\n",
422-
mod->name);
423-
init.flags |= CLK_IS_CRITICAL;
424-
break;
425-
}
426-
427419
parent_name = __clk_get_name(parent);
428420
init.parent_names = &parent_name;
429421
init.num_parents = 1;
@@ -432,6 +424,15 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod,
432424
clock->priv = priv;
433425
clock->hw.init = &init;
434426

427+
for (i = 0; i < info->num_crit_mod_clks; i++)
428+
if (id == info->crit_mod_clks[i] &&
429+
cpg_mstp_clock_is_enabled(&clock->hw)) {
430+
dev_dbg(dev, "MSTP %s setting CLK_IS_CRITICAL\n",
431+
mod->name);
432+
init.flags |= CLK_IS_CRITICAL;
433+
break;
434+
}
435+
435436
clk = clk_register(NULL, &clock->hw);
436437
if (IS_ERR(clk))
437438
goto fail;

0 commit comments

Comments
 (0)