Skip to contentSkip to conversation

imx95/94/952: Enable early icache/dcache in SPL and U-Boot

PATCH In review [email protected] 3 participants 10 messages Sep 22 – Oct 9

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover imx95/94/952: Enable early icache/dcache in SPL and U-Boot

From: Ye Li <[email protected]>

This patch series enables icache and dcache at the earliest possible point in the SPL and U-Boot boot flow for iMX95, iMX94, and iMX952 platforms, significantly reducing boot time.

On iMX9x platforms using SCMI, the DDR size is not known until the System Manager (SM) is queried via SCMI during DM init. This makes it impossible to set up a full MMU table before DM init completes. To work around this, the early MMU table maps the entire DDR address space as device memory (preventing speculative prefetch into unknown regions), while mapping only the low 64MB of SDRAM as normal memory to cover SPL, U-Boot, early malloc, and the stack. Once DM init completes and the effective DDR size is known, the MMU table is updated to reflect the actual effective memory.

For SPL, the secure DDR region (CFG_SYS_SECURE_SDRAM_BASE/SIZE) must be defined by the board to provide a location for the SPL MMU page table and cover the destination of loaded images. The first 2MB of this region is used by default for MMU table. Boards must also move arch_cpu_init() before spl_early_init() to activate caches before DM init begins, since the main target is saving the time in DTB parsing in DM init.

Measured on iMX95 EVK booting from SD card:

SPL boot time saved: ~87 ms
U-Boot boot time saved: ~402 ms

Ye Li (4):
imx9: scmi: Move WDOG and GPIO init out of arch_cpu_init
imx9: scmi: Support early caches enable in SPL and u-boot
spl_imx_container: Fix verify image after SPL dcache enabled
nxp: imx9{5,4,52} evk/frdm : Enable caches in SPL

 arch/arm/mach-imx/imx9/scmi/soc.c | 156 +++++++++++++++++++++++++++++-
 board/nxp/imx94_evk/spl.c         |   4 +-
 board/nxp/imx952_evk/spl.c        |   4 +-
 board/nxp/imx95_evk/spl.c         |   4 +-
 board/nxp/imx95_frdm/spl.c        |   4 +-
 common/spl/spl_imx_container.c    |   2 +
 include/configs/imx94_evk.h       |   3 +
 include/configs/imx952_evk.h      |   2 +-
 include/configs/imx95_evk.h       |   3 +
 include/configs/imx95_frdm.h      |   3 +
 10 files changed, 173 insertions(+), 12 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH 1/4 imx9: scmi: Move WDOG and GPIO init out of arch_cpu_init

From: Ye Li <[email protected]>

Latest WDOG and GPIO init depends on DT ready in SPL. However, in common board_f framework, arch_cpu_init is called before DM init. So WDOG and GPIO init is not proper in arch_cpu_init. Move them to new function arch_init_post_dm_f which is called after DM init.

---
 arch/arm/mach-imx/imx9/scmi/soc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx9/scmi/soc.c +8 -2
index 8bb3ce5cad9..00fb13ad65d 100644
@@ -1077,6 +1077,12 @@ static int gpio_available(const char *nodes_path)
 }
 
 int arch_cpu_init(void)
+{
+	return 0;
+}
+
+/* arch init which depends on DM init completion */
+static void arch_init_post_dm_f(void)
 {
 	if (IS_ENABLED(CONFIG_SPL_BUILD)) {
 		ofnode node;
@@ -1102,8 +1108,6 @@ int arch_cpu_init(void)
 		gpio_reset(GPIO7_BASE_ADDR);
 #endif
 	}
-
-	return 0;
 }
 
 int imx9_probe_mu(void)
@@ -1146,6 +1150,8 @@ int imx9_probe_mu(void)
 
 	set_cpu_info(&info);
 
+	arch_init_post_dm_f();
+
 	return 0;
 }
 
Signature · 1 line
2.50.1
#2 lore raw

PATCH 2/4 imx9: scmi: Support early caches enable in SPL and u-boot

In reply to [email protected]

From: Ye Li <[email protected]>

Enable the icache and dcache in SPL and u-boot early phase before DM init to save boot time consumed in DTB parsing.
Since the DDR size is got from SM via SCMI, it is not unknown at this early phase, to avoid speculative access and prefetch, only map low address 64MB DDR as normal memory and map other DDR address to device memory. After DM init completion, update the MMU table with effective ddr size.

This early MMU page table addresses is provided by two APIs. Users could override their default implementations to provide different address:
board_spl_mmu_tlb_base - SPL phase MMU table address
board_early_mmu_tlb_base - u-boot board_f phase MMU table address

u-boot early caches are default enabled in this patch. To enable SPL early caches:

1. Define secure DDR regions available for A55 (CFG_SYS_SECURE_SDRAM_BASE and CFG_SYS_SECURE_SDRAM_SIZE). It should include the secure DDR address of the images loaded by SPL. Default board_spl_mmu_tlb_base uses low 2MB space at CFG_SYS_SECURE_SDRAM_BASE.

2. Calling arch_cpu_init before spl_early_init.

---
 arch/arm/mach-imx/imx9/scmi/soc.c | 148 +++++++++++++++++++++++++++++-
 1 file changed, 146 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx9/scmi/soc.c +146 -2
index 00fb13ad65d..22f9c9d045b 100644
@@ -12,6 +12,7 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/ele_api.h>
 #include <asm/setup.h>
+#include <asm/system.h>
 #include <dm/uclass.h>
 #include <dm/device.h>
 #include <dm/ofnode.h>
@@ -317,6 +318,8 @@ static struct mm_region imx9_mem_map[] = {
 			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
 	},
 #endif
+#if IS_ENABLED(CONFIG_XPL_BUILD)
+	/* Avoid speculative access to OCRAM in u-boot */
 	{
 		/* OCRAM */
 		.virt = 0x20480000UL,
@@ -324,7 +327,9 @@ static struct mm_region imx9_mem_map[] = {
 		.size = 0xA0000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_OUTER_SHARE
-	}, {
+	},
+#endif
+	{
 		/* AIPS */
 		.virt = 0x40000000UL,
 		.phys = 0x40000000UL,
@@ -356,6 +361,15 @@ static struct mm_region imx9_mem_map[] = {
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_OUTER_SHARE
 	}, {
+#endif
+#if defined(CFG_SYS_SECURE_SDRAM_SIZE) && IS_ENABLED(CONFIG_XPL_BUILD)
+		/* Secure DRAM */
+		.virt = CFG_SYS_SECURE_SDRAM_BASE,
+		.phys = CFG_SYS_SECURE_SDRAM_BASE,
+		.size = CFG_SYS_SECURE_SDRAM_SIZE,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_OUTER_SHARE
+	}, {
 #endif
 		/* PCIE2 ECAM */
 		.virt = 0x880000000UL,
@@ -388,7 +402,9 @@ static struct mm_region imx9_mem_map[] = {
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_OUTER_SHARE
 	}, {
-		/* empty entry to split table entry 5 if needed when TEEs are used */
+		/* empty entry to split table entry of DRAM1 if needed when TEEs are used,
+		 * or use by early MMU in SPL or board_f phase
+		 */
 		0,
 	}, {
 		/* List terminator */
@@ -423,6 +439,9 @@ void enable_caches(void)
 	int entry = imx9_find_dram_entry_in_mem_map();
 	u64 attrs = imx9_mem_map[entry].attrs;
 
+	dcache_disable();
+	gd->arch.tlb_fillptr = 0;
+
 	while (i < CONFIG_NR_DRAM_BANKS &&
 	       entry < ARRAY_SIZE(imx9_mem_map)) {
 		if (gd->dram[i].start == 0)
@@ -584,6 +603,124 @@ phys_size_t get_effective_memsize(void)
 	}
 }
 
+/* Allow board to override for specific address */
+__weak unsigned long board_spl_mmu_tlb_base(void)
+{
+#if defined(CFG_SYS_SECURE_SDRAM_BASE)
+	return CFG_SYS_SECURE_SDRAM_BASE;
+#else
+	return 0;
+#endif
+}
+
+__weak unsigned long board_early_mmu_tlb_base(void)
+{
+	return CFG_SYS_SDRAM_BASE;
+}
+
+/*
+ * Initialize the MMU and activate dcache in early stage of u-boot or SPL
+ */
+static void early_enable_dcache(void)
+{
+	u64 pgtable_size;
+	unsigned long tlb_addr;
+	int i, e = -1;
+
+	if (CONFIG_IS_ENABLED(SYS_ICACHE_OFF) || CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+		return;
+
+	/* Skip enable dcache if SPL early init is called.
+	 * User should move arch_cpu_init before spl_early_init
+	 */
+	if (gd->flags & GD_FLG_SPL_EARLY_INIT)
+		return;
+
+	pgtable_size = PGTABLE_SIZE;
+	if (pgtable_size > SZ_2M) /* Must fit within the 2MB */
+		return;
+
+	if (IS_ENABLED(CONFIG_XPL_BUILD))
+		tlb_addr = board_spl_mmu_tlb_base();
+	else
+		tlb_addr = board_early_mmu_tlb_base();
+
+	if (!tlb_addr)
+		return;
+
+	/* Because DDR size is unknown at this phase, to avoid speculative access and prefetch,
+	 * set early MMU table to have DDR mapped as device memory, but with low 64MB set to normal
+	 * memory to cover u-boot, early malloc and stack (CFG_SYS_INIT_RAM_ADDR).
+	 */
+	for (i = 0; i < ARRAY_SIZE(imx9_mem_map) - 1; i++) {
+		if (imx9_mem_map[i].phys == CFG_SYS_SDRAM_BASE ||
+		    imx9_mem_map[i].phys == 0x100000000UL)
+			imx9_mem_map[i].attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE);
+		else if (imx9_mem_map[i].phys == 0 && imx9_mem_map[i].size == 0) {
+			/* Use the empty slot reserved in imx9_mem_map */
+			imx9_mem_map[i].phys = PHYS_SDRAM;
+			imx9_mem_map[i].virt = PHYS_SDRAM;
+			imx9_mem_map[i].size = SZ_64M;
+			imx9_mem_map[i].attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+						PTE_BLOCK_OUTER_SHARE;
+			e = i;
+		}
+	}
+
+	if (e == -1)
+		return;
+
+	gd->arch.tlb_size = pgtable_size;
+	gd->arch.tlb_addr = tlb_addr;
+
+	dcache_enable();
+
+	/* Recovery the imx9_mem_map which will be used by u-boot board_r phase */
+	imx9_mem_map[e].phys = 0;
+	imx9_mem_map[e].virt = 0;
+	imx9_mem_map[e].size = 0;
+	imx9_mem_map[e].attrs = 0;
+
+	for (i = 0; i < ARRAY_SIZE(imx9_mem_map) - 1; i++) {
+		if (imx9_mem_map[i].phys == CFG_SYS_SDRAM_BASE ||
+		    imx9_mem_map[i].phys == 0x100000000UL)
+			imx9_mem_map[i].attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+						PTE_BLOCK_OUTER_SHARE;
+	}
+}
+
+/* Update early MMU table with actual DDR got from SM via SCMI */
+static void update_early_mmu_table(void)
+{
+	phys_size_t effective_sz;
+
+	if (CONFIG_IS_ENABLED(SYS_ICACHE_OFF) || CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+		return;
+
+	if (!gd->arch.tlb_addr)
+		return;
+
+	/* Remap u-boot effective size to normal memory */
+	effective_sz = get_effective_memsize();
+	if (effective_sz <= SZ_64M)
+		return;
+
+	mmu_change_region_attr(PHYS_SDRAM + SZ_64M, effective_sz - SZ_64M,
+			       PTE_BLOCK_MEMTYPE(MT_NORMAL)	|
+			       PTE_BLOCK_OUTER_SHARE		|
+			       PTE_TYPE_VALID);
+}
+
+void spl_board_prepare_for_boot(void)
+{
+#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
+	icache_disable();
+	invalidate_icache_all();
+
+	dcache_disable();
+#endif
+}
+
 static inline u64 ether_addr_to_u64(const u8 *addr)
 {
 	u64 u = 0;
@@ -1078,6 +1215,10 @@ static int gpio_available(const char *nodes_path)
 
 int arch_cpu_init(void)
 {
+#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
+	icache_enable();
+	early_enable_dcache();
+#endif
 	return 0;
 }
 
@@ -1108,6 +1249,8 @@ static void arch_init_post_dm_f(void)
 		gpio_reset(GPIO7_BASE_ADDR);
 #endif
 	}
+
+	update_early_mmu_table();
 }
 
 int imx9_probe_mu(void)
@@ -1144,6 +1287,7 @@ int imx9_probe_mu(void)
 	if (gd->flags & GD_FLG_RELOC)
 		return 0;
 
+	flush_dcache_range((ulong)&info, (ulong)&info + sizeof(struct ele_get_info_data));
 	ret = ele_get_info(&info, &res);
 	if (ret)
 		return ret;
Signature · 1 line
2.50.1
#3 lore raw

PATCH 3/4 spl_imx_container: Fix verify image after SPL dcache enabled

In reply to [email protected]

From: Ye Li <[email protected]>

After SPL dcache is enabled on iMX95/94/952, verify image in authentication meets failure. There are two root causes:
1. Driver read APIs won't flush the image data from dcache to memory, such like: USB SDP, ROM API, SPL NOR, etc.
2. iMX95/94/952 uses trampoline buffer to destination address in secure memory. This buffer is not flushed.

Flush the image address before verify image to fix the issue

---
 common/spl/spl_imx_container.c | 2 ++
 1 file changed, 2 insertions(+)
common/spl/spl_imx_container.c +2 -0
index 57cd75b9b5e..dee0c9006d6 100644
@@ -10,6 +10,7 @@
 #include <log.h>
 #include <mapmem.h>
 #include <spl.h>
+#include <cpu_func.h>
 #ifdef CONFIG_AHAB_BOOT
 #include <asm/mach-imx/ahab.h>
 #endif
@@ -77,6 +78,7 @@ static struct boot_img_t *read_auth_image(struct spl_image_info *spl_image,
 	}
 
 #ifdef CONFIG_AHAB_BOOT
+	flush_dcache_range((ulong)buf, (ulong)(buf + images[image_index].size - 1));
 	if (ahab_verify_cntr_image(&images[image_index], image_index))
 		return NULL;
 #endif
Signature · 1 line
2.50.1
#4 lore raw

PATCH 4/4 nxp: imx9{5,4,52} evk/frdm : Enable caches in SPL

In reply to [email protected]

From: Ye Li <[email protected]>

To enable icache and dcache in SPL, add the definition of secure DDR space could be accessed by SPL and move arch_cpu_init before spl_early_init

---
 board/nxp/imx94_evk/spl.c    | 4 ++--
 board/nxp/imx952_evk/spl.c   | 4 ++--
 board/nxp/imx95_evk/spl.c    | 4 ++--
 board/nxp/imx95_frdm/spl.c   | 4 ++--
 include/configs/imx94_evk.h  | 3 +++
 include/configs/imx952_evk.h | 2 +-
 include/configs/imx95_evk.h  | 3 +++
 include/configs/imx95_frdm.h | 3 +++
 8 files changed, 18 insertions(+), 9 deletions(-)
board/nxp/imx94_evk/spl.c +2 -2
index 739a5f1f559..713b531de0f 100644
@@ -74,6 +74,8 @@ void board_init_f(ulong dummy)
 
 	timer_init();
 
+	arch_cpu_init();
+
 	spl_early_init();
 
 	/* Need enable SCMI drivers and ELE driver before enabling console */
@@ -81,8 +83,6 @@ void board_init_f(ulong dummy)
 	if (ret)
 		hang(); /* if MU not probed, nothing can output, just hang here */
 
-	arch_cpu_init();
-
 	preloader_console_init();
 
 	debug("SOC: 0x%x\n", gd->arch.soc_rev);
board/nxp/imx952_evk/spl.c +2 -2
index 615c3b67fb6..447f43bf2f5 100644
@@ -87,6 +87,8 @@ void board_init_f(ulong dummy)
 
 	timer_init();
 
+	arch_cpu_init();
+
 	/* Need dm_init() to run before any SCMI calls can be made. */
 	spl_early_init();
 
@@ -95,8 +97,6 @@ void board_init_f(ulong dummy)
 	if (ret)
 		hang(); /* if MU not probed, nothing can output, just hang here */
 
-	arch_cpu_init();
-
 	preloader_console_init();
 
 	debug("SOC: 0x%x\n", gd->arch.soc_rev);
board/nxp/imx95_evk/spl.c +2 -2
index 2fd69447e1e..f47a75eaf5b 100644
@@ -61,6 +61,8 @@ void board_init_f(ulong dummy)
 
 	timer_init();
 
+	arch_cpu_init();
+
 	/* Need dm_init() to run before any SCMI calls can be made. */
 	spl_early_init();
 
@@ -69,8 +71,6 @@ void board_init_f(ulong dummy)
 	if (ret)
 		hang(); /* if MU not probed, nothing can output, just hang here */
 
-	arch_cpu_init();
-
 	preloader_console_init();
 
 	debug("SOC: 0x%x\n", gd->arch.soc_rev);
board/nxp/imx95_frdm/spl.c +2 -2
index c8a5b4f9d41..2e899b63061 100644
@@ -61,6 +61,8 @@ void board_init_f(ulong dummy)
 
 	timer_init();
 
+	arch_cpu_init();
+
 	/* Need dm_init() to run before any SCMI calls can be made. */
 	spl_early_init();
 
@@ -69,8 +71,6 @@ void board_init_f(ulong dummy)
 	if (ret)
 		hang(); /* if MU not probed, nothing can output, just hang here */
 
-	arch_cpu_init();
-
 	preloader_console_init();
 
 	debug("SOC: 0x%x\n", gd->arch.soc_rev);
include/configs/imx94_evk.h +3 -0
index 2623c13db06..64150245d26 100644
@@ -18,4 +18,7 @@
 #define PHYS_SDRAM_SIZE			     0x70000000UL /* 2GB  - 256MB DDR */
 #define PHYS_SDRAM_2_SIZE	             0x180000000 /* 8GB */
 
+#define CFG_SYS_SECURE_SDRAM_BASE	0x8A000000 /* Secure DDR region for A55 */
+#define CFG_SYS_SECURE_SDRAM_SIZE	0x04000000
+
 #endif
include/configs/imx952_evk.h +1 -1
index 4ff56eb8adf..689fe9b4dc4 100644
@@ -20,6 +20,6 @@
 #define PHYS_SDRAM_2_SIZE		0x380000000 /* 14GB */
 
 #define CFG_SYS_SECURE_SDRAM_BASE	0x8A000000 /* Secure DDR region for A55, SPL could use first 2MB */
-#define CFG_SYS_SECURE_SDRAM_SIZE	0x06000000
+#define CFG_SYS_SECURE_SDRAM_SIZE	0x04000000
 
 #endif
include/configs/imx95_evk.h +3 -0
index 1fdc9ce21ef..57658d438a7 100644
@@ -23,4 +23,7 @@
 #define PHYS_SDRAM_2_SIZE		0x380000000 /* 14GB (Totally 16GB) */
 #endif
 
+#define CFG_SYS_SECURE_SDRAM_BASE	0x8A000000 /* Secure DDR region for A55 */
+#define CFG_SYS_SECURE_SDRAM_SIZE	0x04000000
+
 #endif
include/configs/imx95_frdm.h +3 -0
index 132eea28643..e64294a2bb1 100644
@@ -20,4 +20,7 @@
 
 #define PHYS_SDRAM_2_SIZE		0x180000000 /* 6GB (Totally 8GB) */
 
+#define CFG_SYS_SECURE_SDRAM_BASE   0x8A000000 /* Secure DDR region for A55 */
+#define CFG_SYS_SECURE_SDRAM_SIZE   0x04000000
+
 #endif
Signature · 1 line
2.50.1
#5 lore raw
In reply to [email protected]

Hello Ye,

Quoted 6 lines · On Tue, Sep 22, 2026 at 10:24:02AM +0800, [email protected] wrote:

From: Ye Li <[email protected]>

This patch series enables icache and dcache at the earliest possible point in the SPL and U-Boot boot flow for iMX95, iMX94, and iMX952 platforms, significantly reducing boot time.

You did not update the Toradex boards (that are the only iMX95 boards not from NXP currently present in U-Boot).

Is something that should be done?

Quoted 2 lines

On iMX9x platforms using SCMI, the DDR size is not known until the System Manager (SM) is queried via SCMI during DM init.

Emanuele: is this the same also for Toradex boards? I think for us is different. Any significant implication because of that?

Francesco

author
#6 lore raw

Hi Francesco,

Quoted 10 lines · Francesco Dolcini

Hello Ye,

Quoted 6 lines · On Tue, Sep 22, 2026 at 10:24:02AM +0800, [email protected] wrote:

From: Ye Li <[email protected]>

This patch series enables icache and dcache at the earliest possible point in the SPL and U-Boot boot flow for iMX95, iMX94, and iMX952 platforms, significantly reducing boot time.

Quoted 4 lines

You did not update the Toradex boards (that are the only iMX95 boards not from NXP currently present in U-Boot).

Is something that should be done?

Yes, I only update NXP boards. By default, the u-boot early caches are
enabled in the patch set, no change needed for Toradex board. To enable
caches in SPL, Toradex boards need to update codes like patch #4 to define the CFG_SYS_SECURE_SDRAM_BASE/SIZE and move arch_cpu_init().

Quoted 7 lines
Quoted 3 lines

On iMX9x platforms using SCMI, the DDR size is not known until the System Manager (SM) is queried via SCMI during DM init.

Emanuele: is this the same also for Toradex boards? I think for us is different. Any significant implication because of that?

The default board_phy_sdram_size gets the DDR size from SM. If Toradex boards don't override it, you are using same way. This allow single u-boot image working for boards with different DDR size.

Best regards,
Ye Li

Quoted 2 lines

Francesco

#7 lore raw

Hello Ye,

Quoted 12 lines · Ye Li
Quoted 11 lines · Francesco Dolcini
Quoted 6 lines · On Tue, Sep 22, 2026 at 10:24:02AM +0800, [email protected] wrote:

From: Ye Li <[email protected]>

This patch series enables icache and dcache at the earliest possible point in the SPL and U-Boot boot flow for iMX95, iMX94, and iMX952 platforms, significantly reducing boot time.

You did not update the Toradex boards (that are the only iMX95 boards not from NXP currently present in U-Boot).

Quoted 6 lines
Quoted 1 line

Is something that should be done?

Yes, I only update NXP boards. By default, the u-boot early caches are enabled in the patch set, no change needed for Toradex board. To enable caches in SPL, Toradex boards need to update codes like patch #4 to define the CFG_SYS_SECURE_SDRAM_BASE/SIZE and move arch_cpu_init().

Is something that you can do and make sense to be done as part of this series?

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

On iMX9x platforms using SCMI, the DDR size is not known until the System Manager (SM) is queried via SCMI during DM init.

Emanuele: is this the same also for Toradex boards? I think for us is different. Any significant implication because of that?

The default board_phy_sdram_size gets the DDR size from SM. If Toradex boards don't override it, you are using same way. This allow single u-boot image working for boards with different DDR size.

We have the same binary images using the same U-Boot/OEI and SM and everything for board with different memory. But to have this we had to deviate from what NXP does.

Francesco

author
#8 lore raw

Hi Francesco,

Quoted 17 lines · Francesco Dolcini

Hello Ye,

Quoted 14 lines · Ye Li
Quoted 12 lines · Francesco Dolcini
Quoted 6 lines · On Tue, Sep 22, 2026 at 10:24:02AM +0800, [email protected] wrote:

From: Ye Li <[email protected]>

This patch series enables icache and dcache at the earliest possible point in the SPL and U-Boot boot flow for iMX95, iMX94, and iMX952 platforms, significantly reducing boot time.

You did not update the Toradex boards (that are the only iMX95 boards not from NXP currently present in U-Boot).

Is something that should be done?

Quoted 7 lines
Quoted 4 lines

Yes, I only update NXP boards. By default, the u-boot early caches are enabled in the patch set, no change needed for Toradex board. To enable caches in SPL, Toradex boards need to update codes like patch #4 to define the CFG_SYS_SECURE_SDRAM_BASE/SIZE and move arch_cpu_init().

Is something that you can do and make sense to be done as part of this series?

I can add a patch for Toradex boards. But I need to confirm if same CFG_SYS_SECURE_SDRAM_BASE/SIZE ok for Toradex boards. This should be aligned with full DDR layout and related with your SM cfg for DDR regions assignment. And I don't have Toradex boards, need you and Emanuele to help test them.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

On iMX9x platforms using SCMI, the DDR size is not known until the System Manager (SM) is queried via SCMI during DM init.

Emanuele: is this the same also for Toradex boards? I think for us is different. Any significant implication because of that?

Quoted 7 lines
Quoted 3 lines

The default board_phy_sdram_size gets the DDR size from SM. If Toradex boards don't override it, you are using same way. This allow single u-boot image working for boards with different DDR size.

We have the same binary images using the same U-Boot/OEI and SM and everything for board with different memory. But to have this we had to deviate from what NXP does.

Emanuele sent another email and mentioned a overlap between early MMU table address and the alias address used in Verdin board_phy_sdram_size. So I plan to add below change in v2. Please check if it is ok for all 95 Toradex boards.

+__weak unsigned long board_early_mmu_tlb_base(void) +{
+ return CFG_SYS_SDRAM_BASE + SZ_64M - SZ_2M;
+}

Best regards,
Ye Li

Quoted 3 lines

Francesco

#9 lore raw

Review

Quoted 5 lines · Ye Li

[...]

(quoted diff) +4 -0
+__weak unsigned long board_early_mmu_tlb_base(void)
+{
+    return CFG_SYS_SDRAM_BASE + SZ_64M - SZ_2M;
+}

Hello Ye,
I tested this on top of v1 on Verdin iMX95 [4GB], together with the changes below to enable the caches in SPL. The board boots to Linux and the caches are enabled.
I noticed the series has already been merged. Could you send a follow-up patch with the board_early_mmu_tlb_base() change and the Toradex board updates? I’m happy to test it.

Kind regards,
Emanuele

arch/arm/mach-imx/imx9/scmi/soc.c +1 -1
index 22f9c9d045bd..680a8b403982 100644
@@ -615,7 +615,7 @@ __weak unsigned long board_spl_mmu_tlb_base(void)
 
 __weak unsigned long board_early_mmu_tlb_base(void)
 {
-	return CFG_SYS_SDRAM_BASE;
+	return CFG_SYS_SDRAM_BASE + SZ_64M - SZ_2M;
 }
 
 /*
board/toradex/verdin-imx95/spl.c +2 -2
index 93e76be6145a..31730fc22c88 100644
@@ -58,6 +58,8 @@ void board_init_f(ulong dummy)
 
 	timer_init();
 
+	arch_cpu_init();
+
 	/* Need dm_init() to run before any SCMI calls */
 	spl_early_init();
 
@@ -66,8 +68,6 @@ void board_init_f(ulong dummy)
 	if (ret)
 		hang(); /* MU not probed, nothing can be outputed, hang */
 
-	arch_cpu_init();
-
 	preloader_console_init();
 
 	debug("SOC: 0x%x\n", gd->arch.soc_rev);
include/configs/verdin-imx95.h +3 -0
index b6df4d486955..98fc6f3757f0 100644
@@ -22,4 +22,7 @@
 #define PHYS_SDRAM_SIZE		(SZ_2G - PHYS_SDRAM_FW_RSVD)
 #define PHYS_SDRAM_2_SIZE	SZ_30G
 
+#define CFG_SYS_SECURE_SDRAM_BASE	0x8A000000 /* Secure DDR region for A55 */
+#define CFG_SYS_SECURE_SDRAM_SIZE	SZ_64M
+
 #endif