diff options
author | Ye.Li <B37916@freescale.com> | 2014-06-26 19:25:09 +0800 |
---|---|---|
committer | Ye.Li <B37916@freescale.com> | 2014-06-30 11:36:41 +0800 |
commit | db5a2a8658a2bf9f8aff74b41b2b5d98cf6d226f (patch) | |
tree | f70c5bb35d29dc63b94bdafeee31cd723c516b0e /board/freescale/mx6qarm2 | |
parent | b9bcfccc94d2abe9922ea311825e42888db1a3a7 (diff) | |
download | u-boot-imx-db5a2a8658a2bf9f8aff74b41b2b5d98cf6d226f.zip u-boot-imx-db5a2a8658a2bf9f8aff74b41b2b5d98cf6d226f.tar.gz u-boot-imx-db5a2a8658a2bf9f8aff74b41b2b5d98cf6d226f.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>
(cherry picked from commit 7feb8533f52677f641e3ff88a996cd3f1f722708)
Diffstat (limited to 'board/freescale/mx6qarm2')
-rw-r--r-- | board/freescale/mx6qarm2/mx6qarm2.c | 33 |
1 files changed, 33 insertions, 0 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); } |