Skip to contentSkip to conversation

clk: Fix clk_set_parent() regression

PATCH In review Jonas Karlman 2 participants 2 messages May 10, 2025 – May 12, 2025 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 clk: Fix clk_set_parent() regression

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")

---
Changes in v2:
- Fix ENOSYS typo in commit message

This fixes a regression introduced in v2025.07-rc1 that stop assigned-clock-parents being applied, affecting network and video related clocks on Rockchip platform.

---
 drivers/clk/clk-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-uclass.c +1 -1
index bc4d76277cd9..2167cd5ad0fe 100644
@@ -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;
 	}
Signature · 1 line
2.49.0
#1 lore raw
Quoted 8 lines · Jonas Karlman

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).

[...]

Applied to u-boot/master, thanks!

[1/1] clk: Fix clk_set_parent() regression

      commit: 128d997a8772cc174f38d529d8b25f90b3aa8ad8
Signature · 1 line
Tom