From: Wasim Khan <[email protected]>

NXP platforms expect custom bootcmd and mcinitcmd to be
updated as per boot source with default environment.
Check env variable fsl_bootcmd_mcinitcmd_set to prepare
bootcmd and mcinitcmd

Fixes cbf77d2018

Suggested-by: Alban Bedel <[email protected]>
Signed-off-by: Wasim Khan <[email protected]>
---
 arch/arm/cpu/armv8/fsl-layerscape/soc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c 
b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index c3cd6c7ac7..f804a7f68d 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -953,12 +953,15 @@ int board_late_init(void)
 #endif
 #ifdef CONFIG_TFABOOT
        /*
-        * Set bootcmd and mcinitcmd if they don't exist in the environment.
+        * Set bootcmd and mcinitcmd if "fsl_bootcmd_mcinitcmd_set" does
+        * not exists in env
         */
-       if (!env_get("bootcmd"))
+       if (env_get_yesno("fsl_bootcmd_mcinitcmd_set") <= 0) {
+               // Set bootcmd and mcinitcmd as per boot source
                fsl_setenv_bootcmd();
-       if (!env_get("mcinitcmd"))
                fsl_setenv_mcinitcmd();
+               env_set("fsl_bootcmd_mcinitcmd_set", "y");
+       }
 #endif
 #ifdef CONFIG_QSPI_AHB_INIT
        qspi_ahb_init();
-- 
2.25.1

Reply via email to