From: Stefan Eichenberger <eichest@gmail.com>
To: trini@konsulko.com, ilias.apalodimas@linaro.org,
peng.fan@nxp.com, jh80.chung@samsung.com,
tanmay.kathpalia@altera.com, sbabic@nabladev.com,
festevam@gmail.com, uboot-imx@nxp.com,
francesco.dolcini@toradex.com, lukma@nabladev.com,
dlechner@baylibre.com, msp@baylibre.com,
stefan.eichenberger@toradex.com, Max.Merchel@ew.tq-group.com,
nora.schiffer@ew.tq-group.com, primoz.fiser@norik.com,
jbx6244@gmail.com, aford173@gmail.com,
cniedermaier@dh-electronics.com
Cc: u-boot@lists.u-boot-project.org
Subject: [PATCH v1 2/7] clk: imx: pllv3: wait for the ENET PLL to lock
Date: Fri, 20 Nov 2026 12:10:08 +0100 [thread overview]
Message-ID: <20261120111037.110741-3-eichest@gmail.com> (raw)
In-Reply-To: <20261120111037.110741-1-eichest@gmail.com>
From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
The ENET PLL enable powers the PLL up and returns immediately, so a
consumer can start using the reference clock before the PLL has locked.
The legacy enable_fec_anatop_clock() polled the LOCK bit after powering
up the PLL, and Linux does the same in clk_pllv3_prepare().
Poll the LOCK bit after enabling the ENET PLL, with a 10 ms timeout.
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
---
drivers/clk/imx/clk-pllv3.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c
index 85b6a9809e8..8e67442844f 100644
--- a/drivers/clk/imx/clk-pllv3.c
+++ b/drivers/clk/imx/clk-pllv3.c
@@ -14,6 +14,7 @@
#include <clk.h>
#include "clk.h"
#include <linux/err.h>
+#include <linux/iopoll.h>
#define UBOOT_DM_CLK_IMX_PLLV3_GENERIC "imx_clk_pllv3_generic"
#define UBOOT_DM_CLK_IMX_PLLV3_SYS "imx_clk_pllv3_sys"
@@ -31,6 +32,8 @@
#define BM_PLL_LOCK (0x1 << 31)
#define BM_PLL_LOCK_V2 (0x1 << 29)
+#define PLL_LOCK_TIMEOUT_US 10000
+
struct clk_pllv3 {
struct clk clk;
void __iomem *base;
@@ -275,8 +278,22 @@ static ulong clk_pllv3_enet_get_rate(struct clk *clk)
return pll->ref_clock;
}
+static int clk_pllv3_enet_enable(struct clk *clk)
+{
+ struct clk_pllv3 *pll = to_clk_pllv3(clk);
+ u32 val;
+ int ret;
+
+ ret = clk_pllv3_generic_enable(clk);
+ if (ret)
+ return ret;
+
+ return readl_poll_timeout(pll->base, val, val & pll->lock_bit,
+ PLL_LOCK_TIMEOUT_US);
+}
+
static const struct clk_ops clk_pllv3_enet_ops = {
- .enable = clk_pllv3_generic_enable,
+ .enable = clk_pllv3_enet_enable,
.disable = clk_pllv3_generic_disable,
.get_rate = clk_pllv3_enet_get_rate,
};
--
2.56.1
next prev parent reply other threads:[~2026-11-20 13:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 11:10 [PATCH v1 0/7] colibri-imx6ull: fix the Ethernet PHY detection Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 1/7] clk: imx: imx6ul: fix the enet clock gate register Stefan Eichenberger
2026-11-20 11:10 ` Stefan Eichenberger [this message]
2026-11-20 11:10 ` [PATCH v1 3/7] clk: imx: pllv3: do not touch the ENET output gate Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 4/7] clk: imx: imx6ul: add the enet clock tree Stefan Eichenberger
2026-11-25 9:56 ` Peng Fan (OSS)
2026-11-25 17:34 ` Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 5/7] board: toradex: colibri-imx6ull: drop the static serial device Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 6/7] arm: dts: imx6ull-colibri: migrate to OF_UPSTREAM Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 7/7] board: toradex: colibri-imx6ull: enable the clock framework Stefan Eichenberger
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=20261120111037.110741-3-eichest@gmail.com \
--to=eichest@gmail.com \
--cc=Max.Merchel@ew.tq-group.com \
--cc=aford173@gmail.com \
--cc=cniedermaier@dh-electronics.com \
--cc=dlechner@baylibre.com \
--cc=festevam@gmail.com \
--cc=francesco.dolcini@toradex.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jbx6244@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=lukma@nabladev.com \
--cc=msp@baylibre.com \
--cc=nora.schiffer@ew.tq-group.com \
--cc=peng.fan@nxp.com \
--cc=primoz.fiser@norik.com \
--cc=sbabic@nabladev.com \
--cc=stefan.eichenberger@toradex.com \
--cc=tanmay.kathpalia@altera.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=uboot-imx@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