From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 3/5] ARM: i.MX8M: feed A53 cores from ARM PLL via CORE_SEL_CFG in early clock init
Date: Fri, 2 Oct 2026 13:35:48 +0200 [thread overview]
Message-ID: <20261002113554.2902941-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20261002113554.2902941-1-a.fatoum@pengutronix.de>
barebox runs the Cortex-A53 cores off the ARM PLL through the A53 root
slice, as the ROM does, but at 1.2GHz instead of the ROM's 1GHz.
The i.MX8MM, i.MX8MN and i.MX8MP reference manuals all list 1000MHz as
the maximum for ARM_A53_CLK_ROOT in Table 5-1, so the slice runs out of
spec until barebox proper applies the upstream device tree's
assigned-clock-parents: A53_SRC to sys_pll1_800m first, dropping the
cores to 800MHz, then A53_CORE to arm_pll_out.
U-Boot's clock_init() instead writes the A53 root slice in full, i.e.
sys_pll2_500m with all dividers cleared, and switches CORE_SEL_CFG to
arm_pll_out, so the cores are fed from the PLL directly and the slice
is left unused. U-Boot commit 46a8a28bf60b ("imx8m: configure arm clk
sources from PLL") introduced this for the same 1GHz reason. Let's do
the same: barebox proper's reparenting then only touches the unused
slice and the cores stay at 1.2GHz throughout.
CORE_SEL_CFG is target root 49 with only a mux bit, so it is written
without ENABLE, like U-Boot does.
Assisted-by: Claude:fable-5.1
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/mach-imx/imx8m.c | 21 ++++++---------------
include/mach/imx/imx8m-ccm-regs.h | 1 +
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
index 533e2877237f..66a3b376ed94 100644
--- a/arch/arm/mach-imx/imx8m.c
+++ b/arch/arm/mach-imx/imx8m.c
@@ -10,7 +10,6 @@
#include <mach/imx/imx8m-ccm-regs.h>
#include <soc/imx8m/clk-early.h>
-#include <linux/bitfield.h>
#include <linux/iopoll.h>
#define IMX_SIP_BUILDINFO 0xC2000003
@@ -49,8 +48,6 @@ void imx8m_ccgr_clock_disable(int index)
#define INTPLL_DIV2_CLKE_MASK BIT(13)
#define INTPLL_CLKE_MASK BIT(11)
-#define CCM_TARGET_ROOT0_DIV GENMASK(1, 0)
-
#define IMX8MM_CCM_ANALOG_ARM_PLL_GEN_CTRL 0x84
#define IMX8MM_CCM_ANALOG_SYS_PLL1_GEN_CTRL 0x94
#define IMX8MM_CCM_ANALOG_SYS_PLL2_GEN_CTRL 0x104
@@ -60,7 +57,6 @@ static void __imx8m_early_clock_init(int cpu_type)
{
unsigned long pll3_freq;
void __iomem *ana = IOMEM(MX8M_ANATOP_BASE_ADDR);
- void __iomem *ccm = IOMEM(MX8M_CCM_BASE_ADDR);
u32 val;
imx8m_ccgr_clock_disable(IMX8M_CCM_CCGR_DDR1);
@@ -131,22 +127,17 @@ static void __imx8m_early_clock_init(int cpu_type)
IMX8M_CCM_TARGET_ROOTn_MUX(2));
}
- clrsetbits_le32(ccm + IMX8M_CCM_TARGET_ROOTn(IMX8M_ARM_A53_CLK_ROOT),
- IMX8M_CCM_TARGET_ROOTn_MUX(7),
- IMX8M_CCM_TARGET_ROOTn_MUX(2));
+ imx8m_clock_set_target_val(IMX8M_ARM_A53_CLK_ROOT,
+ IMX8M_CCM_TARGET_ROOTn_ENABLE |
+ IMX8M_CCM_TARGET_ROOTn_MUX(2));
/* Configure ARM PLL to 1.2GHz */
clk_pll1416x_early_configure(ana + IMX8MM_CCM_ANALOG_ARM_PLL_GEN_CTRL,
1200000000UL, 25000000UL);
- clrsetbits_le32(ccm + IMX8M_CCM_TARGET_ROOTn(IMX8M_ARM_A53_CLK_ROOT),
- IMX8M_CCM_TARGET_ROOTn_MUX(7),
- IMX8M_CCM_TARGET_ROOTn_MUX(1));
-
- /* Configure DIV to 1.2GHz */
- clrsetbits_le32(ccm + IMX8M_CCM_TARGET_ROOTn(IMX8M_ARM_A53_CLK_ROOT),
- CCM_TARGET_ROOT0_DIV,
- FIELD_PREP(CCM_TARGET_ROOT0_DIV, 0));
+ /* Bypass the A53 root and feed the cores from arm_pll_out directly */
+ imx8m_clock_set_target_val(IMX8M_CORE_SEL_CFG,
+ IMX8M_CCM_TARGET_ROOTn_MUX(1));
}
void imx8mm_early_clock_init(void)
diff --git a/include/mach/imx/imx8m-ccm-regs.h b/include/mach/imx/imx8m-ccm-regs.h
index 42d0c485f25b..bcd8b85f9f3e 100644
--- a/include/mach/imx/imx8m-ccm-regs.h
+++ b/include/mach/imx/imx8m-ccm-regs.h
@@ -25,6 +25,7 @@
#define IMX8M_NOC_CLK_ROOT 26
#define IMX8M_NOC_IO_CLK_ROOT 27
#define IMX8M_DRAM_SEL_CFG 48
+#define IMX8M_CORE_SEL_CFG 49
#define IMX8M_DRAM_ALT_CLK_ROOT 64
#define IMX8M_DRAM_APB_CLK_ROOT 65
#define IMX8M_UART1_CLK_ROOT 94
--
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 ` Ahmad Fatoum [this message]
2026-10-02 11:35 ` [PATCH master 4/5] ARM: i.MX8M: source dram_apb from sys_pll2_200m " Ahmad Fatoum
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-3-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