summaryrefslogtreecommitdiff
path: root/board/samsung/common/board.c
diff options
context:
space:
mode:
authorPrzemyslaw Marczak <p.marczak@samsung.com>2014-09-01 13:50:45 +0200
committerMinkyu Kang <mk7.kang@samsung.com>2014-09-05 13:58:49 +0900
commit33a4fcf637c306d43109b37d55bb718c069b8cdf (patch)
treeda804557b7074031e043c8a72001ff045873ea8a /board/samsung/common/board.c
parent4fb4d55a353e952b76785507f2487f21acc1e1bf (diff)
board:samsung: check the boot device and init the right mmc driver.
It is possible to boot device using a micro SD or eMMC slots. In this situation, boot device should be registered as a block device 0 in the MMC framework, because CONFIG_SYS_MMC_ENV_DEV is usually set to "0" in the most config cases. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'board/samsung/common/board.c')
-rw-r--r--board/samsung/common/board.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 9dc7c832e6..1fa0e51b3e 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -240,22 +240,39 @@ int board_eth_init(bd_t *bis)
}
#ifdef CONFIG_GENERIC_MMC
-int board_mmc_init(bd_t *bis)
+static int init_mmc(void)
+{
+#ifdef CONFIG_SDHCI
+ return exynos_mmc_init(gd->fdt_blob);
+#else
+ return 0;
+#endif
+}
+
+static int init_dwmmc(void)
{
- int ret;
#ifdef CONFIG_DWMMC
- /* dwmmc initializattion for available channels */
- ret = exynos_dwmmc_init(gd->fdt_blob);
- if (ret)
- debug("dwmmc init failed\n");
+ return exynos_dwmmc_init(gd->fdt_blob);
+#else
+ return 0;
#endif
+}
+
+int board_mmc_init(bd_t *bis)
+{
+ int ret;
+
+ if (get_boot_mode() == BOOT_MODE_SD) {
+ ret = init_mmc();
+ ret |= init_dwmmc();
+ } else {
+ ret = init_dwmmc();
+ ret |= init_mmc();
+ }
-#ifdef CONFIG_SDHCI
- /* mmc initializattion for available channels */
- ret = exynos_mmc_init(gd->fdt_blob);
if (ret)
debug("mmc init failed\n");
-#endif
+
return ret;
}
#endif