summaryrefslogtreecommitdiff
path: root/board/freescale/mx6sabresd
diff options
context:
space:
mode:
authorNitin Garg <nitin.garg@freescale.com>2014-05-27 17:59:14 -0500
committerNitin Garg <nitin.garg@freescale.com>2014-06-13 10:17:00 -0500
commitcaf940dcc880b777365e35294ab757609fc9ac5a (patch)
tree7a5c6e0e84d1488cceae02ed117a1d631ea55540 /board/freescale/mx6sabresd
parent624f876980209f9073e6fb834541efa89192d484 (diff)
downloadu-boot-imx-caf940dcc880b777365e35294ab757609fc9ac5a.zip
u-boot-imx-caf940dcc880b777365e35294ab757609fc9ac5a.tar.gz
u-boot-imx-caf940dcc880b777365e35294ab757609fc9ac5a.tar.bz2
ENGR00315499-11 ARM:imx6 Change static environment SD/MMC storage to dynamic
imx6 boards (sabresd, sabreauto, arm2 and slevk) have multiple SD/MMC ports to boot. But current uboot hard code the SD/MMC port for environment variables storage. So if customer changes a port without modifying the configuration "CONFIG_SYS_MMC_ENV_DEV", error will issue at saving and loading environment. Implement a mechanism to detect SD/MMC port from SRC SMBR register, and override the default "mmc_get_env_devno". The "board_late_mmc_env_init" is used to set "mmcdev" when booting from SD/MMC port. Finally after booting from SD/MMC, the environment storage device and "mmcdev" are both set to current SD/MMC port. Customers don't need to re-build the image if booting from different SD/MMC port. This patch also adds SD1 and SD3 support to imx6slevk BSP, and adds support for sabreauto SD1 slot on base board. Signed-off-by: Ye.Li <B37916@freescale.com> Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
Diffstat (limited to 'board/freescale/mx6sabresd')
-rw-r--r--board/freescale/mx6sabresd/mx6sabresd.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index bdb6b13..0b283a8 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -292,6 +292,23 @@ struct fsl_esdhc_cfg usdhc_cfg[3] = {
{USDHC4_BASE_ADDR},
};
+int mmc_get_env_devno(void)
+{
+ u32 soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
+ u32 dev_no;
+
+ /* BOOT_CFG2[3] and BOOT_CFG2[4] */
+ dev_no = (soc_sbmr & 0x00001800) >> 11;
+
+ /* need ubstract 1 to map to the mmc device id
+ * see the comments in board_mmc_init function
+ */
+
+ dev_no--;
+
+ return dev_no;
+}
+
#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 2)
#define USDHC3_CD_GPIO IMX_GPIO_NR(2, 0)
@@ -358,6 +375,17 @@ int board_mmc_init(bd_t *bis)
return status;
}
+
+void board_late_mmc_env_init(void)
+{
+ char cmd[32];
+ u32 dev_no = mmc_get_env_devno();
+
+ setenv_ulong("mmcdev", dev_no);
+
+ sprintf(cmd, "mmc dev %d", dev_no);
+ run_command(cmd, 0);
+}
#endif
int mx6_rgmii_rework(struct phy_device *phydev)
@@ -641,6 +669,10 @@ int board_late_init(void)
add_board_boot_modes(board_boot_modes);
#endif
+#ifdef CONFIG_ENV_IS_IN_MMC
+ board_late_mmc_env_init();
+#endif
+
return 0;
}