From a4ecc72fcdfb48a07447ac9f3b472e6066712527 Mon Sep 17 00:00:00 2001 From: Can Guo Date: Fri, 4 Sep 2020 12:28:56 +0800 Subject: [PATCH] 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 --- drivers/mmc/host/sdhci-msm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 03ad1a6c2e17..8a7af65cf45c 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -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)