All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Shiyan <eagle.alexander923@gmail.com>
To: barebox@lists.infradead.org
Cc: Alexander Shiyan <eagle.alexander923@gmail.com>
Subject: [RFC] clk: rockchip: Fix CPLL setup issue
Date: Fri, 26 Sep 2025 16:15:14 +0300	[thread overview]
Message-ID: <20250926131514.673245-1-eagle.alexander923@gmail.com> (raw)

This is a dirty patch to solve the RK3588 CPLL clock setup issue.
It's taken from the Rockchip U-Boot repository [1].
Any ideas on how to improve it?

[1] https://github.com/rockchip-linux/u-boot/commit/bd11beba4f997b62809d24eba30a8713c8bbeb81

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/clk/rockchip/clk-pll.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c
index 904d70d5d4..4b92639e1b 100644
--- a/drivers/clk/rockchip/clk-pll.c
+++ b/drivers/clk/rockchip/clk-pll.c
@@ -940,6 +940,13 @@ static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll,
 		}
 	}
 
+	/* Barebox addition */
+	if (pll->reg_base - pll->ctx->reg_base == 0x1a0) {
+		/* Determine CPLL clock and patch clk_bisrintf_pllsrc_en */
+		writel(HIWORD_UPDATE(BIT(1), BIT(1), 0),
+		       pll->ctx->reg_base + 0x84c);
+	}
+
 	/* set pll power down */
 	writel(HIWORD_UPDATE(RK3588_PLLCON1_PWRDOWN,
 			     RK3588_PLLCON1_PWRDOWN, 0),
@@ -971,6 +978,13 @@ static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll,
 	if ((pll->type == pll_rk3588) && rate_change_remuxed)
 		pll_mux_ops->set_parent(&pll_mux->hw, PLL_MODE_NORM);
 
+	/* Barebox addition */
+	if (pll->reg_base - pll->ctx->reg_base == 0x1a0) {
+		/* Determine CPLL clock and patch clk_bisrintf_pllsrc_en back */
+		writel(HIWORD_UPDATE(0, BIT(1), 0),
+		       pll->ctx->reg_base + 0x84c);
+	}
+
 	return ret;
 }
 
-- 
2.38.2




             reply	other threads:[~2025-09-26 13:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26 13:15 Alexander Shiyan [this message]
2025-09-29  8:12 ` [RFC] clk: rockchip: Fix CPLL setup issue Sascha Hauer
2025-09-29  8:29   ` Alexander Shiyan
2025-09-29  8:44     ` Sascha Hauer

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=20250926131514.673245-1-eagle.alexander923@gmail.com \
    --to=eagle.alexander923@gmail.com \
    --cc=barebox@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.