On 6/18/2026 3:00 PM, Francesco Dolcini wrote:
+ Emanuele

On Thu, Jun 18, 2026 at 09:17:47AM +0800, [email protected] wrote:
From: Ye Li <[email protected]>

After supporting get DRAM size from SM, the trampoline buffer address
still depends on PHYS_SDRAM_SIZE. If the real DDR size is less than
PHYS_SDRAM_SIZE, the trampoline buffer address is invalid and SPL will
crash. So use board_phys_sdram_size to get real DDR size to calculate
correct address.

Fixes: e1cc7117b630 ("imx9: scmi: Get DDR size through SM SCMI API")
Signed-off-by: Ye Li <[email protected]>
---
  arch/arm/mach-imx/imx9/scmi/soc.c | 16 +++++++++++-----
  1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c 
b/arch/arm/mach-imx/imx9/scmi/soc.c
index 00b8693fbe0..ce86cdf8574 100644
--- a/arch/arm/mach-imx/imx9/scmi/soc.c
+++ b/arch/arm/mach-imx/imx9/scmi/soc.c
@@ -1177,10 +1177,11 @@ enum boot_device get_boot_device(void)
bool arch_check_dst_in_secure(void *start, ulong size)
  {
-       ulong ns_end = CFG_SYS_SDRAM_BASE + PHYS_SDRAM_SIZE;
-#ifdef PHYS_SDRAM_2_SIZE
-       ns_end += PHYS_SDRAM_2_SIZE;
-#endif
+       ulong ns_end;
+       phys_size_t dram_size;
+
+       board_phys_sdram_size(&dram_size);

Emanuele: does this change has any impact on the memory size detection we have
implemented in our i.MX95 based boards?

Peng: board_phys_sdram_size() in board/toradex/verdin-imx95/verdin-imx95.c

It won't have impact on the memory size detection. It uses the output of memory size detection for selection correct address for trampoline buffer. Previously trampoline buffer uses PHYS_SDRAM_SIZE which is defined as 2GB - 256MB, if the real DDR size detected at runtime is less than PHYS_SDRAM_SIZE (for example 1GB), this buffer address is invalid.

Best regards,
Ye Li

Francesco


Reply via email to