Skip to contentSkip to conversation

clk: sophgo: cv1800: set mux parent in bypass_mux_set_parent()

PATCH In review Phuong Nguyen 2 participants 3 messages Nov 20 – Nov 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: sophgo: cv1800: set mux parent in bypass_mux_set_parent()

In bypass_mux_set_parent(), when index > 0, clearing the bypass bit switches the clock to the mux path without updating the mux selector. As a result, the hardware mux remains at parent 0 instead of selecting the requested parent.

Call mux_set_parent(hw, index - 1) before clearing the bypass bit to configure the mux selector before switching to the mux path.

Fixes 80fd61ec4612 ("clk: sophgo: Add clock support for CV1800 SoC")
---
 drivers/clk/sophgo/clk-cv18xx-ip.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/clk/sophgo/clk-cv18xx-ip.c +5 -0
index e936e3154003..34062ad7f2aa 100644
@@ -588,10 +588,15 @@ static u8 bypass_mux_get_parent(struct clk_hw *hw)
 static int bypass_mux_set_parent(struct clk_hw *hw, u8 index)
 {
 	struct cv1800_clk_bypass_mux *mux = hw_to_cv1800_clk_bypass_mux(hw);
+	int ret;
 
 	if (index == 0)
 		return cv1800_clk_setbit(&mux->mux.common, &mux->bypass);
 
+	ret = mux_set_parent(hw, index - 1);
+	if (ret)
+		return ret;
+
 	return cv1800_clk_clearbit(&mux->mux.common, &mux->bypass);
 }
 
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Phuong Nguyen

In bypass_mux_set_parent(), when index > 0, clearing the bypass bit switches the clock to the mux path without updating the mux selector. As a result, the hardware mux remains at parent 0 instead of selecting the requested parent.

Call mux_set_parent(hw, index - 1) before clearing the bypass bit to configure the mux selector before switching to the mux path.

[...]

Signature · 1 line
Jerome
#2 lore raw
In reply to Phuong Nguyen

Applied to local tree (clk-sophgo), thanks!

[1/1] clk: sophgo: cv1800: set mux parent in bypass_mux_set_parent()

      commit: 2c6c86e016e6b4394c4de23891423cfe65ba8d43

Best regards,
--
Jerome