]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
mmc: sdhci: let GPIO based card detection have higher precedence
authorIvan T. Ivanov <ivan.ivanov@linaro.org>
Mon, 8 Jun 2015 07:22:08 +0000 (10:22 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 12 Sep 2017 16:19:06 +0000 (18:19 +0200)
Controller could have BROKEN_CARD_DETECTION quirk set, but drivers
could use GPIO to detect card present state. Let, when defined, GPIO
take precedence, so drivers could properly detect card state and not
use polling.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
drivers/mmc/host/sdhci.c

index d919bb7c67811e28306ea53485090a3366e43014..ea4c66dec677bdc0ef1f006112bb49f889706639 100644 (file)
@@ -1640,10 +1640,6 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
        if (host->flags & SDHCI_DEVICE_DEAD)
                return 0;
 
-       /* If nonremovable, assume that the card is always present. */
-       if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
-               return 1;
-
        /*
         * Try slot gpio detect, if defined it take precedence
         * over build in controller functionality
@@ -1651,8 +1647,9 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
        if (!IS_ERR_VALUE(gpio_cd))
                return !!gpio_cd;
 
-       /* If polling, assume that the card is always present. */
-       if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
+       /* If polling/nonremovable, assume that the card is always present. */
+       if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
+           (host->mmc->caps & MMC_CAP_NONREMOVABLE))
                return 1;
 
        /* Host native card detect */