clk: Do not complain about correctly set read-only muxes when assigning clock parents from device tree
PATCH 1/2 clk: Do not complain about correctly set read-only muxes when assigning clock parents from device tree
Assigning a clock parent to a mux with the CLK_MUX_READ_ONLY flag causes an error "clk: failed to reparent read_only_mux to already_set_parent: -38" even if the hardware is already set to the correct parent clock.
This patch avoids the error message by checking whether the correct parent is already set before calling clk_set_parent. This allows to use the assigned-clock-parents device tree binding for clock muxes that are not allowed to be changed anymore at the time of_clk_set_defaults is called.
--- drivers/clk/clk-conf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/clk-conf.c +2 -1
@@ -62,7 +62,8 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier) goto err; } - rc =clk_set_parent (clk, pclk); +if (pclk !=__clk_get_parent (clk)) + rc =clk_set_parent (clk, pclk);if (rc <0 )pr_err ("clk: failed to reparent %s to %s: %d\n" ,__clk_get_name (clk),__clk_get_name (pclk), rc);
Signature · 1 line
2.1.3
PATCH 1/2 clk: Do not complain about correctly set read-only muxes when assigning clock parents from device tree
Quoted 10 lines · Philipp Zabel
Assigning a clock parent to a mux with the
CLK_MUX_READ_ONLYflag causes an error "clk: failed to reparentread_only_muxtoalready_set_parent: -38" even if the hardware is already set to the correct parent clock.This patch avoids the error message by checking whether the correct parent is already set before calling
clk_set_parent. This allows to use the assigned-clock-parents device tree binding for clock muxes that are not allowed to be changed anymore at the timeof_clk_set_defaultsis called.Signed-off-by Philipp Zabel <[email protected]>
Philipp,
The patch should be sent to Mike Turquette <[email protected]>. The patch itself makes sense to me, so
Shawn
Quoted 21 lines
--- drivers/clk/clk-conf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/clk/clk-conf.c +2
-1@@ -62,7 +62,8 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier) goto err; } - rc =clk_set_parent (clk, pclk); +if (pclk !=__clk_get_parent (clk)) + rc =clk_set_parent (clk, pclk);if (rc <0 )pr_err ("clk: failed to reparent %s to %s: %d\n" ,__clk_get_name (clk),__clk_get_name (pclk), rc);Signature · 1 line
2.1.3
PATCH 1/2 clk: Do not complain about correctly set read-only muxes when assigning clock parents from device tree
In reply to Philipp ZabelHello Philipp,
Quoted 5 lines · Philipp Zabel
drivers/clk/clk-conf.c +0
-0
drivers/clk/clk-conf.c static int __set_clk_parents(struct device_node *node, bool clk_supplier) · line 69
Quoted 9 lines
drivers/clk/clk-conf.c +2
-1@@ -62,7 +62,8 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier) goto err; } - rc =clk_set_parent (clk, pclk); +if (pclk !=__clk_get_parent (clk)) + rc =clk_set_parent (clk, pclk);if (rc <0 )pr_err ("clk: failed to reparent %s to %s: %d\n" ,__clk_get_name (clk),__clk_get_name (pclk), rc);
I'd move the check for rc < 0 into the body of the if you introduced. i.e.:
if (pclk != __clk_get_parent(clk)) {
rc = clk_set_parent(clk, pclk);
if (rc < 0)
...
}Semantically it doesn't make a difference because rc is zero when this code is reached, but it makes it a bit clearer.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |