diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2013-10-02 07:31:08 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2013-10-02 07:31:08 -0700 |
| commit | 956105c3f51ec2d0b51ab906106b807f2d21d943 (patch) | |
| tree | 19edfbd782093e142326044f72c304e6fda61cf7 | |
| parent | 596380b5b5b28a0b0a55abf9ddb6d49abd88db06 (diff) | |
| parent | 20b2ab10be13713f08922cd8282f840d85fe925c (diff) | |
Merge "mmc: sdhci: fix card detection code"
| -rw-r--r-- | drivers/mmc/host/sdhci.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index fab6da98637..4848cc8b0ba 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2008,14 +2008,20 @@ static int sdhci_do_get_cd(struct sdhci_host *host) return 0; /* If polling/nonremovable, assume that the card is always present. */ - if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || - (host->mmc->caps & MMC_CAP_NONREMOVABLE)) + if (host->mmc->caps & MMC_CAP_NONREMOVABLE) return 1; - /* Try slot gpio detect */ + /* + * Try slot gpio detect before checking for the broken card detection + * quirk. There might be hosts that might have broken card detection + * but still provide a gpio for card detection. + */ if (!IS_ERR_VALUE(gpio_cd)) return !!gpio_cd; + if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) + return 1; + /* Host native card detect */ return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); } @@ -3582,8 +3588,13 @@ int sdhci_add_host(struct sdhci_host *host) if (caps[0] & SDHCI_CAN_DO_HISPD) mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED; + /* + * Enable polling on when card detection is broken and no card detect + * gpio is present. + */ if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) && - !(host->mmc->caps & MMC_CAP_NONREMOVABLE)) + !(host->mmc->caps & MMC_CAP_NONREMOVABLE) && + (mmc_gpio_get_cd(host->mmc) < 0)) mmc->caps |= MMC_CAP_NEEDS_POLL; /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */ |
