]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
clk: Fix clk_set_parent() regression
authorJonas Karlman <jonas@kwiboo.se>
Sat, 10 May 2025 15:32:01 +0000 (15:32 +0000)
committerTom Rini <trini@konsulko.com>
Mon, 12 May 2025 14:04:51 +0000 (08:04 -0600)
The commit ac30d90f3367 ("clk: Ensure the parent clocks are enabled
while reparenting") add a call to clk_enable() for the parent clock.

For clock drivers that do not implement the enable() ops, like most
Rockchip clock drivers, this now cause the set_parent() ops to never
be called when CLK_CCF=n (default for Rockchip).

clk_enable() typically return -ENOSYS when the enable() ops is not
implemented by the clock driver, with CLK_CCF=y clk_enable() instead
return 0 when the enable() ops is unimplemented.

Change to ignore -ENOSYS from the newly introduced clk_enable() call to
fix this regression and restore the old behavior of set_parent() ops
being called regardless of if enable() ops is implemented or not.

Fixes: ac30d90f3367 ("clk: Ensure the parent clocks are enabled while reparenting")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Tested-by: Dang Huynh <danct12@riseup.net>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/clk/clk-uclass.c

index bc4d76277cd9d7ecafb1d0f5763f9d3f9eed47f3..2167cd5ad0fe6482bece6c4fa79ba2f48a5bc238 100644 (file)
@@ -627,7 +627,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
                return -ENOSYS;
 
        ret = clk_enable(parent);
-       if (ret) {
+       if (ret && ret != -ENOSYS) {
                printf("Cannot enable parent %s\n", parent->dev->name);
                return ret;
        }