sdhci: Advertise 2.0v on SDIO host interface
PATCH v2 1/1 sdhci: Advertise 2.0v on SDIO host interface
On Intel Edison the Broadcom WiFi card, which is connected to SDIO, requires 2.0v, while the host, according to Intel Merrifield TRM, supports 1.8v I/O only.
The card announces itself as
mmc2: new ultra high speed DDR50 SDIO card at address 0001
Introduce a custom OCR mask and ->set_power() callback to override 2.0v signaling on Intel Merrifield platforms by enforcing 1.8v power choice.
---
- quirk free approach
drivers/mmc/host/sdhci-pci-core.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +28 -0
@@ -778,6 +778,7 @@ 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 : + 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 ;
@@ -789,10 +790,37 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)return 0 ; } +static void intel_mrfld_sdhci_set_power (struct sdhci_host *host, +unsigned char mode,unsigned short vdd) +{ +if (IS_ERR (host->mmc->supply.vmmc)) { +switch (1 << vdd) { +case MMC_VDD_20_21 : +sdhci_set_power_noreg (host, mode,ilog2 (MMC_VDD_165_195 )); +break ; +default : +sdhci_set_power_noreg (host, mode, vdd); +break ; + } + }else { +sdhci_set_power (host, mode, vdd); + } +} + +static const struct sdhci_ops intel_mrfld_sdhci_pci_ops = { + .set_clock = sdhci_set_clock, + .set_power = intel_mrfld_sdhci_set_power, + .enable_dma = sdhci_pci_enable_dma, + .set_bus_width = sdhci_set_bus_width, + .reset = sdhci_reset, + .set_uhs_signaling = sdhci_set_uhs_signaling, +}; +static const struct sdhci_pci_fixes sdhci_intel_mrfld_mmc = { .quirks =SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC , .quirks2 =SDHCI_QUIRK2_BROKEN_HS200 |SDHCI_QUIRK2_PRESET_VALUE_BROKEN , + .ops = &intel_mrfld_sdhci_pci_ops, .allow_runtime_pm = true, .probe_slot = intel_mrfld_mmc_probe_slot, };
Signature · 1 line
2.15.1
Quoted 10 lines · Andy Shevchenko
On Intel Edison the Broadcom WiFi card, which is connected to SDIO, requires 2.0v, while the host, according to Intel Merrifield TRM, supports 1.8v I/O only.
The card announces itself as
mmc2: new ultra high speed DDR50 SDIO card at address 0001
Introduce a custom OCR mask and ->set_power() callback to override 2.0v signaling on Intel Merrifield platforms by enforcing 1.8v power choice.
This seems to be about VDD (vmmc) rather than about signaling voltage?
Could you verify that is the case? I think we have had too many cases historically, which mixing the two voltages together and thus we end up by luck getting things to work.
Quoted 12 lines
Signed-off-by Andy Shevchenko <[email protected]>---
- quirk free approachdrivers/mmc/host/sdhci-pci-core.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)drivers/mmc/host/sdhci-pci-core.c +0
-0
drivers/mmc/host/sdhci-pci-core.c static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot) · line 781
Quoted 4 lines
drivers/mmc/host/sdhci-pci-core.c +1
-0@@ -778,6 +778,7 @@ 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 : + slot->host->ocr_mask =MMC_VDD_20_21 |MMC_VDD_165_195 ;
So this is about VDD and what VDD voltage levels the host support. If there a way to find out these values dynamically, that should be done instead.
Quoted 4 lines
drivers/mmc/host/sdhci-pci-core.c +0
-0slot->host->mmc->caps |=MMC_CAP_NONREMOVABLE |MMC_CAP_POWER_OFF_CARD ;break ;
drivers/mmc/host/sdhci-pci-core.c static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot) · line 799
Quoted 10 lines
drivers/mmc/host/sdhci-pci-core.c +7
-0@@ -789,10 +790,37 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)return 0 ; } +static void intel_mrfld_sdhci_set_power (struct sdhci_host *host, +unsigned char mode,unsigned short vdd) +{ +if (IS_ERR (host->mmc->supply.vmmc)) { +switch (1 << vdd) { +case MMC_VDD_20_21 : +sdhci_set_power_noreg (host, mode,ilog2 (MMC_VDD_165_195 ));
This looks weird.
I don't think you should need to treat the MMC_VDD_20_21 in a special way.
Or perhaps this is because this is about signal voltage after all?
Quoted 28 lines
drivers/mmc/host/sdhci-pci-core.c +20
-1+break ; +default : +sdhci_set_power_noreg (host, mode, vdd); +break ; + } + }else { +sdhci_set_power (host, mode, vdd); + } +} + +static const struct sdhci_ops intel_mrfld_sdhci_pci_ops = { + .set_clock = sdhci_set_clock, + .set_power = intel_mrfld_sdhci_set_power, + .enable_dma = sdhci_pci_enable_dma, + .set_bus_width = sdhci_set_bus_width, + .reset = sdhci_reset, + .set_uhs_signaling = sdhci_set_uhs_signaling, +}; +static const struct sdhci_pci_fixes sdhci_intel_mrfld_mmc = { .quirks =SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC , .quirks2 =SDHCI_QUIRK2_BROKEN_HS200 |SDHCI_QUIRK2_PRESET_VALUE_BROKEN , + .ops = &intel_mrfld_sdhci_pci_ops, .allow_runtime_pm = true, .probe_slot = intel_mrfld_mmc_probe_slot, }; --
Quoted 2 lines
2.15.1
Kind regards
Uffe
Quoted 8 lines · Ulf Hansson
Quoted 6 lines · Andy Shevchenko
On Intel Edison the Broadcom WiFi card, which is connected to SDIO, requires 2.0v, while the host, according to Intel Merrifield TRM, supports 1.8v I/O only.
The card announces itself as
Quoted 8 lines
Quoted 6 lines
mmc2: new ultra high speed DDR50 SDIO card at address 0001
Introduce a custom OCR mask and ->set_power() callback to override 2.0v
signaling on Intel Merrifield platforms by enforcing 1.8v power choice.This seems to be about VDD (vmmc) rather than about signaling voltage?
I'm not sure the case is the following:
1) SDHCI host reports (via OCR) that supported voltage is 1.8v (only)
2) BCM Wi-Fi card tells to the driver that it supports 2.0v (only)
In the result there is no OCR which has at least one supported voltage by both.
Keep in mind that there is no regulator case.
Quoted 4 lines
Could you verify that is the case? I think we have had too many cases historically, which mixing the two voltages together and thus we end up by luck getting things to work.
If you tell me what to add to debug print this or alike, I will provide you the answer.
Quoted 7 lines
Quoted 3 lines
case
INTEL_MRFLD_SDIO:
+slot->host->ocr_mask=MMC_VDD_20_21|MMC_VDD_165_195;So this is about VDD and what VDD voltage levels the host support. If there a way to find out these values dynamically, that should be done instead.
Then we can't find a compatible voltage.
Quoted 7 lines
Quoted 5 lines
drivers/mmc/host/sdhci-pci-core.c +4
-0+if (IS_ERR (host->mmc->supply.vmmc)) { +switch (1 << vdd) { +case MMC_VDD_20_21 : + sdhci_set_power_noreg(host, mode,
ilog2(MMC_VDD_165_195));This looks weird.
Yes, it does. I have no idea how to do this better. I can't fix neither hardware nor firmware to do something about this.
Quoted 4 lines
I don't think you should need to treat the
MMC_VDD_20_21in a special way.Or perhaps this is because this is about signal voltage after all?
See above.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Adrian Hunter
maintainerQuoted 3 lines · Andy Shevchenko
On Intel Edison the Broadcom WiFi card, which is connected to SDIO, requires 2.0v, while the host, according to Intel Merrifield TRM, supports 1.8v I/O only.
I/O -> supply
Quoted 7 lines
The card announces itself as
mmc2: new ultra high speed DDR50 SDIO card at address 0001
Introduce a custom OCR mask and ->set_power() callback to override 2.0v signaling on Intel Merrifield platforms by enforcing 1.8v power choice.
signaling -> supply
Quoted 12 lines
Signed-off-by Andy Shevchenko <[email protected]>---
- quirk free approachdrivers/mmc/host/sdhci-pci-core.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)drivers/mmc/host/sdhci-pci-core.c +0
-0
drivers/mmc/host/sdhci-pci-core.c static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot) · line 780
Quoted 3 lines
drivers/mmc/host/sdhci-pci-core.c +0
-0@@ -778,6 +778,7 @@ 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 :
Maybe add a comment here:
/* Advertise 2.0v for compatibility with the SDIO card's OCR */
drivers/mmc/host/sdhci-pci-core.c static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot) · line 797
Quoted 13 lines
drivers/mmc/host/sdhci-pci-core.c +6
-0+ 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 ;@@ -789,10 +790,37 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)return 0 ; } +static void intel_mrfld_sdhci_set_power (struct sdhci_host *host, +unsigned char mode,unsigned short vdd) +{ +if (IS_ERR (host->mmc->supply.vmmc)) { +switch (1 << vdd) {
Maybe add a comment:
/*
* Without a regulator, SDHCI does not support 2.0v but we get here
* because we advertised 2.0v support for compatibility with the SDIO
* card's OCR. Map it to 1.8v for the purpose of turning on the power. */
drivers/mmc/host/sdhci-pci-core.c static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot) · line 807
Quoted 10 lines
drivers/mmc/host/sdhci-pci-core.c +10
-0+case MMC_VDD_20_21 : +sdhci_set_power_noreg (host, mode,ilog2 (MMC_VDD_165_195 )); +break ; +default : +sdhci_set_power_noreg (host, mode, vdd); +break ; + } + }else { +sdhci_set_power (host, mode, vdd); + }
How about this instead:
if (IS_ERR(host->mmc->supply.vmmc) && vdd == ilog2(MMC_VDD_20_21)) {
sdhci_set_power_noreg(host, mode, ilog2(MMC_VDD_165_195));
return;
}
sdhci_set_power(host, mode, vdd);Quoted 20 lines
drivers/mmc/host/sdhci-pci-core.c +12
-0+} + +static const struct sdhci_ops intel_mrfld_sdhci_pci_ops = { + .set_clock = sdhci_set_clock, + .set_power = intel_mrfld_sdhci_set_power, + .enable_dma = sdhci_pci_enable_dma, + .set_bus_width = sdhci_set_bus_width, + .reset = sdhci_reset, + .set_uhs_signaling = sdhci_set_uhs_signaling, +}; +static const struct sdhci_pci_fixes sdhci_intel_mrfld_mmc = { .quirks =SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC , .quirks2 =SDHCI_QUIRK2_BROKEN_HS200 |SDHCI_QUIRK2_PRESET_VALUE_BROKEN , + .ops = &intel_mrfld_sdhci_pci_ops, .allow_runtime_pm = true, .probe_slot = intel_mrfld_mmc_probe_slot, };