[PATCH 2/6] clk: mux: forward round/set rate to parent if CLK_SET_RATE_PARENT
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Dec 22 06:11:57 PST 2022
Prior to v2021.07.0, clk mux round/set rate ops were forwarded to
clk_parent_round_rate/clk_parent_set_rate, which would change nothing
unless CLK_SET_RATE_PARENT is set.
Since that release, barebox will instead try to reparent the mux
to arrive at a closer rate, unless CLK_SET_RATE_NO_REPARENT is
specified.
The correct behavior would have been for CLK_SET_RATE_NO_REPARENT
to fall back to the old behavior when NO_REPARENT is specified,
but instead CLK_SET_RATE_PARENT ended up ignored.
Fix this by calling clk_parent_round_rate/clk_parent_set_rate once again
in that case. When CLK_SET_RATE_PARENT is not set, they are equivalent
to the current open-coded behavior.
Fixes: d07c34e116cd ("clk: clk-mux: implement setting rate by reparenting")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/clk/clk-mux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index ad82d97ea88c..1d94e0916732 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -118,7 +118,7 @@ long clk_mux_round_rate(struct clk_hw *hw, unsigned long rate,
struct clk *bestparent;
if (clk->flags & CLK_SET_RATE_NO_REPARENT)
- return *prate;
+ return clk_parent_round_rate(hw, rate, prate);
bestparent = clk_mux_best_parent(clk, rate, &rrate);
@@ -135,7 +135,7 @@ static int clk_mux_set_rate(struct clk_hw *hw, unsigned long rate,
int ret;
if (clk->flags & CLK_SET_RATE_NO_REPARENT)
- return 0;
+ return clk_parent_set_rate(hw, rate, parent_rate);
parent = clk_mux_best_parent(clk, rate, &rrate);
--
2.30.2
More information about the barebox
mailing list