From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 4/5] ARM: i.MX8M: source dram_apb from sys_pll2_200m in early clock init
Date: Fri, 2 Oct 2026 13:35:49 +0200 [thread overview]
Message-ID: <20261002113554.2902941-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20261002113554.2902941-1-a.fatoum@pengutronix.de>
barebox derives the 200MHz dram_apb clock from sys_pll1_800m divided
by 4, while U-Boot's clock_init() selects sys_pll2_200m, which needs
no divider. Let's do the same, so both can be compared side by side.
Move the DRAM clock setup below the code enabling the SYS_PLL2 outputs,
where U-Boot has it as well. This is ordering only: all SYS_PLL2
outputs are enabled at reset already.
No functional change: imx8m_ddr_init() reconfigures DRAM_APB_CLK_ROOT
via ddrphy_init_set_dfi_clk() before the DDRC is first accessed, so
the value set here is overwritten before any register access uses it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/mach-imx/imx8m.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
index 66a3b376ed94..23a920ffae2e 100644
--- a/arch/arm/mach-imx/imx8m.c
+++ b/arch/arm/mach-imx/imx8m.c
@@ -59,20 +59,6 @@ static void __imx8m_early_clock_init(int cpu_type)
void __iomem *ana = IOMEM(MX8M_ANATOP_BASE_ADDR);
u32 val;
- imx8m_ccgr_clock_disable(IMX8M_CCM_CCGR_DDR1);
-
- imx8m_clock_set_target_val(IMX8M_DRAM_ALT_CLK_ROOT,
- IMX8M_CCM_TARGET_ROOTn_ENABLE |
- IMX8M_CCM_TARGET_ROOTn_MUX(1));
-
- /* change the clock source of dram_apb_clk_root: source 4 800MHz /4 = 200MHz */
- imx8m_clock_set_target_val(IMX8M_DRAM_APB_CLK_ROOT,
- IMX8M_CCM_TARGET_ROOTn_ENABLE |
- IMX8M_CCM_TARGET_ROOTn_MUX(4) |
- IMX8M_CCM_TARGET_ROOTn_POST_DIV(4 - 1));
-
- imx8m_ccgr_clock_enable(IMX8M_CCM_CCGR_DDR1);
-
/*
* The gate is not exported to clk tree, so configure them here.
* According to ANAMIX SPEC
@@ -96,6 +82,19 @@ static void __imx8m_early_clock_init(int cpu_type)
INTPLL_DIV20_CLKE_MASK;
writel(val, ana + IMX8MM_CCM_ANALOG_SYS_PLL2_GEN_CTRL);
+ imx8m_ccgr_clock_disable(IMX8M_CCM_CCGR_DDR1);
+
+ imx8m_clock_set_target_val(IMX8M_DRAM_ALT_CLK_ROOT,
+ IMX8M_CCM_TARGET_ROOTn_ENABLE |
+ IMX8M_CCM_TARGET_ROOTn_MUX(1));
+
+ /* change the clock source of dram_apb_clk_root: source 1 sys_pll2_200m */
+ imx8m_clock_set_target_val(IMX8M_DRAM_APB_CLK_ROOT,
+ IMX8M_CCM_TARGET_ROOTn_ENABLE |
+ IMX8M_CCM_TARGET_ROOTn_MUX(1));
+
+ imx8m_ccgr_clock_enable(IMX8M_CCM_CCGR_DDR1);
+
if (cpu_type != IMX_CPU_IMX8MP) {
/* 8MP ROM already set GIC to 400Mhz, system_pll1_800m with div = 2 */
/* For everything else, config GIC to sys_pll2_100m */
--
2.47.3
next prev parent reply other threads:[~2026-10-02 11:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 11:35 [PATCH master 1/5] clk: imx: pll14xx: enable PLL output in clk_pll1416x_early_set_rate() Ahmad Fatoum
2026-10-02 11:35 ` [PATCH master 2/5] ARM: i.MX8MM/8MN: clock NOC from SYS_PLL3 in early clock init Ahmad Fatoum
2026-10-02 11:35 ` [PATCH master 3/5] ARM: i.MX8M: feed A53 cores from ARM PLL via CORE_SEL_CFG " Ahmad Fatoum
2026-10-02 11:35 ` Ahmad Fatoum [this message]
2026-10-02 11:35 ` [PATCH master 5/5] ARM: i.MX8M: order early clock init like U-Boot Ahmad Fatoum
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=20261002113554.2902941-4-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--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