Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci: Fix to handle MMC_POWER_UNDEFINED

Since commit c2c24819b280 ("mmc: core: Don't power off the card when
starting the host"), the power state can still be MMC_POWER_UNDEFINED after
mmc_start_host() is called. That can trigger a warning in SDHCI during
runtime resume as it tries to restore the I/O state. Handle
MMC_POWER_UNDEFINED simply by not updating the I/O state in that case.

Fixes: c2c24819b280 ("mmc: core: Don't power off the card when starting the host")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Adrian Hunter and committed by
Ulf Hansson
84ec048b 5b311c15

+19 -14
+19 -14
drivers/mmc/host/sdhci.c
··· 1576 1576 unsigned long flags; 1577 1577 u8 ctrl; 1578 1578 1579 + if (ios->power_mode == MMC_POWER_UNDEFINED) 1580 + return; 1581 + 1579 1582 spin_lock_irqsave(&host->lock, flags); 1580 1583 1581 1584 if (host->flags & SDHCI_DEVICE_DEAD) { ··· 2941 2938 2942 2939 sdhci_init(host, 0); 2943 2940 2944 - /* Force clock and power re-program */ 2945 - host->pwr = 0; 2946 - host->clock = 0; 2947 - mmc->ops->start_signal_voltage_switch(mmc, &mmc->ios); 2948 - mmc->ops->set_ios(mmc, &mmc->ios); 2941 + if (mmc->ios.power_mode != MMC_POWER_UNDEFINED) { 2942 + /* Force clock and power re-program */ 2943 + host->pwr = 0; 2944 + host->clock = 0; 2945 + mmc->ops->start_signal_voltage_switch(mmc, &mmc->ios); 2946 + mmc->ops->set_ios(mmc, &mmc->ios); 2949 2947 2950 - if ((host_flags & SDHCI_PV_ENABLED) && 2951 - !(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN)) { 2952 - spin_lock_irqsave(&host->lock, flags); 2953 - sdhci_enable_preset_value(host, true); 2954 - spin_unlock_irqrestore(&host->lock, flags); 2948 + if ((host_flags & SDHCI_PV_ENABLED) && 2949 + !(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN)) { 2950 + spin_lock_irqsave(&host->lock, flags); 2951 + sdhci_enable_preset_value(host, true); 2952 + spin_unlock_irqrestore(&host->lock, flags); 2953 + } 2954 + 2955 + if ((mmc->caps2 & MMC_CAP2_HS400_ES) && 2956 + mmc->ops->hs400_enhanced_strobe) 2957 + mmc->ops->hs400_enhanced_strobe(mmc, &mmc->ios); 2955 2958 } 2956 - 2957 - if ((mmc->caps2 & MMC_CAP2_HS400_ES) && 2958 - mmc->ops->hs400_enhanced_strobe) 2959 - mmc->ops->hs400_enhanced_strobe(mmc, &mmc->ios); 2960 2959 2961 2960 spin_lock_irqsave(&host->lock, flags); 2962 2961