]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
sdhci: Add support for hosts reporting inverted write-protect state
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Mon, 16 Mar 2009 21:13:54 +0000 (00:13 +0300)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 24 Mar 2009 20:30:09 +0000 (21:30 +0100)
This patch adds SDHCI_QUIRK_INVERTED_WRITE_PROTECT quirk. When
specified, the sdhci driver will invert WP state.

p.s. Actually, the quirk is more board-specific than
     controller-specific.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h

index fc7cb489bdb7336772b6ac01d5f36afec7fbdacf..c814220d214e7842c9534fc2a5abcffc2e076259 100644 (file)
@@ -1149,6 +1149,8 @@ static int sdhci_get_ro(struct mmc_host *mmc)
 
        spin_unlock_irqrestore(&host->lock, flags);
 
+       if (host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT)
+               return !!(present & SDHCI_WRITE_PROTECT);
        return !(present & SDHCI_WRITE_PROTECT);
 }
 
index 968d713950f11730c53381feba3fb5e75a20fb8d..6980f2725b8592cdfe928474376f6d28afe8ec85 100644 (file)
@@ -216,6 +216,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK_NO_BUSY_IRQ                                (1<<14)
 /* Controller has unreliable card detection */
 #define SDHCI_QUIRK_BROKEN_CARD_DETECTION              (1<<15)
+/* Controller reports inverted write-protect state */
+#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT             (1<<16)
 
        int                     irq;            /* Device IRQ */
        void __iomem *          ioaddr;         /* Mapped address */