U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yalçın Can" <ylcncn@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: Lukasz Majewski <lukma@nabladev.com>,
	Kever Yang <kever.yang@rock-chips.com>,
	Quentin Schulz <u-boot@0leil.net>, Simon Glass <sjg@chromium.org>,
	Tom Rini <trini@konsulko.com>
Subject: [PATCH] clk: rockchip: rk3066: set up the PLLs in U-Boot proper without TPL
Date: Fri, 30 Oct 2026 10:37:56 +0300	[thread overview]
Message-ID: <20261030073756.165229-1-ylcncn@gmail.com> (raw)

The PLLs are set up by TPL. When U-Boot proper is started straight by the
boot ROM after a vendor DRAM init (no TPL), GPLL is still in slow mode and
the peripheral clocks run from the 24 MHz oscillator.

Also run rk3066_clk_init() in U-Boot proper when GPLL is found in slow
mode.

Tested on an MK808B (RK3066) with the vendor DRAM init and U-Boot from the
NAND ID blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Yalçın Can <ylcncn@gmail.com>
---
 drivers/clk/rockchip/clk_rk3066.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk_rk3066.c b/drivers/clk/rockchip/clk_rk3066.c
index f7dea785..d48e4818 100644
--- a/drivers/clk/rockchip/clk_rk3066.c
+++ b/drivers/clk/rockchip/clk_rk3066.c
@@ -657,7 +657,13 @@ static int rk3066_clk_probe(struct udevice *dev)
 	priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]);
 #endif
 
-	if (IS_ENABLED(CONFIG_TPL_BUILD)) {
+	/*
+	 * Normally TPL sets up the PLLs. When U-Boot proper is started straight by the
+	 * boot ROM after a vendor DRAM init (no TPL), GPLL is still in slow mode: do it here.
+	 */
+	if (IS_ENABLED(CONFIG_TPL_BUILD) ||
+	    (!IS_ENABLED(CONFIG_XPL_BUILD) &&
+	     FIELD_GET(GPLL_MODE_MASK, readl(&priv->cru->cru_mode_con)) == PLL_MODE_SLOW)) {
 		rk3066_clk_init(priv->cru, priv->grf);
 
 		/* Init CPU frequency. */
-- 
2.47.3


                 reply	other threads:[~2026-10-30 12:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261030073756.165229-1-ylcncn@gmail.com \
    --to=ylcncn@gmail.com \
    --cc=kever.yang@rock-chips.com \
    --cc=lukma@nabladev.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@0leil.net \
    --cc=u-boot@lists.u-boot-project.org \
    /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