From 20f270670d1d5e14f3fd128f359535300a955ac8 Mon Sep 17 00:00:00 2001
From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Mon, 16 Oct 2017 12:37:05 +0800
Subject: [PATCH] armv8: ls2088ardb: add LEDE boot support in environment

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 include/configs/ls2080ardb.h | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index 8a34990..8ae3944 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -432,7 +432,19 @@ unsigned long get_board_sys_clk(void);
 		"env exists secureboot && mmc read $kernelheader_addr_r "		\
 		"$kernelhdr_addr_sd $kernelhdr_size_sd "		\
 		" && esbc_validate ${kernelheader_addr_r};"	\
-		"bootm $load_addr#$board\0"
+		"bootm $load_addr#$board\0" \
+	"lede_setenv=setenv loadaddr 82000000 && " \
+		"setenv fdtaddr 8f000000 && " \
+		"setenv bootargs root=/dev/mtdblock9 " \
+		"rootfstype=squashfs,jffs2 noinitrd " \
+		"earlycon=uart8250,mmio,0x21c0500 console=ttyS1,115200 " \
+		"mtdparts=580000000.nor:1M(rcw),2M(u-boot),1M(u-boot-env)," \
+		"6M(reserved-1),3M(mc),1M(dpl),1M(dpc),1M(dtb)," \
+		"16M(kernel),32M(rootfs),64M(otherbank)\0" \
+	"lede_run=cp.b 580f00000 $fdtaddr 100000 && " \
+		"cp.b 581000000 $loadaddr 1000000 && " \
+		"bootm $loadaddr - $fdtaddr\0" \
+	"lede_boot=run lede_setenv;run lede_run\0"
 
 #undef CONFIG_BOOTCOMMAND
 #ifdef CONFIG_QSPI_BOOT
@@ -463,6 +475,15 @@ unsigned long get_board_sys_clk(void);
 			"env exists secureboot && esbc_halt;"
 #endif
 
+#undef CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND						\
+			"fsl_mc start mc 0x580a00000 0x580e00000;"	\
+			"fsl_mc apply dpl 0x580d00000;"		\
+			"run lede_boot;"
+
+#undef CONFIG_BOOTDELAY
+#define CONFIG_BOOTDELAY		3
+
 #undef CONFIG_BOOTARGS
 #define CONFIG_BOOTARGS		"console=ttyS1,115200 root=/dev/ram0 " \
 				"earlycon=uart8250,mmio,0x21c0600 " \
-- 
2.7.4

