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 2/2] clk: versaclock: Fix internal crystal clock
Date: Tue,  6 Jan 2026 14:53:22 -0500	[thread overview]
Message-ID: <20260106195322.657150-3-sean.anderson@linux.dev> (raw)
In-Reply-To: <20260106195322.657150-1-sean.anderson@linux.dev>

When pin_xin does not exist and the chip supports an internal crystal,
we must create it. Do so, and don't try to enable an error pointer.

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

 drivers/clk/clk_versaclock.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk_versaclock.c b/drivers/clk/clk_versaclock.c
index 7a1052a1be7..be01f34ceec 100644
--- a/drivers/clk/clk_versaclock.c
+++ b/drivers/clk/clk_versaclock.c
@@ -889,23 +889,22 @@ int versaclock_probe(struct udevice *dev)
 
 	vc5->chip_info = chip;
 	vc5->pin_xin = devm_clk_get(dev, "xin");
-
-	if (IS_ERR(vc5->pin_xin))
-		dev_dbg(dev, "failed to get xin clock\n");
-
-	ret = clk_enable(vc5->pin_xin);
-	if (ret)
-		dev_dbg(dev, "failed to enable XIN clock\n");
-
 	vc5->pin_clkin = devm_clk_get(dev, "clkin");
 
 	/* Register clock input mux */
 	if (!IS_ERR(vc5->pin_xin)) {
+		ret = clk_enable(vc5->pin_xin);
+		if (ret)
+			dev_dbg(dev, "failed to enable XIN clock\n");
 		vc5->clk_mux_ins |= VC5_MUX_IN_XIN;
 	} else if (vc5->chip_info->flags & VC5_HAS_INTERNAL_XTAL) {
+		vc5->pin_xin = clk_register_fixed_rate(NULL, "internal-xtal",
+						       25000000);
 		if (IS_ERR(vc5->pin_xin))
 			return PTR_ERR(vc5->pin_xin);
 		vc5->clk_mux_ins |= VC5_MUX_IN_XIN;
+	} else {
+		return PTR_ERR(vc5->pin_xin);
 	}
 
 	mux_name = versaclock_get_name(dev->name, "mux", -1);
-- 
2.35.1.1320.gc452695387.dirty


      parent 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 ` [PATCH 1/2] clk: versaclock: Fix clk_get_rate Sean Anderson
2026-01-06 19:53 ` Sean Anderson [this message]

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-3-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