From: Anton Vorontsov Date: Mon, 16 Mar 2009 21:13:54 +0000 (+0300) Subject: sdhci: Add support for hosts reporting inverted write-protect state X-Git-Tag: firefly_0821_release~14784^2~8 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c5075a1089e808d8f471ce21b02810cc98ab2692;p=firefly-linux-kernel-4.4.55.git sdhci: Add support for hosts reporting inverted write-protect state 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 Signed-off-by: Pierre Ossman --- diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index fc7cb489bdb7..c814220d214e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -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); } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 968d713950f1..6980f2725b85 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -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 */