public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] sdhci: Advertise 2.0v supply on SDIO host controller
@ 2018-01-11 13:51 Andy Shevchenko
  2018-01-11 13:55 ` Adrian Hunter
  2018-01-11 14:53 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2018-01-11 13:51 UTC (permalink / raw)
  To: Adrian Hunter, Ulf Hansson, linux-mmc; +Cc: Andy Shevchenko

On Intel Edison the Broadcom Wi-Fi card, which is connected to SDIO,
requires 2.0v, while the host, according to Intel Merrifield TRM,
supports 1.8v supply only.

The card announces itself as

  mmc2: new ultra high speed DDR50 SDIO card at address 0001

Introduce a custom OCR mask for SDIO host controller on Intel Merrifield
and add a special case to sdhci_set_power_noreg() to override 2.0v supply
by enforcing 1.8v power choice.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
- address Ulf's comment
 drivers/mmc/host/sdhci-pci-core.c | 2 ++
 drivers/mmc/host/sdhci.c          | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 3e4f04fd5175..bcfb5dc0d85e 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -778,6 +778,8 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
 		slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
 		break;
 	case INTEL_MRFLD_SDIO:
+		/* Advertise 2.0v for compatibility with the SDIO card's OCR */
+		slot->host->ocr_mask = MMC_VDD_20_21 | MMC_VDD_165_195;
 		slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE |
 					 MMC_CAP_POWER_OFF_CARD;
 		break;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index e9290a3439d5..80b1a59bc3c5 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1434,6 +1434,13 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
 	if (mode != MMC_POWER_OFF) {
 		switch (1 << vdd) {
 		case MMC_VDD_165_195:
+		/*
+		 * Without a regulator, SDHCI does not support 2.0v
+		 * so we only get here if the driver deliberately
+		 * added the 2.0v range to ocr_avail. Map it to 1.8v
+		 * for the purpose of turning on the power.
+		 */
+		case MMC_VDD_20_21:
 			pwr = SDHCI_POWER_180;
 			break;
 		case MMC_VDD_29_30:
-- 
2.15.1


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

* Re: [PATCH v4] sdhci: Advertise 2.0v supply on SDIO host controller
  2018-01-11 13:51 [PATCH v4] sdhci: Advertise 2.0v supply on SDIO host controller Andy Shevchenko
@ 2018-01-11 13:55 ` Adrian Hunter
  2018-01-11 14:53 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2018-01-11 13:55 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, linux-mmc

On 11/01/18 15:51, Andy Shevchenko wrote:
> On Intel Edison the Broadcom Wi-Fi card, which is connected to SDIO,
> requires 2.0v, while the host, according to Intel Merrifield TRM,
> supports 1.8v supply only.
> 
> The card announces itself as
> 
>   mmc2: new ultra high speed DDR50 SDIO card at address 0001
> 
> Introduce a custom OCR mask for SDIO host controller on Intel Merrifield
> and add a special case to sdhci_set_power_noreg() to override 2.0v supply
> by enforcing 1.8v power choice.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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

> ---
> - address Ulf's comment
>  drivers/mmc/host/sdhci-pci-core.c | 2 ++
>  drivers/mmc/host/sdhci.c          | 7 +++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> index 3e4f04fd5175..bcfb5dc0d85e 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -778,6 +778,8 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
>  		slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
>  		break;
>  	case INTEL_MRFLD_SDIO:
> +		/* Advertise 2.0v for compatibility with the SDIO card's OCR */
> +		slot->host->ocr_mask = MMC_VDD_20_21 | MMC_VDD_165_195;
>  		slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE |
>  					 MMC_CAP_POWER_OFF_CARD;
>  		break;
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index e9290a3439d5..80b1a59bc3c5 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1434,6 +1434,13 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
>  	if (mode != MMC_POWER_OFF) {
>  		switch (1 << vdd) {
>  		case MMC_VDD_165_195:
> +		/*
> +		 * Without a regulator, SDHCI does not support 2.0v
> +		 * so we only get here if the driver deliberately
> +		 * added the 2.0v range to ocr_avail. Map it to 1.8v
> +		 * for the purpose of turning on the power.
> +		 */
> +		case MMC_VDD_20_21:
>  			pwr = SDHCI_POWER_180;
>  			break;
>  		case MMC_VDD_29_30:
> 


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

* Re: [PATCH v4] sdhci: Advertise 2.0v supply on SDIO host controller
  2018-01-11 13:51 [PATCH v4] sdhci: Advertise 2.0v supply on SDIO host controller Andy Shevchenko
  2018-01-11 13:55 ` Adrian Hunter
@ 2018-01-11 14:53 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2018-01-11 14:53 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Adrian Hunter, linux-mmc@vger.kernel.org

On 11 January 2018 at 14:51, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Intel Edison the Broadcom Wi-Fi card, which is connected to SDIO,
> requires 2.0v, while the host, according to Intel Merrifield TRM,
> supports 1.8v supply only.
>
> The card announces itself as
>
>   mmc2: new ultra high speed DDR50 SDIO card at address 0001
>
> Introduce a custom OCR mask for SDIO host controller on Intel Merrifield
> and add a special case to sdhci_set_power_noreg() to override 2.0v supply
> by enforcing 1.8v power choice.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
> - address Ulf's comment
>  drivers/mmc/host/sdhci-pci-core.c | 2 ++
>  drivers/mmc/host/sdhci.c          | 7 +++++++
>  2 files changed, 9 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> index 3e4f04fd5175..bcfb5dc0d85e 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -778,6 +778,8 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
>                 slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
>                 break;
>         case INTEL_MRFLD_SDIO:
> +               /* Advertise 2.0v for compatibility with the SDIO card's OCR */
> +               slot->host->ocr_mask = MMC_VDD_20_21 | MMC_VDD_165_195;
>                 slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE |
>                                          MMC_CAP_POWER_OFF_CARD;
>                 break;
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index e9290a3439d5..80b1a59bc3c5 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1434,6 +1434,13 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
>         if (mode != MMC_POWER_OFF) {
>                 switch (1 << vdd) {
>                 case MMC_VDD_165_195:
> +               /*
> +                * Without a regulator, SDHCI does not support 2.0v
> +                * so we only get here if the driver deliberately
> +                * added the 2.0v range to ocr_avail. Map it to 1.8v
> +                * for the purpose of turning on the power.
> +                */
> +               case MMC_VDD_20_21:
>                         pwr = SDHCI_POWER_180;
>                         break;
>                 case MMC_VDD_29_30:
> --
> 2.15.1
>

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

end of thread, other threads:[~2018-01-11 14:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11 13:51 [PATCH v4] sdhci: Advertise 2.0v supply on SDIO host controller Andy Shevchenko
2018-01-11 13:55 ` Adrian Hunter
2018-01-11 14:53 ` Ulf Hansson

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