#include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/mmc/host.h>
+#include <asm/machdep.h>
 #include "sdhci.h"
 
 struct sdhci_of_data {
 static struct sdhci_of_data sdhci_esdhc = {
        .quirks = SDHCI_QUIRK_FORCE_BLK_SZ_2048 |
                  SDHCI_QUIRK_BROKEN_CARD_DETECTION |
-                 SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
                  SDHCI_QUIRK_NO_BUSY_IRQ |
                  SDHCI_QUIRK_NONSTANDARD_CLOCK |
                  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
 
 #endif
 
+static bool __devinit sdhci_of_wp_inverted(struct device_node *np)
+{
+       if (of_get_property(np, "sdhci,wp-inverted", NULL))
+               return true;
+
+       /* Old device trees don't have the wp-inverted property. */
+       return machine_is(mpc837x_rdb) || machine_is(mpc837x_mds);
+}
+
 static int __devinit sdhci_of_probe(struct of_device *ofdev,
                                 const struct of_device_id *match)
 {
        if (of_get_property(np, "sdhci,1-bit-only", NULL))
                host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
 
+       if (sdhci_of_wp_inverted(np))
+               host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
+
        clk = of_get_property(np, "clock-frequency", &size);
        if (clk && size == sizeof(*clk) && *clk)
                of_host->clock = *clk;