mmc: sdhci_msm: Allow turning off SD card's power during initialization

As per eMMC specification, device should be notified either with power-off
or sleep notification before turning off the Vcc. Failing to do so might
affect the device longevity. In mmc driver initialization phase even before
device probing gets completed, Vcc is getting turned off without these
notifications. Since it can't send commands at this stage, so just ensure
that Vcc is not turned off till initialization gets completed. See commit
eed1deac09ea ("mmc: sdhci-msm: Don't turnoff Vcc during initialization")
from msm-4.9 for more details.

However, above does not apply to the SD card and it may leave SD card's
power ON even there is no card present during bootup. Fix it by limiting
the above logic to non-removable devices only.

Change-Id: I9f1f13e7a7f233cf2a2aa945175d4e5c53bd489e
Signed-off-by: Can Guo <cang@codeaurora.org>
This commit is contained in:
Can Guo 2020-09-04 12:28:56 +08:00
commit a4ecc72fcd

View file

@ -2151,7 +2151,8 @@ static void sdhci_msm_handle_pwr_irq(struct sdhci_host *host, int irq)
io_level = REQ_IO_HIGH;
}
if (irq_status & CORE_PWRCTL_BUS_OFF) {
if (msm_host->pltfm_init_done)
if (!(host->mmc->caps & MMC_CAP_NONREMOVABLE) ||
msm_host->pltfm_init_done)
ret = sdhci_msm_setup_vreg(msm_host,
false, false);
if (!ret)