From 8db786c17a0174b7d4766dc9e4aa7fe1e3ef75b8 Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Thu, 20 Jun 2013 16:52:50 +0800 Subject: ENGR00268061-2 imx6/sabresd: add the dynamtic mmc dev support This patch add the support to load/save env to the slot which was used as the boot media by dynamic detection. The slot(usdhcx) vs real mmc dev number is board dependent: on imx6q/dl sabresd board, the map is as the followings: slot(USDHCx) mmc dev number SD2(USDHC2) 0 SD3(USDHC3) 1 SD4(USDHC4) 2 Signed-off-by: Jason Liu --- board/freescale/mx6qsabresd/mx6qsabresd.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c b/board/freescale/mx6qsabresd/mx6qsabresd.c index a014596..bbe7b32 100644 --- a/board/freescale/mx6qsabresd/mx6qsabresd.c +++ b/board/freescale/mx6qsabresd/mx6qsabresd.c @@ -283,6 +283,24 @@ 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) -- cgit v1.1