diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2022-03-03 17:51:51 +0100 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2022-03-15 10:25:21 +0100 |
commit | 23e1b8c15b3ab402bc422338073afc7cf2351788 (patch) | |
tree | e5ce056662a7d52f74eb241c8a34dd50a807fcaa /drivers/mmc/core/host.c | |
parent | d6c9219ca1139b74541b2a98cee47a3426d754a9 (diff) | |
download | linux-23e1b8c15b3ab402bc422338073afc7cf2351788.tar.bz2 |
mmc: core: Drop HS400 caps unless 8-bit bus is supported too
When mmc_select_hs400es() tries to switch to the HS400 ES mode, it may bail
out early if the host doesn't support an 8-bit buswidth, as it's required
for the HS400 mode.
To improve the situation, let's instead drop the HS400 bits from the
capability field if the 8-bit bus isn't supported. In this way, we allow
the mmc initialization to continue by trying a lower speed mode.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20220303165151.129806-1-ulf.hansson@linaro.org
Diffstat (limited to 'drivers/mmc/core/host.c')
-rw-r--r-- | drivers/mmc/core/host.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index d739e2b631fe..2ed2b4d5e5a5 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -590,11 +590,20 @@ EXPORT_SYMBOL(mmc_alloc_host); static int mmc_validate_host_caps(struct mmc_host *host) { - if (host->caps & MMC_CAP_SDIO_IRQ && !host->ops->enable_sdio_irq) { - dev_warn(host->parent, "missing ->enable_sdio_irq() ops\n"); + struct device *dev = host->parent; + u32 caps = host->caps, caps2 = host->caps2; + + if (caps & MMC_CAP_SDIO_IRQ && !host->ops->enable_sdio_irq) { + dev_warn(dev, "missing ->enable_sdio_irq() ops\n"); return -EINVAL; } + if (caps2 & (MMC_CAP2_HS400_ES | MMC_CAP2_HS400) && + !(caps & MMC_CAP_8_BIT_DATA)) { + dev_warn(dev, "drop HS400 support since no 8-bit bus\n"); + host->caps2 = caps2 & ~MMC_CAP2_HS400_ES & ~MMC_CAP2_HS400; + } + return 0; } |