Skip to content

Commit 6ab4e2e

Browse files
andy-shevstorulf
authored andcommitted
mmc: sdhci-pci: Read card detect from ACPI for Intel Merrifield
Intel Merrifield platform had been converted to use ACPI enumeration. However, the driver missed an update to retrieve card detect GPIO. Fix it here. Unfortunately we can't rely on CD GPIO state because there are two different PCB designs in the wild that are using the opposite card detection sense and there is no way to distinguish those platforms, that's why ignore CD GPIO completely and use it only as an event. Fixes: 4590d98 ("sfi: Remove framework for deprecated firmware") BugLink: edison-fw/meta-intel-edison#135 Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Adrian Hunter <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 4217d07 commit 6ab4e2e

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,16 +616,12 @@ static int intel_select_drive_strength(struct mmc_card *card,
616616
return intel_host->drv_strength;
617617
}
618618

619-
static int bxt_get_cd(struct mmc_host *mmc)
619+
static int sdhci_get_cd_nogpio(struct mmc_host *mmc)
620620
{
621-
int gpio_cd = mmc_gpio_get_cd(mmc);
622621
struct sdhci_host *host = mmc_priv(mmc);
623622
unsigned long flags;
624623
int ret = 0;
625624

626-
if (!gpio_cd)
627-
return 0;
628-
629625
spin_lock_irqsave(&host->lock, flags);
630626

631627
if (host->flags & SDHCI_DEVICE_DEAD)
@@ -638,6 +634,21 @@ static int bxt_get_cd(struct mmc_host *mmc)
638634
return ret;
639635
}
640636

637+
static int bxt_get_cd(struct mmc_host *mmc)
638+
{
639+
int gpio_cd = mmc_gpio_get_cd(mmc);
640+
641+
if (!gpio_cd)
642+
return 0;
643+
644+
return sdhci_get_cd_nogpio(mmc);
645+
}
646+
647+
static int mrfld_get_cd(struct mmc_host *mmc)
648+
{
649+
return sdhci_get_cd_nogpio(mmc);
650+
}
651+
641652
#define SDHCI_INTEL_PWR_TIMEOUT_CNT 20
642653
#define SDHCI_INTEL_PWR_TIMEOUT_UDELAY 100
643654

@@ -1341,6 +1352,14 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
13411352
MMC_CAP_1_8V_DDR;
13421353
break;
13431354
case INTEL_MRFLD_SD:
1355+
slot->cd_idx = 0;
1356+
slot->cd_override_level = true;
1357+
/*
1358+
* There are two PCB designs of SD card slot with the opposite
1359+
* card detection sense. Quirk this out by ignoring GPIO state
1360+
* completely in the custom ->get_cd() callback.
1361+
*/
1362+
slot->host->mmc_host_ops.get_cd = mrfld_get_cd;
13441363
slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
13451364
break;
13461365
case INTEL_MRFLD_SDIO:

0 commit comments

Comments
 (0)