i.MX6Q: icorem6_rqs: Add modeboot env via board_late_init

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>
This commit is contained in:
Jagan Teki 2017-02-24 15:45:24 +05:30 committed by Stefano Babic
parent ffa11c3381
commit 8c998a85a3
4 changed files with 36 additions and 16 deletions

View 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();

View 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

View 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

View 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}; " \
@ -70,23 +69,24 @@
"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