mmc: sdhci: Allow caps[1] to be set via SDHCI_QUIRK_MISSING_CAPS
authorPhilip Rakity <prakity@marvell.com>
Thu, 28 Jun 2012 04:49:27 +0000 (21:49 -0700)
committerChris Ball <cjb@laptop.org>
Sun, 22 Jul 2012 19:25:44 +0000 (15:25 -0400)
Currently only the capability_0 register can be set if
SDHCI_QUIRK_MISSING_CAPS is defined.  This is a problem when
the capability_1 register also needs changing.  Use the quirk
SDHCI_QUIRK_MISSING_CAPS to allow both registers to be set.

Redefining caps[1] is useful when the board design does not
support 1.8v vccq so UHS modes are not available.  The code that
calls sdhci_add_host can then detect this condition and adjust
the caps so the UHS mode will not be attempted on UHS cards.

Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/sdhci.c
include/linux/mmc/sdhci.h

index f76736b50bc786c19b0bf9091f080b593f3c4c04..206b52fec44351d38ff457b207e204af1046ed02 100644 (file)
@@ -2584,7 +2584,7 @@ EXPORT_SYMBOL_GPL(sdhci_alloc_host);
 int sdhci_add_host(struct sdhci_host *host)
 {
        struct mmc_host *mmc;
-       u32 caps[2];
+       u32 caps[2] = {0, 0};
        u32 max_current_caps;
        unsigned int ocr_avail;
        int ret;
@@ -2614,8 +2614,10 @@ int sdhci_add_host(struct sdhci_host *host)
        caps[0] = (host->quirks & SDHCI_QUIRK_MISSING_CAPS) ? host->caps :
                sdhci_readl(host, SDHCI_CAPABILITIES);
 
-       caps[1] = (host->version >= SDHCI_SPEC_300) ?
-               sdhci_readl(host, SDHCI_CAPABILITIES_1) : 0;
+       if (host->version >= SDHCI_SPEC_300)
+               caps[1] = (host->quirks & SDHCI_QUIRK_MISSING_CAPS) ?
+                       host->caps1 :
+                       sdhci_readl(host, SDHCI_CAPABILITIES_1);
 
        if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
                host->flags |= SDHCI_USE_SDMA;
index e9051e1cb1ce38434d0443cfee5c7c74e43a1967..d989b511c9abd573aa97a6fa93e49d9a12e7e793 100644 (file)
@@ -155,7 +155,8 @@ struct sdhci_host {
 
        struct timer_list timer;        /* Timer for timeouts */
 
-       unsigned int caps;      /* Alternative capabilities */
+       unsigned int caps;      /* Alternative CAPABILITY_0 */
+       unsigned int caps1;     /* Alternative CAPABILITY_1 */
 
        unsigned int            ocr_avail_sdio; /* OCR bit masks */
        unsigned int            ocr_avail_sd;