public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: chiffathefox <chiffathefoxx@gmail.com>
To: Marek Vasut <marex@denx.de>
Cc: chiffathefox <chiffathefoxx@gmail.com>,
	Andrew Goodbody <andrew.goodbody@linaro.org>,
	Christian Marangi <ansuelsmth@gmail.com>,
	Kaustabh Chakraborty <kauschluss@disroot.org>,
	Lukasz Majewski <lukma@denx.de>,
	Maksim Kiselev <bigunclemax@gmail.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Tom Rini <trini@konsulko.com>, Ye Li <ye.li@nxp.com>,
	u-boot@lists.denx.de
Subject: [PATCH 1/2] clk: clk_resolve_parent_clk(): resolve external clocks by id
Date: Thu, 15 Jan 2026 05:11:13 +0200	[thread overview]
Message-ID: <20260115031114.220888-2-chiffathefoxx@gmail.com> (raw)
In-Reply-To: <20260115031114.220888-1-chiffathefoxx@gmail.com>

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@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@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)
-- 
2.34.1


  reply	other threads:[~2026-01-15  4:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15  3:11 [PATCH 0/2] Improvements to the recent clock rework by marex chiffathefox
2026-01-15  3:11 ` chiffathefox [this message]
2026-01-17  1:38   ` [PATCH 1/2] clk: clk_resolve_parent_clk(): resolve external clocks by id Marek Vasut
2026-01-19 16:59   ` Kaustabh Chakraborty
2026-01-15  3:11 ` [PATCH 2/2] clk: exynos: do not reparent requested clock chiffathefox
2026-01-19 17:00   ` Kaustabh Chakraborty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260115031114.220888-2-chiffathefoxx@gmail.com \
    --to=chiffathefoxx@gmail.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=ansuelsmth@gmail.com \
    --cc=bigunclemax@gmail.com \
    --cc=kauschluss@disroot.org \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=miquel.raynal@bootlin.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=ye.li@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox