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 16:53:35 +0800
commit8db786c17a0174b7d4766dc9e4aa7fe1e3ef75b8 (patch)
treeb16bb006da585b1bc1d24530edd2edeabca2be00
parentc2467dcf0898df43a4140d998843f3d304dc9b60 (diff)
downloadu-boot-imx-8db786c17a0174b7d4766dc9e4aa7fe1e3ef75b8.zip
u-boot-imx-8db786c17a0174b7d4766dc9e4aa7fe1e3ef75b8.tar.gz
u-boot-imx-8db786c17a0174b7d4766dc9e4aa7fe1e3ef75b8.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)