From: Emanuele Ghidoli <emanuele.ghid...@toradex.com>

ft_system_setup cannot be enabled on SoC without msmc sram otherwise
fdt_fixup_msmc_ram function fails causing system reset.

Fix by calling fdt_fixup_msmc_ram only on these specific SoC:
- J721S2
- AM654
- J721E

This change was verified to not change anything on any existing board
(all the J721S2, AM654 and J721E boards requires it,
none of the remaining k3 boards require it).

Fixes: 30e96a240156 ("arm: mach-k3: Move MSMC fixup to SoC level")
Signed-off-by: Emanuele Ghidoli <emanuele.ghid...@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolc...@toradex.com>
---
 arch/arm/mach-k3/common.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 34737a43aa08..f86ccaedc94f 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -433,14 +433,18 @@ int fdt_fixup_msmc_ram(void *blob, char *parent_path, 
char *node_name)
 #if defined(CONFIG_OF_SYSTEM_SETUP)
 int ft_system_setup(void *blob, struct bd_info *bd)
 {
-       int ret;
-
-       ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
-       if (ret < 0)
-               ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
-                                        "sram@70000000");
-       if (ret)
-               printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
+       int ret = 0;
+
+       if (IS_ENABLED(CONFIG_SOC_K3_J721S2) ||
+           IS_ENABLED(CONFIG_SOC_K3_AM654) ||
+           IS_ENABLED(CONFIG_SOC_K3_J721E)) {
+               ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000");
+               if (ret < 0)
+                       ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000",
+                                                "sram@70000000");
+               if (ret)
+                       printf("%s: fixing up msmc ram failed %d\n", __func__, 
ret);
+       }
 
        return ret;
 }
-- 
2.25.1

Reply via email to