diff options
author | Lokesh Vutla <lokeshvutla@ti.com> | 2019-09-09 12:10:36 +0300 |
---|---|---|
committer | Peng Fan <peng.fan@nxp.com> | 2019-10-10 05:59:48 +0300 |
commit | 80f02019ee6901a7fb0979677030f33fb9b1fa69 (patch) | |
tree | 41d71e2e3ef6f3faaa9e3c746852944898c585ad /common/spl | |
parent | 548aefa5b9e5c31681e0a8bd78e96b66eedd1137 (diff) | |
download | u-boot-80f02019ee6901a7fb0979677030f33fb9b1fa69.tar.xz |
spl: dm_mmc: Initialize only the required mmc device
In SPL, all the available mmc devices gets initialized during boot.
This might not work in cases where clocks are not available for
certain mmc devices(other than boot device) and the support for
enabling device might not be ready.
Texas Instruments' K3 J721E device having a central system controller
(dmsc) is one such example falling in this category. Below is the
sequence for the failing scenario:
- ROM comes up in SD mode and loads SPL by just initialing SD card.
- SPL loads dmsc firmware from SD Card.
Since ROM has enabled SD, SPL need not enable the SD, just need
to re initialize the card. But SPL is trying to initialize other MMC
instances which are in disabled state. Since dmsc firmware is not yet
available, devices cannot be enabled. So in SPL, initialize only the
mmc device that is needed.
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'common/spl')
-rw-r--r-- | common/spl/spl_mmc.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index ebc566081a..ea07687fd8 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -123,31 +123,25 @@ static int spl_mmc_get_device_index(u32 boot_device) static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) { -#if CONFIG_IS_ENABLED(DM_MMC) - struct udevice *dev; -#endif int err, mmc_dev; mmc_dev = spl_mmc_get_device_index(boot_device); if (mmc_dev < 0) return mmc_dev; +#if CONFIG_IS_ENABLED(DM_MMC) + err = mmc_init_device(mmc_dev); +#else err = mmc_initialize(NULL); +#endif /* DM_MMC */ if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("spl: could not initialize mmc. error: %d\n", err); #endif return err; } - -#if CONFIG_IS_ENABLED(DM_MMC) - err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev); - if (!err) - *mmcp = mmc_get_mmc_dev(dev); -#else *mmcp = find_mmc_device(mmc_dev); err = *mmcp ? 0 : -ENODEV; -#endif if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("spl: could not find mmc device %d. error: %d\n", |