summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe.Li <B37916@freescale.com>2014-06-26 19:25:09 +0800
committerYe.Li <B37916@freescale.com>2014-06-30 11:31:43 +0800
commit7feb8533f52677f641e3ff88a996cd3f1f722708 (patch)
treef70c5bb35d29dc63b94bdafeee31cd723c516b0e
parent987c48c07c9ef62fa3fe55faa6f7369b30637127 (diff)
downloadu-boot-imx-7feb8533f52677f641e3ff88a996cd3f1f722708.zip
u-boot-imx-7feb8533f52677f641e3ff88a996cd3f1f722708.tar.gz
u-boot-imx-7feb8533f52677f641e3ff88a996cd3f1f722708.tar.bz2
ENGR00320125 iMX6: Change to use dynamical mmcroot
The kernel changes to fix the mmcblk index with USDHC controllers as below: mmcblk0 ---> USDHC1 mmcblk1 ---> USDHC2 mmcblk2 ---> USDHC3 mmcblk3 ---> USDHC4 So in u-boot, the "mmcroot" must be updated together. When booting from SD/MMC device, change the "mmcroot" to dynamically set according to the boot USDHC controller. It is the same mechanism as "mmcdev" used for kernel image loading. Therefore, the uboot, kernel image, dtb and rootfs are required in same SD/MMC card. To disable the mmc dynamical detection, set the "mmcautodetect" to "no", then "mmcroot" and "mmcdev" will not be overwritten. When booting from other devices which needs to load kernel, dtb and rootfs from SD/MMC card, their "mmcdev" reset vaule is CONFIG_SYS_MMC_ENV_DEV and "mmcroot" reset value is CONFIG_MMCROOT. Signed-off-by: Ye.Li <B37916@freescale.com>
-rw-r--r--board/freescale/mx6qarm2/mx6qarm2.c33
-rw-r--r--board/freescale/mx6qsabreauto/mx6qsabreauto.c36
-rw-r--r--board/freescale/mx6sabresd/mx6sabresd.c33
-rw-r--r--board/freescale/mx6slevk/mx6slevk.c33
-rw-r--r--board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c41
-rw-r--r--board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c34
-rw-r--r--board/freescale/mx6sxsabresd/mx6sxsabresd.c36
-rw-r--r--include/configs/mx6qarm2.h8
-rw-r--r--include/configs/mx6qsabreauto.h4
-rw-r--r--include/configs/mx6sabre_common.h17
-rw-r--r--include/configs/mx6sabresd.h2
-rw-r--r--include/configs/mx6slevk.h8
-rw-r--r--include/configs/mx6sx_17x17_arm2.h6
-rw-r--r--include/configs/mx6sx_19x19_arm2.h4
-rw-r--r--include/configs/mx6sx_arm2.h19
-rw-r--r--include/configs/mx6sxsabresd.h6
16 files changed, 272 insertions, 48 deletions
diff --git a/board/freescale/mx6qarm2/mx6qarm2.c b/board/freescale/mx6qarm2/mx6qarm2.c
index de76c99..9ae8aef 100644
--- a/board/freescale/mx6qarm2/mx6qarm2.c
+++ b/board/freescale/mx6qarm2/mx6qarm2.c
@@ -108,6 +108,13 @@ int mmc_get_env_devno(void)
{
u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
u32 dev_no;
+ u32 bootsel;
+
+ bootsel = (soc_sbmr & 0x000000FF) >> 6 ;
+
+ /* If not boot from sd/mmc, use default value */
+ if (bootsel != 1)
+ return CONFIG_SYS_MMC_ENV_DEV;
/* BOOT_CFG2[3] and BOOT_CFG2[4] */
dev_no = (soc_sbmr & 0x00001800) >> 11;
@@ -121,6 +128,11 @@ int mmc_get_env_devno(void)
return dev_no;
}
+int mmc_map_to_kernel_blk(int dev_no)
+{
+ return dev_no + 2;
+}
+
int board_mmc_getcd(struct mmc *mmc)
{
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
@@ -166,13 +178,34 @@ int board_mmc_init(bd_t *bis)
return status;
}
+int check_mmc_autodetect(void)
+{
+ char *autodetect_str = getenv("mmcautodetect");
+
+ if ((autodetect_str != NULL) &&
+ (strcmp(autodetect_str, "yes") == 0)) {
+ return 1;
+ }
+
+ return 0;
+}
+
void board_late_mmc_env_init(void)
{
char cmd[32];
+ char mmcblk[32];
u32 dev_no = mmc_get_env_devno();
+ if (!check_mmc_autodetect())
+ return;
+
setenv_ulong("mmcdev", dev_no);
+ /* Set mmcblk env */
+ sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
+ mmc_map_to_kernel_blk(dev_no));
+ setenv("mmcroot", mmcblk);
+
sprintf(cmd, "mmc dev %d", dev_no);
run_command(cmd, 0);
}
diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
index ca2b290..9663013 100644
--- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c
+++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
@@ -341,6 +341,13 @@ int mmc_get_env_devno(void)
{
u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
u32 dev_no;
+ u32 bootsel;
+
+ bootsel = (soc_sbmr & 0x000000FF) >> 6 ;
+
+ /* If not boot from sd/mmc, use default value */
+ if (bootsel != 1)
+ return CONFIG_SYS_MMC_ENV_DEV;
/* BOOT_CFG2[3] and BOOT_CFG2[4] */
dev_no = (soc_sbmr & 0x00001800) >> 11;
@@ -354,6 +361,14 @@ int mmc_get_env_devno(void)
return dev_no;
}
+int mmc_map_to_kernel_blk(int dev_no)
+{
+ if (1 == dev_no)
+ dev_no = 2;
+
+ return dev_no;
+}
+
int board_mmc_getcd(struct mmc *mmc)
{
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
@@ -408,13 +423,34 @@ int board_mmc_init(bd_t *bis)
return 0;
}
+int check_mmc_autodetect(void)
+{
+ char *autodetect_str = getenv("mmcautodetect");
+
+ if ((autodetect_str != NULL) &&
+ (strcmp(autodetect_str, "yes") == 0)) {
+ return 1;
+ }
+
+ return 0;
+}
+
void board_late_mmc_env_init(void)
{
char cmd[32];
+ char mmcblk[32];
u32 dev_no = mmc_get_env_devno();
+ if (!check_mmc_autodetect())
+ return;
+
setenv_ulong("mmcdev", dev_no);
+ /* Set mmcblk env */
+ sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
+ mmc_map_to_kernel_blk(dev_no));
+ setenv("mmcroot", mmcblk);
+
sprintf(cmd, "mmc dev %d", dev_no);
run_command(cmd, 0);
}
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 4111e0d..2a4f425 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -457,6 +457,13 @@ int mmc_get_env_devno(void)
{
u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
u32 dev_no;
+ u32 bootsel;
+
+ bootsel = (soc_sbmr & 0x000000FF) >> 6 ;
+
+ /* If not boot from sd/mmc, use default value */
+ if (bootsel != 1)
+ return CONFIG_SYS_MMC_ENV_DEV;
/* BOOT_CFG2[3] and BOOT_CFG2[4] */
dev_no = (soc_sbmr & 0x00001800) >> 11;
@@ -470,6 +477,11 @@ int mmc_get_env_devno(void)
return dev_no;
}
+int mmc_map_to_kernel_blk(int dev_no)
+{
+ return dev_no + 1;
+}
+
#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 2)
#define USDHC3_CD_GPIO IMX_GPIO_NR(2, 0)
@@ -537,13 +549,34 @@ int board_mmc_init(bd_t *bis)
return status;
}
+int check_mmc_autodetect(void)
+{
+ char *autodetect_str = getenv("mmcautodetect");
+
+ if ((autodetect_str != NULL) &&
+ (strcmp(autodetect_str, "yes") == 0)) {
+ return 1;
+ }
+
+ return 0;
+}
+
void board_late_mmc_env_init(void)
{
char cmd[32];
+ char mmcblk[32];
u32 dev_no = mmc_get_env_devno();
+ if (!check_mmc_autodetect())
+ return;
+
setenv_ulong("mmcdev", dev_no);
+ /* Set mmcblk env */
+ sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
+ mmc_map_to_kernel_blk(dev_no));
+ setenv("mmcroot", mmcblk);
+
sprintf(cmd, "mmc dev %d", dev_no);
run_command(cmd, 0);
}
diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index 752dad8..1f24f03 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -242,6 +242,13 @@ int mmc_get_env_devno(void)
{
u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
u32 dev_no;
+ u32 bootsel;
+
+ bootsel = (soc_sbmr & 0x000000FF) >> 6 ;
+
+ /* If not boot from sd/mmc, use default value */
+ if (bootsel != 1)
+ return CONFIG_SYS_MMC_ENV_DEV;
/* BOOT_CFG2[3] and BOOT_CFG2[4] */
dev_no = (soc_sbmr & 0x00001800) >> 11;
@@ -249,6 +256,11 @@ int mmc_get_env_devno(void)
return dev_no;
}
+int mmc_map_to_kernel_blk(int dev_no)
+{
+ return dev_no;
+}
+
int board_mmc_getcd(struct mmc *mmc)
{
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
@@ -313,13 +325,34 @@ int board_mmc_init(bd_t *bis)
return 0;
}
+int check_mmc_autodetect(void)
+{
+ char *autodetect_str = getenv("mmcautodetect");
+
+ if ((autodetect_str != NULL) &&
+ (strcmp(autodetect_str, "yes") == 0)) {
+ return 1;
+ }
+
+ return 0;
+}
+
void board_late_mmc_env_init(void)
{
char cmd[32];
+ char mmcblk[32];
u32 dev_no = mmc_get_env_devno();
+ if (!check_mmc_autodetect())
+ return;
+
setenv_ulong("mmcdev", dev_no);
+ /* Set mmcblk env */
+ sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
+ mmc_map_to_kernel_blk(dev_no));
+ setenv("mmcroot", mmcblk);
+
sprintf(cmd, "mmc dev %d", dev_no);
run_command(cmd, 0);
}
diff --git a/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c b/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c
index a793049..8ddaded 100644
--- a/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c
+++ b/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c
@@ -235,6 +235,13 @@ int mmc_get_env_devno(void)
{
u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
u32 dev_no;
+ u32 bootsel;
+
+ bootsel = (soc_sbmr & 0x000000FF) >> 6 ;
+
+ /* If not boot from sd/mmc, use default value */
+ if (bootsel != 1)
+ return CONFIG_SYS_MMC_ENV_DEV;
/* BOOT_CFG2[3] and BOOT_CFG2[4] */
dev_no = (soc_sbmr & 0x00001800) >> 11;
@@ -243,11 +250,24 @@ int mmc_get_env_devno(void)
* see the comments in board_mmc_init function
*/
+#ifdef CONFIG_SYS_USE_SPINOR
+ dev_no -= 2;
+#else
dev_no--;
+#endif
return dev_no;
}
+int mmc_map_to_kernel_blk(int dev_no)
+{
+#ifdef CONFIG_SYS_USE_SPINOR
+ return dev_no + 2;
+#else
+ return dev_no + 1;
+#endif
+}
+
int board_mmc_getcd(struct mmc *mmc)
{
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
@@ -349,13 +369,34 @@ int board_mmc_init(bd_t *bis)
}
#endif
+int check_mmc_autodetect(void)
+{
+ char *autodetect_str = getenv("mmcautodetect");
+
+ if ((autodetect_str != NULL) &&
+ (strcmp(autodetect_str, "yes") == 0)) {
+ return 1;
+ }
+
+ return 0;
+}
+
void board_late_mmc_init(void)
{
char cmd[32];
+ char mmcblk[32];
u32 dev_no = mmc_get_env_devno();
+ if (!check_mmc_autodetect())
+ return;
+
setenv_ulong("mmcdev", dev_no);
+ /* Set mmcblk env */
+ sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
+ mmc_map_to_kernel_blk(dev_no));
+ setenv("mmcroot", mmcblk);
+
sprintf(cmd, "mmc dev %d", dev_no);
run_command(cmd, 0);
}
diff --git a/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c b/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c
index 0b29b8c..70fe481 100644
--- a/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c
+++ b/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c
@@ -361,12 +361,25 @@ int mmc_get_env_devno(void)
{
u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
u32 dev_no;
+ u32 bootsel;
+
+ bootsel = (soc_sbmr & 0x000000FF) >> 6 ;
+
+ /* If not boot from sd/mmc, use default value */
+ if (bootsel != 1)
+ return CONFIG_SYS_MMC_ENV_DEV;
/* BOOT_CFG2[3] and BOOT_CFG2[4] */
dev_no = (soc_sbmr & 0x00001800) >> 11;
return dev_no;
}
+
+int mmc_map_to_kernel_blk(int dev_no)
+{
+ return dev_no;
+}
+
int board_mmc_getcd(struct mmc *mmc)
{
return 1; /* Assume boot SD always present */
@@ -384,13 +397,34 @@ int board_mmc_init(bd_t *bis)
return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
}
+int check_mmc_autodetect(void)
+{
+ char *autodetect_str = getenv("mmcautodetect");
+
+ if ((autodetect_str != NULL) &&
+ (strcmp(autodetect_str, "yes") == 0)) {
+ return 1;
+ }
+
+ return 0;
+}
+
void board_late_mmc_init(void)
{
char cmd[32];
+ char mmcblk[32];
u32 dev_no = mmc_get_env_devno();
+ if (!check_mmc_autodetect())
+ return;
+
setenv_ulong("mmcdev", dev_no);
+ /* Set mmcblk env */
+ sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
+ mmc_map_to_kernel_blk(dev_no));
+ setenv("mmcroot", mmcblk);
+
sprintf(cmd, "mmc dev %d", dev_no);
run_command(cmd, 0);
}
diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index c0f35f3..aecc00b 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -289,6 +289,13 @@ int mmc_get_env_devno(void)
{
u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
int dev_no;
+ u32 bootsel;
+
+ bootsel = (soc_sbmr & 0x000000FF) >> 6 ;
+
+ /* If not boot from sd/mmc, use default value */
+ if (bootsel != 1)
+ return CONFIG_SYS_MMC_ENV_DEV;
/* BOOT_CFG2[3] and BOOT_CFG2[4] */
dev_no = (soc_sbmr & 0x00001800) >> 11;
@@ -299,12 +306,14 @@ int mmc_get_env_devno(void)
dev_no--;
- if (dev_no < 0)
- dev_no = CONFIG_SYS_MMC_ENV_DEV;
-
return dev_no;
}
+int mmc_map_to_kernel_blk(int dev_no)
+{
+ return dev_no + 1;
+}
+
int board_mmc_getcd(struct mmc *mmc)
{
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
@@ -379,13 +388,34 @@ int board_mmc_init(bd_t *bis)
return 0;
}
+int check_mmc_autodetect(void)
+{
+ char *autodetect_str = getenv("mmcautodetect");
+
+ if ((autodetect_str != NULL) &&
+ (strcmp(autodetect_str, "yes") == 0)) {
+ return 1;
+ }
+
+ return 0;
+}
+
void board_late_mmc_init(void)
{
char cmd[32];
+ char mmcblk[32];
u32 dev_no = mmc_get_env_devno();
+ if (!check_mmc_autodetect())
+ return;
+
setenv_ulong("mmcdev", dev_no);
+ /* Set mmcblk env */
+ sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
+ mmc_map_to_kernel_blk(dev_no));
+ setenv("mmcroot", mmcblk);
+
sprintf(cmd, "mmc dev %d", dev_no);
run_command(cmd, 0);
}
diff --git a/include/configs/mx6qarm2.h b/include/configs/mx6qarm2.h
index 05fb579..27e9ad0 100644
--- a/include/configs/mx6qarm2.h
+++ b/include/configs/mx6qarm2.h
@@ -95,9 +95,10 @@
"initrd_high=0xffffffff\0" \
"boot_fdt=try\0" \
"ip_dyn=yes\0" \
- "mmcdev=1\0" \
+ "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
"mmcpart=1\0" \
- "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \
+ "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+ "mmcautodetect=yes\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
"root=${mmcroot}\0" \
"loadbootscript=" \
@@ -204,8 +205,9 @@
#define CONFIG_ENV_OFFSET (8 * 64 * 1024)
#define CONFIG_ENV_SIZE (8 * 1024)
#define CONFIG_ENV_IS_IN_MMC
-#define CONFIG_SYS_MMC_ENV_DEV 1
+#define CONFIG_SYS_MMC_ENV_DEV 1 /* SDHC4 */
#define CONFIG_SYS_MMC_ENV_PART 0 /* user partition */
+#define CONFIG_MMCROOT "/dev/mmcblk3p2" /* SDHC4 */
#define CONFIG_OF_LIBFDT
#define CONFIG_CMD_BOOTZ
diff --git a/include/configs/mx6qsabreauto.h b/include/configs/mx6qsabreauto.h
index 133e218..48e64e5 100644
--- a/include/configs/mx6qsabreauto.h
+++ b/include/configs/mx6qsabreauto.h
@@ -12,7 +12,7 @@
#define CONFIG_MACH_TYPE 3529
#define CONFIG_MXC_UART_BASE UART4_BASE
#define CONFIG_CONSOLE_DEV "ttymxc3"
-#define CONFIG_MMCROOT "/dev/mmcblk0p2"
+#define CONFIG_MMCROOT "/dev/mmcblk2p2" /* SDHC3 */
#define CONFIG_SYS_USE_NAND
@@ -40,7 +40,7 @@
#endif
#define CONFIG_SYS_FSL_USDHC_NUM 2
-#define CONFIG_SYS_MMC_ENV_DEV 1
+#define CONFIG_SYS_MMC_ENV_DEV 1 /* SDHC3 */
#define CONFIG_SYS_MMC_ENV_PART 0 /* user partition */
#ifdef CONFIG_SYS_USE_SPINOR
diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h
index b74b752..9962e3d 100644
--- a/include/configs/mx6sabre_common.h
+++ b/include/configs/mx6sabre_common.h
@@ -104,19 +104,6 @@
#define CONFIG_MFG_NAND_PARTITION ""
#endif
-/*
- * For the SPI/WEIM NOR, it can't store all the images into it due to it's
- * capacity, we need one default mmc device to load the left image or rootfs.
- * The end user need change the default setting according to their needs.
- * For NAND/SATA boot, the storage is big enough to hold all the stuff.
- * For SD/MMC boot, mmcdev is dynamiclly created due to the boot SD/MMC slot.
- */
-#if defined(CONFIG_SYS_BOOT_EIMNOR) || defined(CONFIG_SYS_BOOT_SPINOR)
-#define CONFIG_MMC_DEV_SET "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV)
-#else
-#define CONFIG_MMC_DEV_SET " "
-#endif
-
#define CONFIG_MFG_ENV_SETTINGS \
"mfgtool_args=setenv bootargs console=" CONFIG_CONSOLE_DEV ",115200 " \
"rdinit=/linuxrc " \
@@ -177,10 +164,10 @@
"console=" CONFIG_CONSOLE_DEV "\0" \
"fdt_high=0xffffffff\0" \
"initrd_high=0xffffffff\0" \
- CONFIG_MMC_DEV_SET \
- "\0" \
+ "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+ "mmcautodetect=yes\0" \
"update_sd_firmware=" \
"if test ${ip_dyn} = yes; then " \
"setenv get_cmd dhcp; " \
diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h
index e12d084..ed85b84 100644
--- a/include/configs/mx6sabresd.h
+++ b/include/configs/mx6sabresd.h
@@ -15,7 +15,7 @@
#define CONFIG_MACH_TYPE 3980
#define CONFIG_MXC_UART_BASE UART1_BASE
#define CONFIG_CONSOLE_DEV "ttymxc0"
-#define CONFIG_MMCROOT "/dev/mmcblk0p2"
+#define CONFIG_MMCROOT "/dev/mmcblk2p2" /* SDHC3 */
#include "mx6sabre_common.h"
diff --git a/include/configs/mx6slevk.h b/include/configs/mx6slevk.h
index 84078c1..f46fca8 100644
--- a/include/configs/mx6slevk.h
+++ b/include/configs/mx6slevk.h
@@ -120,9 +120,10 @@
"fdt_addr=0x83000000\0" \
"boot_fdt=try\0" \
"ip_dyn=yes\0" \
- "mmcdev=1\0" \
+ "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
"mmcpart=1\0" \
- "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \
+ "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+ "mmcautodetect=yes\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
"root=${mmcroot}\0" \
"loadbootscript=" \
@@ -221,8 +222,9 @@
#define CONFIG_SYS_NO_FLASH
#define CONFIG_ENV_SIZE SZ_8K
-#define CONFIG_SYS_MMC_ENV_DEV 1
+#define CONFIG_SYS_MMC_ENV_DEV 1 /* USDHC2 */
#define CONFIG_SYS_MMC_ENV_PART 0 /* user partition */
+#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
#if defined CONFIG_SYS_BOOT_SPINOR
#define CONFIG_SYS_USE_SPINOR
diff --git a/include/configs/mx6sx_17x17_arm2.h b/include/configs/mx6sx_17x17_arm2.h
index 9db44cf..bedb1db 100644
--- a/include/configs/mx6sx_17x17_arm2.h
+++ b/include/configs/mx6sx_17x17_arm2.h
@@ -13,12 +13,14 @@
#ifdef CONFIG_SYS_USE_SPINOR /* Pin conflict between SPI-NOR and SD2 */
#define CONFIG_SYS_FSL_USDHC_NUM 2
-#define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_SYS_MMC_ENV_DEV 0 /* USDHC3 */
#define CONFIG_SYS_MMC_ENV_PART 0 /* user area */
+#define CONFIG_MMCROOT "/dev/mmcblk2p2" /* USDHC3 */
#else
#define CONFIG_SYS_FSL_USDHC_NUM 3
-#define CONFIG_SYS_MMC_ENV_DEV 1
+#define CONFIG_SYS_MMC_ENV_DEV 1 /* USDHC3 */
#define CONFIG_SYS_MMC_ENV_PART 0 /* user area */
+#define CONFIG_MMCROOT "/dev/mmcblk2p2" /* USDHC3 */
#endif
#ifdef CONFIG_SYS_USE_EIMNOR
diff --git a/include/configs/mx6sx_19x19_arm2.h b/include/configs/mx6sx_19x19_arm2.h
index c6265fd..e2bb434 100644
--- a/include/configs/mx6sx_19x19_arm2.h
+++ b/include/configs/mx6sx_19x19_arm2.h
@@ -15,6 +15,8 @@
#include "mx6sx_arm2.h"
#define CONFIG_SYS_FSL_USDHC_NUM 1
-#define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_SYS_MMC_ENV_DEV 0 /* USDHC1 */
#define CONFIG_SYS_MMC_ENV_PART 0 /* user area */
+#define CONFIG_MMCROOT "/dev/mmcblk0p2" /* USDHC1 */
+
#endif
diff --git a/include/configs/mx6sx_arm2.h b/include/configs/mx6sx_arm2.h
index 2168fc6..6a7b7bc 100644
--- a/include/configs/mx6sx_arm2.h
+++ b/include/configs/mx6sx_arm2.h
@@ -148,19 +148,6 @@
#define CONFIG_MFG_NAND_PARTITION ""
#endif
-/*
- * For the SPI/WEIM NOR, it can't store all the images into it due to it's
- * capacity, we need one default mmc device to load the left image or rootfs.
- * The end user need change the default setting according to their needs.
- * For NAND/SATA boot, the storage is big enough to hold all the stuff.
- * For SD/MMC boot, mmcdev is dynamiclly created due to the boot SD/MMC slot.
- */
-#if defined(CONFIG_SYS_BOOT_EIMNOR) || defined(CONFIG_SYS_BOOT_SPINOR) || defined(CONFIG_SYS_BOOT_QSPI)
-#define CONFIG_MMC_DEV_SET "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV)
-#else
-#define CONFIG_MMC_DEV_SET " "
-#endif
-
#ifdef CONFIG_VIDEO
#define CONFIG_VIDEO_MODE \
"panel=Hannstar-XGA\0"
@@ -207,10 +194,10 @@
"fdt_addr=0x83000000\0" \
"boot_fdt=try\0" \
"ip_dyn=yes\0" \
- CONFIG_MMC_DEV_SET \
- "\0" \
+ "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
- "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \
+ "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+ "mmcautodetect=yes\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
"root=${mmcroot}\0" \
"loadbootscript=" \
diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index c92e1f2..38a2c22 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -183,9 +183,10 @@
"fdt_addr=0x83000000\0" \
"boot_fdt=try\0" \
"ip_dyn=yes\0" \
- "mmcdev=2\0" \
+ "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
"mmcpart=1\0" \
- "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \
+ "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+ "mmcautodetect=yes\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
"root=${mmcroot}\0" \
"loadbootscript=" \
@@ -314,6 +315,7 @@
#define CONFIG_SYS_MMC_ENV_DEV 2 /*USDHC4*/
#define CONFIG_SYS_MMC_ENV_PART 0 /* user area */
+#define CONFIG_MMCROOT "/dev/mmcblk3p2" /* USDHC4 */
#if defined(CONFIG_ENV_IS_IN_MMC)
#define CONFIG_ENV_OFFSET (8 * SZ_64K)