armv8: ls2080ardb: Add sd_bootcmd for distro fallback in case of sdboot
authorShengzhou Liu <Shengzhou.Liu@nxp.com>
Thu, 9 Nov 2017 09:57:58 +0000 (17:57 +0800)
committerYork Sun <york.sun@nxp.com>
Wed, 15 Nov 2017 18:56:35 +0000 (10:56 -0800)
Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
include/configs/ls2080ardb.h

index 48c3a5397f7464250f77267afed9eb046a2f95c9..650db2f594d5daf7501486ee7accdfe6275d38ec 100644 (file)
@@ -349,6 +349,17 @@ unsigned long get_board_sys_clk(void);
        "esbc_validate 0x20700000 && "          \
        "esbc_validate 0x20740000;"             \
        "fsl_mc start mc 0x20a00000 0x20e00000 \0"
+#elif defined(CONFIG_SD_BOOT)
+#define MC_INIT_CMD                             \
+       "mcinitcmd=mmcinfo;mmc read 0x80000000 0x5000 0x800;" \
+       "mmc read 0x80100000 0x7000 0x800;"     \
+       "env exists secureboot && "             \
+       "mmc read 0x80700000 0x3800 0x10 && "   \
+       "mmc read 0x80740000 0x3A00 0x10 && "   \
+       "esbc_validate 0x80700000 && "          \
+       "esbc_validate 0x80740000 ;"            \
+       "fsl_mc start mc 0x80000000 0x80100000\0" \
+       "mcmemsize=0x70000000\0"
 #else
 #define MC_INIT_CMD                            \
        "mcinitcmd=env exists secureboot && "   \
@@ -379,8 +390,14 @@ unsigned long get_board_sys_clk(void);
        "fdt_addr_r=0x90000000\0"               \
        "load_addr=0xa0000000\0"                \
        "kernel_size=0x2800000\0"               \
+       "kernel_addr_sd=0x8000\0"               \
+       "kernel_size_sd=0x14000\0"              \
        "console=ttyAMA0,38400n8\0"             \
        "mcmemsize=0x70000000\0"                \
+       "sd_bootcmd=echo Trying load from SD ..;" \
+       "mmcinfo; mmc read $load_addr "         \
+       "$kernel_addr_sd $kernel_size_sd && "   \
+       "bootm $load_addr#$board\0"             \
        MC_INIT_CMD                             \
        BOOTENV                                 \
        "boot_scripts=ls2088ardb_boot.scr\0"    \
@@ -409,9 +426,6 @@ unsigned long get_board_sys_clk(void);
                        "${scripthdraddr} ${prefix}${boot_script_hdr} " \
                        "&& esbc_validate ${scripthdraddr};"    \
                "source ${scriptaddr}\0"                        \
-       "installer=load mmc 0:2 $load_addr "                    \
-               "/flex_installer_arm64.itb; "                   \
-               "bootm $load_addr#ls2088ardb\0"                 \
        "qspi_bootcmd=echo Trying load from qspi..;"            \
                "sf probe && sf read $load_addr "               \
                "$kernel_start $kernel_size ; env exists secureboot &&" \
@@ -433,16 +447,27 @@ unsigned long get_board_sys_clk(void);
                        "&& esbc_validate 0x20780000; "                 \
                        "env exists mcinitcmd && "                      \
                        "fsl_mc lazyapply dpl 0x20d00000; "             \
-                       "run distro_bootcmd;run qspi_bootcmd; "         \
-                       "env exists secureboot && esbc_halt; "
+                       "run distro_bootcmd;env exists secureboot "     \
+                       " && esbc_halt;run qspi_bootcmd; "
+#elif defined(CONFIG_SD_BOOT)
+/* Try to boot an on-SD kernel first, then do normal distro boot */
+#define CONFIG_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 distro_bootcmd;env exists secureboot "     \
+                       "&& esbc_halt;run sd_bootcmd;"
 #else
 /* Try to boot an on-NOR kernel first, then do normal distro boot */
 #define CONFIG_BOOTCOMMAND                                             \
                        "env exists mcinitcmd && env exists secureboot "\
                        "&& esbc_validate 0x580780000; env exists mcinitcmd "\
                        "&& fsl_mc lazyapply dpl 0x580d00000;"          \
-                       "run distro_bootcmd;run nor_bootcmd; "          \
-                       "env exists secureboot && esbc_halt; "
+                       "run distro_bootcmd; env exists secureboot "    \
+                       "&& esbc_halt; run nor_bootcmd;"
 #endif
 
 /* MAC/PHY configuration */