Currently U-Boot clk framework mandates the sequence of registering clks to begin from root, and then its children. This is an addtional requirement that doesn't exist in Linux kernel, which makes clk driver porting more difficult.
Let's handle this entirely in clk framework and give driver the freedom to register clocks in any order. This is done by assigning the parent "lazily". It will cache the parent name in the core clk struct and try to refresh it when clk consumers call clk_get_parent(). It's transparent to clk consumers as long as they only use APIs provided by clk framework. I've ran `ut dm clk*` and verified these commits does not break any existing testcases. Though no new testcase is added because I think existing testcases already test the logic very well. Signed-off-by: Yang Xiwen <[email protected]> --- Yang Xiwen (3): drivers: core: device: set new parent when old parent is NULL clk: allow assigning parent lazily clk: sandbox: reverse the order to register clk i2c_root and i2c drivers/clk/clk-uclass.c | 47 +++++++++++++++++++++++++++++++------------ drivers/clk/clk.c | 14 +++++++++++-- drivers/clk/clk_sandbox_ccf.c | 6 +++--- drivers/core/device.c | 5 +++++ include/clk.h | 2 ++ 5 files changed, 56 insertions(+), 18 deletions(-) --- base-commit: 721eecd9cbf2cc59c5230abd37d02d4a02f75cc7 change-id: 20250621-clk-reparent-89d75f6a8e09 Best regards, -- Yang Xiwen <[email protected]>

