Skip to content

Commit bf51d3b

Browse files
claudiubezneageertu
authored andcommitted
clk: renesas: rzg2l: Trust value returned by hardware
The onitial value of the CPG_PL2SDHI_DSEL bits 0..1 or 4..6 is 01b. The hardware user's manual (r01uh0914ej0130-rzg2l-rzg2lc.pdf) specifies that setting 0 is prohibited. Hence rzg2l_cpg_sd_clk_mux_get_parent() should just read CPG_PL2SDHI_DSEL, trust the value, and return the proper clock parent index based on the value read. Fixes: eaff336 ("clk: renesas: rzg2l: Add SDHI clk mux support") Signed-off-by: Claudiu Beznea <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent d2692ed commit bf51d3b

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/clk/renesas/rzg2l-cpg.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,8 @@ static u8 rzg2l_cpg_sd_clk_mux_get_parent(struct clk_hw *hw)
238238

239239
val >>= GET_SHIFT(hwdata->conf);
240240
val &= GENMASK(GET_WIDTH(hwdata->conf) - 1, 0);
241-
if (val) {
242-
val--;
243-
} else {
244-
/* Prohibited clk source, change it to 533 MHz(reset value) */
245-
rzg2l_cpg_sd_clk_mux_set_parent(hw, 0);
246-
}
247241

248-
return val;
242+
return val ? val - 1 : 0;
249243
}
250244

251245
static const struct clk_ops rzg2l_cpg_sd_clk_mux_ops = {

0 commit comments

Comments
 (0)