[PATCH] mmc: sdhci-pci: disable intel voltage switch if unsupported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we don't have the voltage switch DSM methods available, there's no
point in advertising to the rest of the kernel that we support 1.8V, or
support voltage switch at all.

This fixes an issue on a Gemini Lake (GLK) laptop : eMMC driver will
timeout on boot (from 60seconds to 10minutes ) as the cqhci attempts CQE
recovery after a failed voltage switch. In earlier kernels, the problem
existed, but only delayed boot for about 10 seconds after an I/O error,
allowing booting on the eMMC (almost) unnoticed.

Signed-off-by: Anisse Astier <anisse@xxxxxxxxx>
---
Hi,

I'm looking forward to your feedback on this patch. Is it safe to
have no voltage switch method ? Should the quirk be used or skipped
entirely ?

It seemed to work well in my tests, as the mmc core works properly.

Regards,

Anisse

 drivers/mmc/host/sdhci-pci-core.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 7bfd366d970d..8fac8cbc5ce8 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -706,10 +706,27 @@ static int intel_execute_tuning(struct mmc_host *mmc, u32 opcode)
 static void byt_probe_slot(struct sdhci_pci_slot *slot)
 {
 	struct mmc_host_ops *ops = &slot->host->mmc_host_ops;
+	struct intel_host *intel_host = sdhci_pci_priv(slot);
 
 	byt_read_dsm(slot);
 
 	ops->execute_tuning = intel_execute_tuning;
+
+	/* Check if we have the appropriate voltage switch DSM methods */
+	if (!(intel_host->dsm_fns & (1 << INTEL_DSM_V18_SWITCH))) {
+		pr_info("%s: no DSM function for 1.8 voltage switch\n",
+			 mmc_hostname(slot->host->mmc));
+		slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
+
+		if (!(intel_host->dsm_fns & (1 << INTEL_DSM_V33_SWITCH))) {
+			/* No voltage switching supported at all, there's no
+			 * point in installing the callback: return.
+			 */
+			pr_info("%s: Voltage switching unsupported\n",
+				mmc_hostname(slot->host->mmc));
+			return;
+		}
+	}
 	ops->start_signal_voltage_switch = intel_start_signal_voltage_switch;
 }
 
-- 
2.17.2




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux