From 7378e5e3e1ab8a5f52b5007c1f0f2e66cc52ed1a Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 22 Dec 2022 15:11:57 +0100 Subject: clk: mux: forward round/set rate to parent if CLK_SET_RATE_PARENT 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 Link: https://lore.barebox.org/20221222141201.3087192-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/clk/clk-mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/clk/clk-mux.c') diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 8463f1ee82..a92d94cdc9 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); -- cgit v1.2.3