summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Liu <r64343@freescale.com>2013-06-20 16:52:50 +0800
committerJason Liu <r64343@freescale.com>2013-06-20 18:04:17 +0800
commitdccc698c3571eaa9d8a04ad77787b5d0d716e0de (patch)
treeb16bb006da585b1bc1d24530edd2edeabca2be00
parent264ad1a3bb3051aebed6c7c4c408a3629ad89210 (diff)
downloadu-boot-imx-dccc698c3571eaa9d8a04ad77787b5d0d716e0de.zip
u-boot-imx-dccc698c3571eaa9d8a04ad77787b5d0d716e0de.tar.gz
u-boot-imx-dccc698c3571eaa9d8a04ad77787b5d0d716e0de.tar.bz2
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 <r64343@freescale.com>
-rw-r--r--board/freescale/mx6qsabresd/mx6qsabresd.c18
1 files changed, 18 insertions, 0 deletions
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)