]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
i.MX6Q: icorem6_rqs: Add modeboot env via board_late_init
authorJagan Teki <jagan@amarulasolutions.com>
Fri, 24 Feb 2017 10:15:24 +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 based
on the bootdevice so-that conditional macros for MMC via
CONFIG_BOOTCOMMAND should be avoided in config files.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Matteo Lisi <matteo.lisi@engicam.com>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
board/engicam/icorem6_rqs/icorem6_rqs.c
configs/imx6dl_icore_rqs_mmc_defconfig
configs/imx6q_icore_rqs_mmc_defconfig
include/configs/imx6qdl_icore_rqs.h

index 175bda5860562a14f12b99619b7f2bf26d575fe5..cc7f897f6324e40a3aa03910143bad4c7b662e2f 100644 (file)
@@ -45,6 +45,24 @@ int board_init(void)
        return 0;
 }
 
+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;
+       default:
+               setenv("modeboot", "");
+               break;
+       }
+
+       return 0;
+}
+
 int dram_init(void)
 {
        gd->ram_size = imx_ddr_size();
index 64fa2ec7cd3877bbd9bb1e877da4d3bead88256a..f521292bbf8ba02a70a01fac87fd7ffbfe067802 100644 (file)
@@ -38,3 +38,4 @@ CONFIG_FEC_MXC=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
+CONFIG_BOARD_LATE_INIT=y
index 6bbdfa8981f74f85074bc32952d3b0870627e687..6bd3387b8ecee8cee26e9f80cc17a1e7ff4d5293 100644 (file)
@@ -38,3 +38,4 @@ CONFIG_FEC_MXC=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
+CONFIG_BOARD_LATE_INIT=y
index cd94c5fa9cc6e8e55abf0fd5573bbd28dc9a645c..c62c1d421e73404be12bcedfb58d8b0aaf133a3f 100644 (file)
@@ -56,8 +56,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}; " \
                        "fi; " \
                "else " \
                        "bootm; " \
-               "fi\0"
-
-#define CONFIG_BOOTCOMMAND \
-       "mmc dev ${mmcdev};" \
-       "if mmc rescan; then " \
-               "if run loadbootscript; then " \
-                       "run bootscript; " \
-               "else " \
-                       "if run loadfit; then " \
-                               "run fitboot; " \
+               "fi\0" \
+       "mmcboot=echo Booting from mmc ...; " \
+               "mmc dev ${mmcdev};" \
+               "if mmc rescan; then " \
+                       "if run loadbootscript; then " \
+                               "run bootscript; " \
                        "else " \
-                               "if run loadimage; then " \
-                                       "run mmcboot; " \
+                               "if run loadfit; then " \
+                                       "run fitboot; " \
+                               "else " \
+                                       "if run loadimage; then " \
+                                               "run _mmcboot; " \
+                                       "fi; " \
                                "fi; " \
                        "fi; " \
-               "fi; " \
-       "fi"
+               "fi\0"
+
+#define CONFIG_BOOTCOMMAND             "run $modeboot"
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_MEMTEST_START       0x80000000