Skip to content

Commit ef224dd

Browse files
prabhakarladgeertu
authored andcommitted
clk: renesas: rzv2h: Use both CLK_ON and CLK_MON bits for clock state validation
Update the clock enable/disable logic to follow the latest hardware manual's guidelines, ensuring that both CLK_ON and CLK_MON bits are used to confirm the clock state. According to the manual, enabling a clock requires setting the CPG_CLK_ON bit and verifying the clock has started using the CPG_CLK_MON bit. Similarly, disabling a clock requires clearing the CPG_CLK_ON bit and confirming the clock has stopped via the CPG_CLK_MON bit. Modify `rzv2h_mod_clock_is_enabled()` to check CLK_MON first and then validate CLK_ON for a more accurate clock status evaluation. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/20250407165202.197570-6-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent e6c2b4e commit ef224dd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/clk/renesas/rzv2h-cpg.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,14 @@ static int rzv2h_mod_clock_is_enabled(struct clk_hw *hw)
573573
if (clock->mon_index >= 0) {
574574
offset = GET_CLK_MON_OFFSET(clock->mon_index);
575575
bitmask = BIT(clock->mon_bit);
576-
} else {
577-
offset = GET_CLK_ON_OFFSET(clock->on_index);
578-
bitmask = BIT(clock->on_bit);
576+
577+
if (!(readl(priv->base + offset) & bitmask))
578+
return 0;
579579
}
580580

581+
offset = GET_CLK_ON_OFFSET(clock->on_index);
582+
bitmask = BIT(clock->on_bit);
583+
581584
return readl(priv->base + offset) & bitmask;
582585
}
583586

0 commit comments

Comments
 (0)