Skip to contentSkip to conversation

mmc: sdhci: Workaround broken command queuing on Intel GLK

PATCH In review Adrian Hunter 2 participants 4 messages Dec 17, 2019 – Dec 18, 2019

Subsystems (2)
lore
Share & tools
lore

Adrian Hunter

author maintainer
#0 lore raw

PATCH 1/2 mmc: sdhci: Workaround broken command queuing on Intel GLK

Command queuing has been reported broken on some Lenovo systems based on Intel GLK. This is likely a BIOS issue, so disable command queuing for Intel GLK if the BIOS vendor string is "LENOVO".

Fixes 8ee82bda230f ("mmc: sdhci-pci: Add CQHCI support for Intel GLK")
---
 drivers/mmc/host/sdhci-pci-core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +9 -1
index acefb76b4e15..5091e2c1c0e5 100644
@@ -27,6 +27,7 @@
 #include <linux/mmc/slot-gpio.h>
 #include <linux/mmc/sdhci-pci-data.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 
 #ifdef CONFIG_X86
 #include <asm/iosf_mbi.h>
@@ -783,11 +784,18 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
 	return 0;
 }
 
+static bool glk_broken_cqhci(struct sdhci_pci_slot *slot)
+{
+	return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC &&
+	       dmi_match(DMI_BIOS_VENDOR, "LENOVO");
+}
+
 static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot)
 {
 	int ret = byt_emmc_probe_slot(slot);
 
-	slot->host->mmc->caps2 |= MMC_CAP2_CQE;
+	if (!glk_broken_cqhci(slot))
+		slot->host->mmc->caps2 |= MMC_CAP2_CQE;
 
 	if (slot->chip->pdev->device != PCI_DEVICE_ID_INTEL_GLK_EMMC) {
 		slot->host->mmc->caps2 |= MMC_CAP2_HS400_ES,
Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH 2/2 mmc: sdhci: Add a quirk for broken command queuing

Command queuing has been reported broken on some systems based on Intel GLK. A separate patch disables command queuing in some cases.

This patch adds a quirk for broken command queuing, which enables users with problems to disable command queuing using sdhci module parameters for quirks.

Fixes 8ee82bda230f ("mmc: sdhci-pci: Add CQHCI support for Intel GLK")
---
 drivers/mmc/host/sdhci.c | 3 +++
 drivers/mmc/host/sdhci.h | 2 ++
 2 files changed, 5 insertions(+)
drivers/mmc/host/sdhci.c +3 -0
index 3140fe2e5dba..f4540f9892ce 100644
@@ -3769,6 +3769,9 @@ int sdhci_setup_host(struct sdhci_host *host)
 		       mmc_hostname(mmc), host->version);
 	}
 
+	if (host->quirks & SDHCI_QUIRK_BROKEN_CQE)
+		mmc->caps2 &= ~MMC_CAP2_CQE;
+
 	if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
 		host->flags |= SDHCI_USE_SDMA;
 	else if (!(host->caps & SDHCI_CAN_DO_SDMA))
drivers/mmc/host/sdhci.h +2 -0
index 0ed3e0eaef5f..fe83ece6965b 100644
@@ -409,6 +409,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK_BROKEN_CARD_DETECTION		(1<<15)
 /* Controller reports inverted write-protect state */
 #define SDHCI_QUIRK_INVERTED_WRITE_PROTECT		(1<<16)
+/* Controller has unusable command queue engine */
+#define SDHCI_QUIRK_BROKEN_CQE				(1<<17)
 /* Controller does not like fast PIO transfers */
 #define SDHCI_QUIRK_PIO_NEEDS_DELAY			(1<<18)
 /* Controller does not have a LED */
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/2] mmc: sdhci: Add a quirk for broken command queuing

Quoted 11 lines · Adrian Hunter

Command queuing has been reported broken on some systems based on Intel GLK. A separate patch disables command queuing in some cases.

This patch adds a quirk for broken command queuing, which enables users with problems to disable command queuing using sdhci module parameters for quirks.

Fixes 8ee82bda230f ("mmc: sdhci-pci: Add CQHCI support for Intel GLK")

Applied for fixes, thanks!

Kind regards
Uffe

Quoted 35 lines
---
 drivers/mmc/host/sdhci.c | 3 +++
 drivers/mmc/host/sdhci.h | 2 ++
 2 files changed, 5 insertions(+)
drivers/mmc/host/sdhci.c +3 -0
index 3140fe2e5dba..f4540f9892ce 100644
@@ -3769,6 +3769,9 @@ int sdhci_setup_host(struct sdhci_host *host)
                       mmc_hostname(mmc), host->version);
        }
 
+       if (host->quirks & SDHCI_QUIRK_BROKEN_CQE)
+               mmc->caps2 &= ~MMC_CAP2_CQE;
+
        if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
                host->flags |= SDHCI_USE_SDMA;
        else if (!(host->caps & SDHCI_CAN_DO_SDMA))
drivers/mmc/host/sdhci.h +2 -1
index 0ed3e0eaef5f..fe83ece6965b 100644
@@ -409,6 +409,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK_BROKEN_CARD_DETECTION              (1<<15)
 /* Controller reports inverted write-protect state */
 #define SDHCI_QUIRK_INVERTED_WRITE_PROTECT             (1<<16)
+/* Controller has unusable command queue engine */
+#define SDHCI_QUIRK_BROKEN_CQE                         (1<<17)
 /* Controller does not like fast PIO transfers */
 #define SDHCI_QUIRK_PIO_NEEDS_DELAY                    (1<<18)
 /* Controller does not have a LED */
--

2.17.1

#3 lore raw
In reply to Adrian Hunter
Quoted 8 lines · Adrian Hunter

Command queuing has been reported broken on some Lenovo systems based on Intel GLK. This is likely a BIOS issue, so disable command queuing for Intel GLK if the BIOS vendor string is "LENOVO".

Fixes 8ee82bda230f ("mmc: sdhci-pci: Add CQHCI support for Intel GLK")

Applied for fixes, thanks!

Kind regards
Uffe

Quoted 39 lines
---
 drivers/mmc/host/sdhci-pci-core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +9 -2
index acefb76b4e15..5091e2c1c0e5 100644
@@ -27,6 +27,7 @@
 #include <linux/mmc/slot-gpio.h>
 #include <linux/mmc/sdhci-pci-data.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 
 #ifdef CONFIG_X86
 #include <asm/iosf_mbi.h>
@@ -783,11 +784,18 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
        return 0;
 }
 
+static bool glk_broken_cqhci(struct sdhci_pci_slot *slot)
+{
+       return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC &&
+              dmi_match(DMI_BIOS_VENDOR, "LENOVO");
+}
+
 static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot)
 {
        int ret = byt_emmc_probe_slot(slot);
 
-       slot->host->mmc->caps2 |= MMC_CAP2_CQE;
+       if (!glk_broken_cqhci(slot))
+               slot->host->mmc->caps2 |= MMC_CAP2_CQE;
 
        if (slot->chip->pdev->device != PCI_DEVICE_ID_INTEL_GLK_EMMC) {
                slot->host->mmc->caps2 |= MMC_CAP2_HS400_ES,
--

2.17.1