Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH v2] mmc: host: Wait for Vdd to settle on card power off
@ 2025-03-14 19:50 Erick Shepherd
  2025-03-20  7:25 ` Adrian Hunter
  0 siblings, 1 reply; 3+ messages in thread
From: Erick Shepherd @ 2025-03-14 19:50 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, adrian.hunter, linux-kernel, 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.

Signed-off-by: Erick Shepherd <erick.shepherd@ni.com>
---
 drivers/mmc/host/sdhci-pci-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 1f0bd723f011..b1f7c11ea61e 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -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.
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mmc: host: Wait for Vdd to settle on card power off
  2025-03-14 19:50 [PATCH v2] mmc: host: Wait for Vdd to settle on card power off Erick Shepherd
@ 2025-03-20  7:25 ` Adrian Hunter
  2025-03-20 14:16   ` Ulf Hansson
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Hunter @ 2025-03-20  7:25 UTC (permalink / raw)
  To: Erick Shepherd, linux-mmc; +Cc: ulf.hansson, linux-kernel

On 14/03/25 21:50, Erick Shepherd wrote:
> 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.
> 
> Signed-off-by: Erick Shepherd <erick.shepherd@ni.com>

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

With that, you can add:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-pci-core.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> index 1f0bd723f011..b1f7c11ea61e 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -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;
> -
> +	}

Blank line here

>  	/*
>  	 * Bus power might not enable after D3 -> D0 transition due to the
>  	 * present state not yet having propagated. Retry for up to 2ms.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mmc: host: Wait for Vdd to settle on card power off
  2025-03-20  7:25 ` Adrian Hunter
@ 2025-03-20 14:16   ` Ulf Hansson
  0 siblings, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2025-03-20 14:16 UTC (permalink / raw)
  To: Adrian Hunter, Erick Shepherd; +Cc: linux-mmc, linux-kernel

On Thu, 20 Mar 2025 at 08:26, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 14/03/25 21:50, Erick Shepherd wrote:
> > 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.
> >
> > Signed-off-by: Erick Shepherd <erick.shepherd@ni.com>
>
> Can we leave a blank line after the block.  It was that way before.
>
> With that, you can add:
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Applied for next with the suggested change, thanks!

Kind regards
Uffe


>
> > ---
> >  drivers/mmc/host/sdhci-pci-core.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> > index 1f0bd723f011..b1f7c11ea61e 100644
> > --- a/drivers/mmc/host/sdhci-pci-core.c
> > +++ b/drivers/mmc/host/sdhci-pci-core.c
> > @@ -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;
> > -
> > +     }
>
> Blank line here
>
> >       /*
> >        * Bus power might not enable after D3 -> D0 transition due to the
> >        * present state not yet having propagated. Retry for up to 2ms.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-20 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-14 19:50 [PATCH v2] mmc: host: Wait for Vdd to settle on card power off Erick Shepherd
2025-03-20  7:25 ` Adrian Hunter
2025-03-20 14:16   ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox