icorem6: Add modeboot env via board_late_init

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>
This commit is contained in:
Jagan Teki 2017-05-07 02:43:00 +05:30 committed by Stefano Babic
parent ca10aa7561
commit 32dcfcec56
3 changed files with 36 additions and 20 deletions

View file

@ -173,6 +173,7 @@ config TARGET_MX6QARM2
config TARGET_MX6Q_ICORE
bool "Support Engicam i.Core"
select BOARD_LATE_INIT
select MX6QDL
select OF_CONTROL
select DM

View file

@ -205,6 +205,25 @@ int board_early_init_f(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:
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 */

View file

@ -64,7 +64,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 " \
@ -79,6 +79,20 @@
"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 ...; " \
@ -90,25 +104,7 @@
"nand read ${fdt_addr} dtb 0x100000; " \
"bootm ${loadaddr} - ${fdt_addr}\0"
#ifdef CONFIG_NAND_MXS
# define CONFIG_BOOTCOMMAND "run nandboot"
#else
# define CONFIG_BOOTCOMMAND \
"mmc dev ${mmcdev};" \
"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