If dram_init_banksize() is called from SPL, the rom_pointer, at that
point, is not correctly initialized. This causes wrong calculation of
DRAM start and size in dram_init_banksize(). The issue became apparent
only in Falcon Mode. Added an extra condition to prevent using
rom_pointer in SPL.

Signed-off-by: Elena Popa <elena.p...@nxp.com>
---
 arch/arm/mach-imx/imx8m/soc.c | 2 +-
 arch/arm/mach-imx/imx9/soc.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index d5254886be..dbb2154b08 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -273,7 +273,7 @@ int dram_init_banksize(void)
        }
 
        gd->bd->bi_dram[bank].start = PHYS_SDRAM;
-       if (!IS_ENABLED(CONFIG_ARMV8_PSCI) && rom_pointer[1]) {
+       if (!IS_ENABLED(CONFIG_ARMV8_PSCI) && !IS_ENABLED(CONFIG_SPL_BUILD) && 
rom_pointer[1]) {
                phys_addr_t optee_start = (phys_addr_t)rom_pointer[0];
                phys_size_t optee_size = (size_t)rom_pointer[1];
 
diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c
index f43b73a6c2..ca91f20fe7 100644
--- a/arch/arm/mach-imx/imx9/soc.c
+++ b/arch/arm/mach-imx/imx9/soc.c
@@ -390,7 +390,7 @@ int dram_init_banksize(void)
        }
 
        gd->bd->bi_dram[bank].start = PHYS_SDRAM;
-       if (rom_pointer[1]) {
+       if (!IS_ENABLED(CONFIG_SPL_BUILD) && rom_pointer[1]) {
                phys_addr_t optee_start = (phys_addr_t)rom_pointer[0];
                phys_size_t optee_size = (size_t)rom_pointer[1];
 
-- 
2.25.1

Reply via email to