aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/clk/renesas
diff options
context:
space:
mode:
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>2023-09-29 08:38:51 +0300
committerGeert Uytterhoeven <geert+renesas@glider.be>2023-10-05 13:45:16 +0200
commitbf51d3b2d048c312764a55d91d67a85ee5535e31 (patch)
treeab610c3377324ad403ac666c300584dddfedb61c /drivers/clk/renesas
parentclk: renesas: rzg2l: Lock around writes to mux register (diff)
downloadwireguard-linux-bf51d3b2d048c312764a55d91d67a85ee5535e31.tar.xz
wireguard-linux-bf51d3b2d048c312764a55d91d67a85ee5535e31.zip
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: eaff33646f4cb ("clk: renesas: rzg2l: Add SDHI clk mux support") Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20230929053915.1530607-5-claudiu.beznea@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Diffstat (limited to 'drivers/clk/renesas')
-rw-r--r--drivers/clk/renesas/rzg2l-cpg.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c
index 0679f2c7649e..6f50f0329ecf 100644
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -238,14 +238,8 @@ static u8 rzg2l_cpg_sd_clk_mux_get_parent(struct clk_hw *hw)
val >>= GET_SHIFT(hwdata->conf);
val &= GENMASK(GET_WIDTH(hwdata->conf) - 1, 0);
- if (val) {
- val--;
- } else {
- /* Prohibited clk source, change it to 533 MHz(reset value) */
- rzg2l_cpg_sd_clk_mux_set_parent(hw, 0);
- }
- return val;
+ return val ? val - 1 : 0;
}
static const struct clk_ops rzg2l_cpg_sd_clk_mux_ops = {