[PATCH 1/2] clk: clk_resolve_parent_clk(): resolve external clocks by id
Marek Vasut
marek.vasut at mailbox.org
Sat Jan 17 02:38:11 CET 2026
On 1/15/26 4:11 AM, chiffathefox wrote:
> When referencing clocks in DTS registered by another driver,
> clk_resolve_parent_clk() is supposed to return the name
> of the child device that provides the requested clock.
> However, in reality, it returns the name of the parent DTB
> node (e.g. clock-controller at 1a240000). Such devices, for
> instance the exynos7870-cmu-peri driver, do not store any
> clock information in their dev->uclass_priv_ because they
> expect you to call dev->ops->get_rate with the appropriate
> clk->id. So when you try to resolve a clock that depends on
> an externally referenced clock, the resolution fails on the
> parent clock because it doesn't have a dev->uclass_priv_.
> With this change clk_resolve_parent_clk() will take an
> extra step to actually resolve the child device.
>
> Signed-off-by: chiffathefox <chiffathefoxx at gmail.com>
> ---
>
> drivers/clk/clk-uclass.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index 0584429bed6..bea45fc396f 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -430,6 +430,7 @@ clk_resolve_parent_clk(struct udevice *dev, const char *name)
> {
> struct udevice *parent;
> struct clk clk;
> + struct clk *c;
> int ret;
>
> ret = uclass_get_device_by_name(UCLASS_CLK, name, &parent);
> @@ -440,7 +441,11 @@ clk_resolve_parent_clk(struct udevice *dev, const char *name)
> if (!clk.dev)
> return name;
>
> - return clk.dev->name;
> + ret = clk_get_by_id(clk.id, &c);
> + if (ret)
> + return name;
> +
> + return c->dev->name;
> }
>
> int clk_release_all(struct clk *clk, unsigned int count)
The issue description looks very similar to what this commit fixes:
0e9055b1488f ("clk: scmi: Fix priv initialization in scmi_clk_gate()")
Is this related ?
Can you share an example / test which triggers the problem ? (ideally,
use sandbox or sandbox64, that would make it reproducible for others too)
Thank you
+CC Peng/Patrice.
More information about the U-Boot
mailing list