]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
geam6ul: Add modeboot env via board_late_init
authorJagan Teki <jagan@amarulasolutions.com>
Sat, 6 May 2017 21:13:02 +0000 (02:43 +0530)
committerStefano Babic <sbabic@denx.de>
Thu, 11 May 2017 10:57:44 +0000 (12:57 +0200)
Add runtime, modeboot env which is setting mmcboot, or
nandboot based on the bootdevice so-that conditional
macros b/w MMC and NAND for CONFIG_BOOTCOMMAND should
be avoided in config files.

Cc: Matteo Lisi <matteo.lisi@engicam.com>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
arch/arm/cpu/armv7/mx6/Kconfig
board/engicam/geam6ul/geam6ul.c
include/configs/imx6ul_geam.h

index 8066aaa6fb704acc981dfbf251de8321bf4dd6a5..73504887e733255e778f218e335b31d532e6e89b 100644 (file)
@@ -257,6 +257,7 @@ config TARGET_MX6UL_14X14_EVK
 
 config TARGET_MX6UL_GEAM
        bool "Support Engicam GEAM6UL"
+       select BOARD_LATE_INIT
        select MX6UL
        select OF_CONTROL
        select DM
index 40f20a9bec28c2016262770456f6f6cc59a3604b..29a4830c6a99091202c30e6753acb358877efa3d 100644 (file)
@@ -103,6 +103,25 @@ static void setup_gpmi_nand(void)
 }
 #endif /* CONFIG_NAND_MXS */
 
+int board_late_init(void)
+{
+       switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
+                       IMX6_BMODE_SHIFT) {
+       case IMX6_BMODE_SD:
+       case IMX6_BMODE_ESD:
+               setenv("modeboot", "mmcboot");
+               break;
+       case IMX6_BMODE_NAND:
+               setenv("modeboot", "nandboot");
+               break;
+       default:
+               setenv("modeboot", "");
+               break;
+       }
+
+       return 0;
+}
+
 int board_init(void)
 {
        /* Address of boot parameters */
index 8bffacde4dfc4973f93666a961c571ae9659052f..e9a1a06bd291839686c8e8db11525b0beba9fdde 100644 (file)
@@ -63,7 +63,7 @@
        "fitboot=echo Booting FIT image from mmc ...; " \
                "run mmcargs; " \
                "bootm ${loadaddr}\0" \
-       "mmcboot=echo Booting from mmc ...; " \
+       "_mmcboot=run mmcargs; " \
                "run mmcargs; " \
                "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
                        "if run loadfdt; then " \
                "else " \
                        "bootm; " \
                "fi\0" \
+       "mmcboot=echo Booting from mmc ...; " \
+               "if mmc rescan; then " \
+                       "if run loadbootscript; then " \
+                               "run bootscript; " \
+                       "else " \
+                               "if run loadfit; then " \
+                                       "run fitboot; " \
+                               "else " \
+                                       "if run loadimage; then " \
+                                               "run _mmcboot; " \
+                                       "fi; " \
+                               "fi; " \
+                       "fi; " \
+               "fi\0" \
        "nandboot=echo Booting from nand ...; " \
                "if mtdparts; then " \
                        "echo Starting nand boot ...; " \
                "nand read ${fdt_addr} dtb 0x100000; " \
                "bootm ${loadaddr} - ${fdt_addr}\0"
 
-#ifdef CONFIG_NAND_MXS
-# define CONFIG_BOOTCOMMAND            "run nandboot"
-#else
-# define CONFIG_BOOTCOMMAND \
-       "if mmc rescan; then " \
-               "if run loadbootscript; then " \
-                       "run bootscript; " \
-               "else " \
-                       "if run loadfit; then " \
-                               "run fitboot; " \
-                       "else " \
-                               "if run loadimage; then " \
-                                       "run mmcboot; " \
-                               "fi; " \
-                       "fi; " \
-               "fi; " \
-       "fi"
-#endif
+#define CONFIG_BOOTCOMMAND             "run $modeboot"
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_MEMTEST_START       0x80000000