Skip to contentSkip to conversation

mmc: host: Wait for Vdd to settle on card power off

PATCH In review Erick Shepherd 3 participants 3 messages Mar 14, 2025 – Mar 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mmc: host: Wait for Vdd to settle on card power off

The SD spec version 6.0 section 6.4.1.5 requires that Vdd must be lowered to less than 0.5V for a minimum of 1 ms when powering off a card. Increase wait to 15 ms so that voltage has time to drain down to 0.5V and cards can power off correctly. Issues with voltage drain time were only observed on Apollo Lake and Bay Trail host controllers so this fix is limited to those devices.

---
 drivers/mmc/host/sdhci-pci-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +5 -2
index 1f0bd723f011..b1f7c11ea61e 100644
@@ -610,9 +610,12 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,
 
 	sdhci_set_power(host, mode, vdd);
 
-	if (mode == MMC_POWER_OFF)
+	if (mode == MMC_POWER_OFF) {
+		if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD ||
+		    slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BYT_SD)
+			usleep_range(15000, 17500);
 		return;
-
+	}
 	/*
 	 * Bus power might not enable after D3 -> D0 transition due to the
 	 * present state not yet having propagated. Retry for up to 2ms.
Signature · 1 line
2.43.0
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines · Erick Shepherd

The SD spec version 6.0 section 6.4.1.5 requires that Vdd must be lowered to less than 0.5V for a minimum of 1 ms when powering off a card. Increase wait to 15 ms so that voltage has time to drain down to 0.5V and cards can power off correctly. Issues with voltage drain time were only observed on Apollo Lake and Bay Trail host controllers so this fix is limited to those devices.

Can we leave a blank line after the block. It was that way before.

With that, you can add:

Quoted 10 lines
---
 drivers/mmc/host/sdhci-pci-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +0 -0
index 1f0bd723f011..b1f7c11ea61e 100644
@@ -610,9 +610,12 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,
 

drivers/mmc/host/sdhci-pci-core.c static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, · line 618

Quoted 10 lines
drivers/mmc/host/sdhci-pci-core.c +5 -2
 	sdhci_set_power(host, mode, vdd);
 
-	if (mode == MMC_POWER_OFF)
+	if (mode == MMC_POWER_OFF) {
+		if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD ||
+		    slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BYT_SD)
+			usleep_range(15000, 17500);
 		return;
-
+	}

Blank line here

Quoted 3 lines
drivers/mmc/host/sdhci-pci-core.c +0 -0
 	/*
 	 * Bus power might not enable after D3 -> D0 transition due to the
 	 * present state not yet having propagated. Retry for up to 2ms.
#2 lore raw
Quoted 9 lines · Adrian Hunter
Quoted 7 lines · Erick Shepherd

The SD spec version 6.0 section 6.4.1.5 requires that Vdd must be lowered to less than 0.5V for a minimum of 1 ms when powering off a card. Increase wait to 15 ms so that voltage has time to drain down to 0.5V and cards can power off correctly. Issues with voltage drain time were only observed on Apollo Lake and Bay Trail host controllers so this fix is limited to those devices.

Quoted 7 lines
Quoted 1 line

Can we leave a blank line after the block. It was that way before.

With that, you can add:

Applied for next with the suggested change, thanks!

Kind regards
Uffe

Quoted 28 lines
Quoted 11 lines
---
 drivers/mmc/host/sdhci-pci-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +0 -0
index 1f0bd723f011..b1f7c11ea61e 100644
@@ -610,9 +610,12 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,
 

drivers/mmc/host/sdhci-pci-core.c static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, · line 618

Quoted 10 lines
drivers/mmc/host/sdhci-pci-core.c +5 -2
      sdhci_set_power(host, mode, vdd);
 
-     if (mode == MMC_POWER_OFF)
+     if (mode == MMC_POWER_OFF) {
+             if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD ||
+                 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BYT_SD)
+                     usleep_range(15000, 17500);
              return;
-
+     }

Blank line here

Quoted 3 lines
drivers/mmc/host/sdhci-pci-core.c +0 -0
      /*
       * Bus power might not enable after D3 -> D0 transition due to the
       * present state not yet having propagated. Retry for up to 2ms.