armv8: ls2088aqds: Add bootcmd for TFA boot

Add bootcmd for IFC NOR boot and SD boot.

Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
Reviewed-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
diff --git a/include/configs/ls2080aqds.h b/include/configs/ls2080aqds.h
index 74c7dc4..11c6ffd 100644
--- a/include/configs/ls2080aqds.h
+++ b/include/configs/ls2080aqds.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2017 NXP
+ * Copyright 2017, 2019 NXP
  * Copyright 2015 Freescale Semiconductor
  */
 
@@ -378,8 +378,8 @@
 	"hwconfig=fsl_ddr:bank_intlv=auto\0"    \
 	"loadaddr=0x80100000\0"                 \
 	"loadaddr_sd=0x90100000\0"                 \
-	"kernel_addr=0x100000\0"                \
-	"kernel_addr_sd=0x800\0"                \
+	"kernel_addr=0x581000000\0"		          \
+	"kernel_addr_sd=0x8000\0"                \
 	"ramdisk_addr=0x800000\0"               \
 	"ramdisk_size=0x2000000\0"              \
 	"fdt_high=0xa0000000\0"                 \
@@ -389,9 +389,23 @@
 	"kernel_load=0xa0000000\0"              \
 	"kernel_size=0x2800000\0"               \
 	"kernel_size_sd=0x14000\0"               \
-	"mcinitcmd=fsl_mc start mc 0x580a00000" \
-	" 0x580e00000 \0"			\
-	"mcmemsize=0x70000000 \0"
+	"load_addr=0xa0000000\0"		            \
+	"kernelheader_addr=0x580800000\0"	\
+	"kernelheader_addr_r=0x80200000\0"	\
+	"kernelheader_size=0x40000\0"		\
+	"BOARD=ls2088aqds\0" \
+	"mcmemsize=0x70000000 \0" \
+	IFC_MC_INIT_CMD				\
+	"nor_bootcmd=echo Trying load from nor..;"		\
+		"cp.b $kernel_addr $load_addr "			\
+		"$kernel_size ; env exists secureboot && "	\
+		"cp.b $kernelheader_addr $kernelheader_addr_r "	\
+		"$kernelheader_size && esbc_validate ${kernelheader_addr_r}; "\
+		"bootm $load_addr#$BOARD\0"	\
+	"sd_bootcmd=echo Trying load from SD ..;" \
+	"mmcinfo; mmc read $load_addr "		\
+	"$kernel_addr_sd $kernel_size_sd && "	\
+	"bootm $load_addr#$BOARD\0"
 #elif defined(CONFIG_SD_BOOT)
 #define CONFIG_EXTRA_ENV_SETTINGS		\
 	"hwconfig=fsl_ddr:bank_intlv=auto\0"    \
@@ -426,6 +440,25 @@
 #endif /* CONFIG_TFABOOT */
 #endif /* CONFIG_SECURE_BOOT */
 
+#ifdef CONFIG_TFABOOT
+#define SD_BOOTCOMMAND						\
+			"env exists mcinitcmd && env exists secureboot "\
+			"&& mmcinfo && mmc read $load_addr 0x3c00 0x800 " \
+			"&& esbc_validate $load_addr; "			\
+			"env exists mcinitcmd && run mcinitcmd "	\
+			"&& mmc read 0x88000000 0x6800 0x800 "		\
+			"&& fsl_mc lazyapply dpl 0x88000000; "		\
+			"run sd_bootcmd; "		\
+			"env exists secureboot && esbc_halt;"
+
+#define IFC_NOR_BOOTCOMMAND						\
+			"env exists mcinitcmd && env exists secureboot "\
+			"&& esbc_validate 0x580780000; env exists mcinitcmd "\
+			"&& fsl_mc lazyapply dpl 0x580d00000;"		\
+			"run nor_bootcmd; "		\
+			"env exists secureboot && esbc_halt;"
+#endif
+
 #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
 #define CONFIG_FSL_MEMAC
 #define CONFIG_PHYLIB_10G