mail archive of the barebox mailing list
 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: [PATCH 3/3] ARM: rockchip: rk3568: Remove hardcoded clock initialization
Date: Wed,  9 Apr 2025 12:01:17 +0300	[thread overview]
Message-ID: <20250409090117.32359-3-eagle.alexander923@gmail.com> (raw)
In-Reply-To: <20250409090117.32359-1-eagle.alexander923@gmail.com>

Instead of hardcoding the clock initialization in the clk-rk3568
driver, let's use the "assigned-clocks" device tree nodes to
configure the initial desired clock for the chip.
Inspecting the current settings shows that some clocks are already
defined in upstream dts, some don't need to be touched, and some
are initialized to the proper state by default.
The rest of the clock setup has been moved to the barebox rk3568.dtsi.
Tested on custom rk3568-based board.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 arch/arm/dts/rk356x.dtsi          | 21 +++++++++++++++++++++
 drivers/clk/rockchip/clk-rk3568.c | 28 ----------------------------
 2 files changed, 21 insertions(+), 28 deletions(-)

diff --git a/arch/arm/dts/rk356x.dtsi b/arch/arm/dts/rk356x.dtsi
index 995a9d5d92..5087c9cfce 100644
--- a/arch/arm/dts/rk356x.dtsi
+++ b/arch/arm/dts/rk356x.dtsi
@@ -3,6 +3,27 @@
 #include <dt-bindings/soc/rockchip,boot-mode.h>
 
 / {
+	assigned-clocks =
+		<&cru CLK_SDMMC0>,
+		<&cru CCLK_EMMC>,
+		<&cru ACLK_BUS>,
+		<&cru PCLK_BUS>,
+		<&cru PCLK_TOP>,
+		<&cru PLL_APLL>,
+		<&cru PLL_NPLL>,
+		<&cru PLL_VPLL>;
+	assigned-clock-parents =
+		<&cru CPLL_50M>;
+	assigned-clock-rates =
+		<0>,
+		<200000000>,
+		<150000000>,
+		<100000000>,
+		<100000000>,
+		<816000000>,
+		<1200000000>,
+		<500000000>;
+
 	aliases {
 		pmugrf.reboot_mode = &reboot_mode_pmugrf;
 		pwm0 = &pwm0;
diff --git a/drivers/clk/rockchip/clk-rk3568.c b/drivers/clk/rockchip/clk-rk3568.c
index bd6c8269ca..cdc7b99e47 100644
--- a/drivers/clk/rockchip/clk-rk3568.c
+++ b/drivers/clk/rockchip/clk-rk3568.c
@@ -1636,12 +1636,6 @@ static void __init rk3568_pmu_clk_init(struct device_node *np)
 				      ARRAY_SIZE(rk3568_pmucru_critical_clocks));
 
 	rockchip_clk_of_add_provider(np, ctx);
-
-	clk_name_set_parent("ppll", "pll_ppll");
-	clk_name_set_parent("clk_rtc_32k", "clk_rtc32k_frac");
-	clk_name_set_rate("clk_rtc_32k", 32768);
-	clk_name_set_rate("pclk_pmu", 100000000);
-	clk_name_set_rate("pll_ppll", 200000000);
 }
 
 static void __init rk3568_clk_init(struct device_node *np)
@@ -1682,28 +1676,6 @@ static void __init rk3568_clk_init(struct device_node *np)
 				      ARRAY_SIZE(rk3568_cru_critical_clocks));
 
 	rockchip_clk_of_add_provider(np, ctx);
-
-	clk_name_set_parent("npll", "pll_npll");
-	clk_name_set_parent("vpll", "pll_vpll");
-	clk_name_set_parent("pclk_bus", "gpll_100m");
-	clk_name_set_parent("clk_sdmmc0", "cpll_50m");
-	clk_name_set_parent("cclk_emmc", "gpll_200m");
-
-	clk_name_set_rate("pll_cpll", 1000000000);
-	clk_name_set_rate("pll_gpll", 1188000000);
-	clk_name_set_rate("armclk", 600000000);
-	clk_name_set_rate("aclk_bus", 150000000);
-	clk_name_set_rate("pclk_bus", 100000000);
-	clk_name_set_rate("aclk_top_high", 300000000);
-	clk_name_set_rate("aclk_top_low", 200000000);
-	clk_name_set_rate("hclk_top", 150000000);
-	clk_name_set_rate("pclk_top", 100000000);
-	clk_name_set_rate("aclk_perimid", 300000000);
-	clk_name_set_rate("hclk_perimid", 150000000);
-	clk_name_set_rate("pll_npll", 1200000000);
-	clk_name_set_rate("pll_apll", 816000000);
-
-	clk_name_set_parent("pclk_top", "gpll_100m");
 }
 
 struct clk_rk3568_inits {
-- 
2.39.1




  parent reply	other threads:[~2025-04-09  9:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  9:01 [PATCH 1/3] clk: Update clk_fractional_divider driver Alexander Shiyan
2025-04-09  9:01 ` [PATCH 2/3] clk: rockchip: fix finding of maximum clock ID Alexander Shiyan
2025-04-09  9:01 ` Alexander Shiyan [this message]
2025-04-10  7:21 ` [PATCH 1/3] clk: Update clk_fractional_divider driver 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=20250409090117.32359-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox