sdhci: Add a quirk to disable write-protect
PATCH 1/1 sdhci: Add a quirk to disable write-protect
When a board does not have the WP line wired at all, the card may be detected as read-only. Add a quirk and a device property to disable WP detection.
Signed-off-by Mike Looijmans <[email protected]>
--- drivers/mmc/host/sdhci-pltfm.c | 3 +++ drivers/mmc/host/sdhci.c | 3 ++- include/linux/mmc/sdhci.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pltfm.c +3 -0
@@ -83,6 +83,9 @@ void sdhci_get_of_property(struct platform_device *pdev)if (sdhci_of_wp_inverted (np)) host->quirks |=SDHCI_QUIRK_INVERTED_WRITE_PROTECT ; +if (of_get_property (np,"disable-wp" ,NULL )) + host->quirks2 |=SDHCI_QUIRK2_DISABLE_WP ; +if (of_get_property (np,"broken-cd" ,NULL )) host->quirks |=SDHCI_QUIRK_BROKEN_CARD_DETECTION ;
drivers/mmc/host/sdhci.c +2 -1
@@ -1635,7 +1635,8 @@ static int sdhci_check_ro(struct sdhci_host *host)spin_lock_irqsave (&host->lock, flags); -if (host->flags &SDHCI_DEVICE_DEAD ) +if ((host->flags &SDHCI_DEVICE_DEAD ) || + (host->quirks2 &SDHCI_QUIRK2_DISABLE_WP )) is_readonly =0 ;else if (host->ops->get_ro) is_readonly = host->ops->get_ro (host);
include/linux/mmc/sdhci.h +2 -0
@@ -98,6 +98,8 @@ struct sdhci_host {#define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1<<4)/* Controller has a non-standard host control register */ #define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5) +/* Controller lacks write protect detection */ +#define SDHCI_QUIRK2_DISABLE_WP (1<<6)int irq;/* Device IRQ */ void __iomem *ioaddr;/* Mapped address */
Signature · 1 line
1.7.9.5