public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@linux.dev>
To: Tom Rini <trini@konsulko.com>, Adam Ford <aford173@gmail.com>,
	u-boot@lists.denx.de
Cc: Andrew Goodbody <andrew.goodbody@linaro.org>,
	Lukasz Majewski <lukma@denx.de>,
	Sean Anderson <sean.anderson@linux.dev>
Subject: [PATCH 1/2] clk: versaclock: Fix clk_get_rate
Date: Tue,  6 Jan 2026 14:53:21 -0500	[thread overview]
Message-ID: <20260106195322.657150-2-sean.anderson@linux.dev> (raw)
In-Reply-To: <20260106195322.657150-1-sean.anderson@linux.dev>

Devicetree clock references point at the main versaclock device. We
must determine the parent clock manually, as it depends on the clock id.
The device parent of the versaclock will generally be an I2C bus and not
another clock.

Fixes: dcf2cee77f2 ("clk: clk_versaclock: Add support for versaclock driver")
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---

 drivers/clk/clk_versaclock.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk_versaclock.c b/drivers/clk/clk_versaclock.c
index 19a787eaf0c..7a1052a1be7 100644
--- a/drivers/clk/clk_versaclock.c
+++ b/drivers/clk/clk_versaclock.c
@@ -633,7 +633,15 @@ static unsigned long vc5_clk_out_set_rate(struct clk *hw, unsigned long rate)
 
 static unsigned long vc5_clk_out_get_rate(struct clk *hw)
 {
-	return clk_get_parent_rate(hw);
+	struct udevice *dev;
+	struct vc5_driver_data *vc;
+	struct clk *parent;
+
+	uclass_get_device_by_name(UCLASS_CLK, clk_hw_get_name(hw), &dev);
+	vc = dev_get_priv(dev);
+	parent = clk_get_parent(&vc->clk_out[hw->id].hw);
+
+	return clk_get_rate(parent);
 }
 
 static const struct clk_ops vc5_clk_out_ops = {
-- 
2.35.1.1320.gc452695387.dirty


  reply	other threads:[~2026-01-06 19:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-06 19:53 [PATCH 0/2] clk: versaclock: Fix clock parentage issues Sean Anderson
2026-01-06 19:53 ` Sean Anderson [this message]
2026-01-06 19:53 ` [PATCH 2/2] clk: versaclock: Fix internal crystal clock Sean Anderson

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=20260106195322.657150-2-sean.anderson@linux.dev \
    --to=sean.anderson@linux.dev \
    --cc=aford173@gmail.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=lukma@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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