socfpga_init_smmu() changes the L3 masters (eg: SDMMC, NAND and etc.)
to non-secure; this leads to failure when L3 masters tries loading
SSBL image to secure region in DDR.

Hence, socfpga_init_smmu() is moved to spl_perform_fixups(), so,
it is called prior to running SSBL.

Signed-off-by: Naresh Kumar Ravulapalli <nareshkumar.ravulapa...@altera.com>
---
 arch/arm/mach-socfpga/spl_agilex.c | 3 ---
 arch/arm/mach-socfpga/spl_s10.c    | 3 ---
 arch/arm/mach-socfpga/spl_soc64.c  | 6 ++++++
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-socfpga/spl_agilex.c 
b/arch/arm/mach-socfpga/spl_agilex.c
index 95e092377ef..5567360fdbe 100644
--- a/arch/arm/mach-socfpga/spl_agilex.c
+++ b/arch/arm/mach-socfpga/spl_agilex.c
@@ -69,9 +69,6 @@ void board_init_f(ulong dummy)
 
        firewall_setup();
 
-       /* Setup and Initialize SMMU */
-       socfpga_init_smmu();
-
        ret = uclass_get_device(UCLASS_CACHE, 0, &dev);
        if (ret) {
                debug("CCU init failed: %d\n", ret);
diff --git a/arch/arm/mach-socfpga/spl_s10.c b/arch/arm/mach-socfpga/spl_s10.c
index 9eebeda308f..8fc9369776d 100644
--- a/arch/arm/mach-socfpga/spl_s10.c
+++ b/arch/arm/mach-socfpga/spl_s10.c
@@ -73,9 +73,6 @@ void board_init_f(ulong dummy)
 
        firewall_setup();
 
-       /* Setup and Initialize SMMU */
-       socfpga_init_smmu();
-
        /* disable ocram security at CCU for non secure access */
        clrbits_le32(CCU_REG_ADDR(CCU_CPU0_MPRT_ADMASK_MEM_RAM0),
                     CCU_ADMASK_P_MASK | CCU_ADMASK_NS_MASK);
diff --git a/arch/arm/mach-socfpga/spl_soc64.c 
b/arch/arm/mach-socfpga/spl_soc64.c
index 651d9fc9cb8..8cc56c58089 100644
--- a/arch/arm/mach-socfpga/spl_soc64.c
+++ b/arch/arm/mach-socfpga/spl_soc64.c
@@ -6,6 +6,8 @@
  */
 
 #include <hang.h>
+#include <asm/arch/mailbox_s10.h>
+#include <asm/arch/smmu_s10.h>
 #include <spl.h>
 #include <dm/uclass.h>
 
@@ -132,6 +134,7 @@ u32 spl_boot_mode(const u32 boot_device)
 /* board specific function prior loading SSBL / U-Boot */
 void spl_perform_fixups(struct spl_image_info *spl_image)
 {
+#if (IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5))
        int ret;
        struct udevice *dev;
 
@@ -140,4 +143,7 @@ void spl_perform_fixups(struct spl_image_info *spl_image)
                printf("HPS SMMU secure settings init failed: %d\n", ret);
                hang();
        }
+#endif
+       socfpga_init_smmu();
+
 }
-- 
2.35.3

Reply via email to