]> git.sur5r.net Git - u-boot/commitdiff
i.MX6UL: isiot: Add modeboot env via board_late_init
authorJagan Teki <jagan@amarulasolutions.com>
Fri, 24 Feb 2017 10:15:18 +0000 (15:45 +0530)
committerStefano Babic <sbabic@denx.de>
Fri, 17 Mar 2017 08:27:08 +0000 (09:27 +0100)
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>
Reviewed by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
board/engicam/isiotmx6ul/isiotmx6ul.c
configs/imx6ul_isiot_emmc_defconfig
configs/imx6ul_isiot_mmc_defconfig
configs/imx6ul_isiot_nand_defconfig
include/configs/imx6ul_isiot.h

index 9cde4fc8f238d166c49f6199474cba35a551a8dc..0e607e0da07bc4c466ca251efb904974a2ed1de6 100644 (file)
@@ -103,6 +103,27 @@ 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:
+       case IMX6_BMODE_MMC:
+       case IMX6_BMODE_EMMC:
+               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 94fe80866dcbc7dabf387f9dad92801d38a11b58..4c3664f320f2c8f5c7c53cc66ddfb899c94e4d79 100644 (file)
@@ -37,3 +37,4 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_BOARD_LATE_INIT=y
index 8ecdd8e569126b340ec8f1bd85ccc9fc8f33e851..ea2d378dff88b3dd91abea0b2a9dd26c059af736 100644 (file)
@@ -39,3 +39,4 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_BOARD_LATE_INIT=y
index 6f1a05471f94a42461c7a5bfba4abe1d7d94f0fa..f02a2ac242b75aa5ea322ad4f9eb5f316f77c1ca 100644 (file)
@@ -40,3 +40,4 @@ CONFIG_PINCTRL_IMX6=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_BOARD_LATE_INIT=y
index 1b0e43636ed0dc3f9f65ba9ea1aacdf029a140d6..7258fed79b7d8b37cc7be6ed1197d7647443a238 100644 (file)
@@ -64,8 +64,7 @@
        "fitboot=echo Booting FIT image from mmc ...; " \
                "run mmcargs; " \
                "bootm ${loadaddr}\0" \
-       "mmcboot=echo Booting from mmc ...; " \
-               "run mmcargs; " \
+       "_mmcboot=run mmcargs; " \
                "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
                        "if run loadfdt; then " \
                                "bootm ${loadaddr} - ${fdt_addr}; " \
                "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