[PATCH 2/2] clk: versaclock: Fix internal crystal clock
Sean Anderson
sean.anderson at linux.dev
Tue Jan 6 20:53:22 CET 2026
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 at 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
More information about the U-Boot
mailing list