@@ -1719,6 +1719,9 @@ static int sdhci_get_ro(struct mmc_host *mmc)
struct sdhci_host *host = mmc_priv(mmc);
int ret;
+ if (host->quirks2 & SDHCI_QUIRK2_DISABLE_WRITE_PROTECT)
+ return 0;
+
sdhci_runtime_pm_get(host);
ret = sdhci_do_get_ro(host);
sdhci_runtime_pm_put(host);
@@ -409,6 +409,8 @@ struct sdhci_host {
#define SDHCI_QUIRK2_SUPPORT_SINGLE (1<<13)
/* Controller broken with using ACMD23 */
#define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14)
+/* Write protect signal is not wired, data in SDHCI_PRESENT_STATE is bogus */
+#define SDHCI_QUIRK2_DISABLE_WRITE_PROTECT (1<<15)
int irq; /* Device IRQ */
void __iomem *ioaddr; /* Mapped address */
It is not uncommon to see systems where there is no physical write-protect signal (e.g. when using eMMC or microSD cards). Some SDHCI controllers may have bogus data in the SDHCI_WRITE_PROTECT of the SDHCI_PRESENT_STATE register on such systems. Add a new quirk which disables reading of the write-protect status when set. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> --- drivers/mmc/host/sdhci.c | 3 +++ drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 5 insertions(+)