diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/mmc-uclass.c | 5 | ||||
-rw-r--r-- | drivers/mmc/mmc.c | 22 |
2 files changed, 25 insertions, 2 deletions
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index 0e13238c7e..3ee92d03ca 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -342,6 +342,9 @@ void mmc_do_preinit(void) if (!m) continue; + + m->user_speed_mode = MMC_MODES_END; /* Initialising user set speed mode */ + if (m->preinit) mmc_start_init(m); } @@ -414,7 +417,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg) /* setup initial part type */ bdesc->part_type = cfg->part_type; mmc->dev = dev; - + mmc->user_speed_mode = MMC_MODES_END; return 0; } diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 8078a89f18..bd348974ae 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -2862,7 +2862,25 @@ int mmc_start_init(struct mmc *mmc) * timings. */ mmc->host_caps = mmc->cfg->host_caps | MMC_CAP(MMC_LEGACY) | - MMC_CAP(MMC_LEGACY) | MMC_MODE_1BIT; + MMC_MODE_1BIT; + + if (IS_ENABLED(CONFIG_MMC_SPEED_MODE_SET)) { + if (mmc->user_speed_mode != MMC_MODES_END) { + int i; + /* set host caps */ + if (mmc->host_caps & MMC_CAP(mmc->user_speed_mode)) { + /* Remove all existing speed capabilities */ + for (i = MMC_LEGACY; i < MMC_MODES_END; i++) + mmc->host_caps &= ~MMC_CAP(i); + mmc->host_caps |= (MMC_CAP(mmc->user_speed_mode) + | MMC_CAP(MMC_LEGACY) | + MMC_MODE_1BIT); + } else { + pr_err("bus_mode requested is not supported\n"); + return -EINVAL; + } + } + } #if CONFIG_IS_ENABLED(DM_MMC) mmc_deferred_probe(mmc); #endif @@ -3060,6 +3078,8 @@ int mmc_init_device(int num) } m = mmc_get_mmc_dev(dev); + m->user_speed_mode = MMC_MODES_END; /* Initialising user set speed mode */ + if (!m) return 0; if (m->preinit) |