[PATCH 2/3] mmc: sdhci-pci: force polling card detect for Braswell SD on Lenovo N22

From: Nelson Johnson

Date: Mon Mar 16 2026 - 17:24:44 EST


The Lenovo N22 uses the Braswell SD controller at PCI ID 8086:2296, but its firmware exposes a broken card-detect path. On modern kernels the slot repeatedly fails to come up because the normal GPIO card-detect path never becomes usable on this machine.

Force the Lenovo N22 to skip the firmware GPIO card-detect path for the Braswell SD slot and use polling instead. This keeps the quirk tightly scoped to the affected DMI match while leaving the default behavior unchanged on other Braswell systems.

With the polling fallback in place, the PCI SDHCI path can detect card insertion reliably again on the Lenovo N22.

Fixes: 6cf4156c0988 ("mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD controllers")
Signed-off-by: Nelson Johnson <nzjfr547@xxxxxxxxx>
---
drivers/mmc/host/sdhci-pci-core.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 4b3c61609..05ab17e72 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -1134,8 +1134,17 @@ static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)
if (runtime_pm_ok)
slot->host->mmc->caps |= MMC_CAP_AGGRESSIVE_PM |
MMC_CAP_CD_WAKE;
- slot->cd_idx = 0;
- slot->cd_override_level = true;
+ if (!runtime_pm_ok) {
+ /*
+ * Lenovo N22 Braswell card-detect bypass: ignore the broken
+ * firmware GPIO path and poll the slot instead.
+ */
+ slot->cd_idx = -1;
+ slot->host->mmc->caps |= MMC_CAP_NEEDS_POLL;
+ } else {
+ slot->cd_idx = 0;
+ slot->cd_override_level = true;
+ }
if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD ||
slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXTM_SD ||
slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD ||
--
2.47.3