arm: ls1021atwr: Add distro boot support
authorAlison Wang <b18965@freescale.com>
Fri, 26 May 2017 07:46:15 +0000 (15:46 +0800)
committerYork Sun <york.sun@nxp.com>
Tue, 1 Aug 2017 15:28:55 +0000 (08:28 -0700)
This patch includes common config_distro_defaults.h and
config_distro_bootcmd.h for u-boot enviroments to support distro boot
which automatically scan boot.scr from storage devices(e.g.
SD/USB/SATA/SCSI disk) and execute autoboot script on LS1021ATWR board.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
configs/ls1021atwr_nor_defconfig
configs/ls1021atwr_sdcard_ifc_defconfig
configs/ls1021atwr_sdcard_qspi_defconfig
include/configs/ls1021atwr.h

index cdbf5a215f9e9466ea5ebab65e98750ba9f2f9bf..29d6ea19a6161f1a662adefd331846d3fd11fd8e 100644 (file)
@@ -45,3 +45,4 @@ CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_STORAGE=y
 CONFIG_VIDEO_FSL_DCU_FB=y
 # CONFIG_VIDEO_SW_CURSOR is not set
+CONFIG_DISTRO_DEFAULTS=y
index b87a6d394dbd0353aa8cb0748f6a86d056fac5f2..86473652764f75b57dc45f0135e1ae332455055c 100644 (file)
@@ -57,3 +57,4 @@ CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_STORAGE=y
 CONFIG_VIDEO_FSL_DCU_FB=y
 # CONFIG_VIDEO_SW_CURSOR is not set
+CONFIG_DISTRO_DEFAULTS=y
index 9ab9e2578cd39f20f9057b934f3a78720abd2e08..b254f3b909ab8129400be48ffb7600693fca51a1 100644 (file)
@@ -64,3 +64,4 @@ CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_STORAGE=y
 CONFIG_VIDEO_FSL_DCU_FB=y
 # CONFIG_VIDEO_SW_CURSOR is not set
+CONFIG_DISTRO_DEFAULTS=y
index b9e5cdbb1ec180671e0d397bc4821294b5205be9..e46324ba8da6a150ec4b38d9c2938dc85c7d6e95 100644 (file)
 #endif
 
 #define CONFIG_CMDLINE_TAG
-#define CONFIG_CMDLINE_EDITING
 
 #define CONFIG_PEN_ADDR_BIG_ENDIAN
 #define CONFIG_LAYERSCAPE_NS_ACCESS
 
 #define CONFIG_FSL_DEVICE_DISABLE
 
+#include <config_distro_defaults.h>
+#define BOOT_TARGET_DEVICES(func) \
+       func(MMC, mmc, 0) \
+       func(USB, usb, 0)
+#include <config_distro_bootcmd.h>
 
 #ifdef CONFIG_LPUART
 #define CONFIG_EXTRA_ENV_SETTINGS       \
        "bootargs=root=/dev/ram0 rw console=ttyLP0,115200\0" \
        "initrd_high=0xffffffff\0"      \
-       "fdt_high=0xffffffff\0"
+       "fdt_high=0xffffffff\0"         \
+       "fdt_addr=0x64f00000\0"         \
+       "kernel_addr=0x65000000\0"      \
+       "scriptaddr=0x80000000\0"       \
+       "fdtheader_addr_r=0x80100000\0" \
+       "kernelheader_addr_r=0x80200000\0"      \
+       "kernel_addr_r=0x81000000\0"    \
+       "fdt_addr_r=0x90000000\0"       \
+       "ramdisk_addr_r=0xa0000000\0"   \
+       "load_addr=0xa0000000\0"        \
+       "kernel_size=0x2800000\0"       \
+       BOOTENV                         \
+       "boot_scripts=ls1021atwr_boot.scr\0"    \
+               "scan_dev_for_boot_part="       \
+                       "part list ${devtype} ${devnum} devplist; "     \
+                       "env exists devplist || setenv devplist 1; "    \
+                       "for distro_bootpart in ${devplist}; do "       \
+                       "if fstype ${devtype} "                         \
+                               "${devnum}:${distro_bootpart} "         \
+                               "bootfstype; then "                     \
+                               "run scan_dev_for_boot; "               \
+                       "fi; "                  \
+               "done\0"                        \
+       "installer=load mmc 0:2 $load_addr "    \
+               "/flex_installer_arm32.itb; "           \
+               "bootm $load_addr#ls1021atwr\0" \
+       "qspi_bootcmd=echo Trying load from qspi..;"    \
+               "sf probe && sf read $load_addr "       \
+               "$kernel_addr $kernel_size && bootm $load_addr#$board\0"        \
+       "nor_bootcmd=echo Trying load from nor..;"      \
+               "cp.b $kernel_addr $load_addr "         \
+               "$kernel_size && bootm $load_addr#$board\0"
 #else
 #define CONFIG_EXTRA_ENV_SETTINGS      \
        "bootargs=root=/dev/ram0 rw console=ttyS0,115200\0" \
        "initrd_high=0xffffffff\0"      \
-       "fdt_high=0xffffffff\0"
+       "fdt_high=0xffffffff\0"         \
+       "fdt_addr=0x64f00000\0"         \
+       "kernel_addr=0x65000000\0"      \
+       "scriptaddr=0x80000000\0"       \
+       "fdtheader_addr_r=0x80100000\0" \
+       "kernelheader_addr_r=0x80200000\0"      \
+       "kernel_addr_r=0x81000000\0"    \
+       "fdt_addr_r=0x90000000\0"       \
+       "ramdisk_addr_r=0xa0000000\0"   \
+       "load_addr=0xa0000000\0"        \
+       "kernel_size=0x2800000\0"       \
+       BOOTENV                         \
+       "boot_scripts=ls1021atwr_boot.scr\0"    \
+               "scan_dev_for_boot_part="       \
+                       "part list ${devtype} ${devnum} devplist; "     \
+                       "env exists devplist || setenv devplist 1; "    \
+                       "for distro_bootpart in ${devplist}; do "       \
+                       "if fstype ${devtype} "                         \
+                               "${devnum}:${distro_bootpart} "         \
+                               "bootfstype; then "                     \
+                               "run scan_dev_for_boot; "               \
+                       "fi; "                  \
+               "done\0"                        \
+       "installer=load mmc 0:2 $load_addr "    \
+               "/flex_installer_arm32.itb; "           \
+               "bootm $load_addr#ls1021atwr\0" \
+       "qspi_bootcmd=echo Trying load from qspi..;"    \
+               "sf probe && sf read $load_addr "       \
+               "$kernel_addr $kernel_size && bootm $load_addr#$board\0"        \
+       "nor_bootcmd=echo Trying load from nor..;"      \
+               "cp.b $kernel_addr $load_addr "         \
+               "$kernel_size && bootm $load_addr#$board\0"
 #endif
 
+#undef CONFIG_BOOTCOMMAND
+#if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
+#define CONFIG_BOOTCOMMAND "run distro_bootcmd;run qspi_bootcmd"
+#else
+#define CONFIG_BOOTCOMMAND "run distro_bootcmd;run nor_bootcmd"
+#endif
+
+#define CONFIG_BOOTARGS                        "console=ttyS0,115200 root=/dev/ram0"
+
 /*
  * Miscellaneous configurable options
  */