diff options
author | Simon Glass <sjg@chromium.org> | 2015-06-23 15:38:51 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-07-21 17:39:25 -0600 |
commit | dc3dedfeb184712cacaf5f0de607fcb9aa9648bc (patch) | |
tree | ffae6626161a8b9b93529d594f703e56bcd52cc5 /common/spl | |
parent | 1169299135d7793dcea5f05a959a9c38d78a0ee1 (diff) | |
download | u-boot-imx-dc3dedfeb184712cacaf5f0de607fcb9aa9648bc.zip u-boot-imx-dc3dedfeb184712cacaf5f0de607fcb9aa9648bc.tar.gz u-boot-imx-dc3dedfeb184712cacaf5f0de607fcb9aa9648bc.tar.bz2 |
dm: mmc: Allow driver model to be used for MMC in SPL
Enable MMC using driver model in SPL for consistency with U-Boot proper.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/spl')
-rw-r--r-- | common/spl/spl_mmc.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 51add39..5f1cfbf 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -7,6 +7,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> +#include <dm.h> #include <spl.h> #include <linux/compiler.h> #include <asm/u-boot.h> @@ -101,9 +102,18 @@ void spl_mmc_load_image(void) { struct mmc *mmc; u32 boot_mode; - int err; + int err = 0; __maybe_unused int part; +#ifdef CONFIG_DM_MMC + struct udevice *dev; + + mmc_initialize(NULL); + err = uclass_get_device(UCLASS_MMC, 0, &dev); + mmc = NULL; + if (!err) + mmc = mmc_get_mmc_dev(dev); +#else mmc_initialize(gd->bd); /* We register only one device. So, the dev id is always 0 */ @@ -114,8 +124,11 @@ void spl_mmc_load_image(void) #endif hang(); } +#endif + + if (!err) + err = mmc_init(mmc); - err = mmc_init(mmc); if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("spl: mmc init failed with error: %d\n", err); |