mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
	Niels de Koeijer <NEMK@bang-olufsen.dk>
Subject: [PATCH master 2/5] ARM: i.MX8MM/8MN: clock NOC from SYS_PLL3 in early clock init
Date: Fri,  2 Oct 2026 13:35:47 +0200	[thread overview]
Message-ID: <20261002113554.2902941-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20261002113554.2902941-1-a.fatoum@pengutronix.de>

barebox never touches NOC_CLK_ROOT on the i.MX8MM and i.MX8MN in the
PBL, so early startup uses the ROM's setting: sys_pll1_800m with a
post divider of 2, i.e. 400MHz.

barebox proper later reparents NOC to sys_pll3_out as requested by the
upstream device tree, but the assigned rate is 0 and clk-conf only
switches the mux, so the ROM's divider stays and NOC runs at half the
SYS_PLL3 rate: 300MHz instead of 600MHz on the i.MX8MN.
This was observed to make an L2 cache miss about 10% more costly.

U-Boot's clock_init() instead writes NOC_CLK_ROOT in full: undivided
sys_pll3_out, i.e. 750MHz on the i.MX8MM and 600MHz on the i.MX8MN,
both within the 800MHz maximum of the root.

Let's do the same in barebox.

Reported-by: Niels de Koeijer <NEMK@bang-olufsen.dk>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-imx/imx8m.c         | 5 +++++
 include/mach/imx/imx8m-ccm-regs.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
index 3b2833a07ec2..533e2877237f 100644
--- a/arch/arm/mach-imx/imx8m.c
+++ b/arch/arm/mach-imx/imx8m.c
@@ -124,6 +124,11 @@ static void __imx8m_early_clock_init(int cpu_type)
 		imx8m_clock_set_target_val(IMX8M_NOC_IO_CLK_ROOT,
 					   IMX8M_CCM_TARGET_ROOTn_ENABLE |
 					   IMX8M_CCM_TARGET_ROOTn_MUX(2));
+	} else {
+		/* NOC from undivided sys_pll3_out */
+		imx8m_clock_set_target_val(IMX8M_NOC_CLK_ROOT,
+					   IMX8M_CCM_TARGET_ROOTn_ENABLE |
+					   IMX8M_CCM_TARGET_ROOTn_MUX(2));
 	}
 
 	clrsetbits_le32(ccm + IMX8M_CCM_TARGET_ROOTn(IMX8M_ARM_A53_CLK_ROOT),
diff --git a/include/mach/imx/imx8m-ccm-regs.h b/include/mach/imx/imx8m-ccm-regs.h
index 035cd13ed694..42d0c485f25b 100644
--- a/include/mach/imx/imx8m-ccm-regs.h
+++ b/include/mach/imx/imx8m-ccm-regs.h
@@ -22,6 +22,7 @@
  * Applications Processor Reference Manual
  */
 #define IMX8M_ARM_A53_CLK_ROOT		0
+#define IMX8M_NOC_CLK_ROOT		26
 #define IMX8M_NOC_IO_CLK_ROOT           27
 #define IMX8M_DRAM_SEL_CFG		48
 #define IMX8M_DRAM_ALT_CLK_ROOT		64
-- 
2.47.3




  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 ` Ahmad Fatoum [this message]
2026-10-02 11:35 ` [PATCH master 3/5] ARM: i.MX8M: feed A53 cores from ARM PLL via CORE_SEL_CFG in early clock init Ahmad Fatoum
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-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=NEMK@bang-olufsen.dk \
    --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