mmc: sdhci: add quirk for keeping card power during suspend
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 7 Feb 2012 12:48:54 +0000 (14:48 +0200)
committerChris Ball <cjb@laptop.org>
Tue, 27 Mar 2012 16:20:08 +0000 (12:20 -0400)
Add quirk SDHCI_QUIRK2_HOST_OFF_CARD_ON to cater for the case when the
card keeps power during suspend but the host controller does not i.e.
the card power is not controlled by the host controller.  In that
case, the controller must be fully reset on resume.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/sdhci.c
include/linux/mmc/sdhci.h

index 1f5888b42b2c9fadbaa20c792e4a18dde994ce91..80cc7847c53151526ef6a5bbd07d60c87f4d6688 100644 (file)
@@ -2426,8 +2426,17 @@ int sdhci_resume_host(struct sdhci_host *host)
        if (ret)
                return ret;
 
-       sdhci_init(host, (host->mmc->pm_flags & MMC_PM_KEEP_POWER));
-       mmiowb();
+       if ((host->mmc->pm_flags & MMC_PM_KEEP_POWER) &&
+           (host->quirks2 & SDHCI_QUIRK2_HOST_OFF_CARD_ON)) {
+               /* Card keeps power but host controller does not */
+               sdhci_init(host, 0);
+               host->pwr = 0;
+               host->clock = 0;
+               sdhci_do_set_ios(host, &host->mmc->ios);
+       } else {
+               sdhci_init(host, (host->mmc->pm_flags & MMC_PM_KEEP_POWER));
+               mmiowb();
+       }
 
        ret = mmc_resume_host(host->mmc);
        sdhci_enable_card_detection(host);
index c750f85177d95cb7b849249ef9a0c007b7687992..e9051e1cb1ce38434d0443cfee5c7c74e43a1967 100644 (file)
@@ -90,6 +90,8 @@ struct sdhci_host {
 
        unsigned int quirks2;   /* More deviations from spec. */
 
+#define SDHCI_QUIRK2_HOST_OFF_CARD_ON                  (1<<0)
+
        int irq;                /* Device IRQ */
        void __iomem *ioaddr;   /* Mapped address */