Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sdhci-of: don't hard-code inverted write-protect quirk

MPC85xx SOCs have normal write-protect state reporting, so we shouldn't
hard-code the quirk.

Instead, look for "sdhci,wp-inverted" property, plus check for
mpc837x_{rdb,mds} machines since older device trees don't specify the new
property.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Pierre Ossman <pierre@ossman.eu>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: David Vrabel <david.vrabel@csr.com>
Cc: Ben Dooks <ben@fluff.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Anton Vorontsov and committed by
Linus Torvalds
8226a219 50dfe70f

+13 -1
+13 -1
drivers/mmc/host/sdhci-of.c
··· 21 21 #include <linux/of.h> 22 22 #include <linux/of_platform.h> 23 23 #include <linux/mmc/host.h> 24 + #include <asm/machdep.h> 24 25 #include "sdhci.h" 25 26 26 27 struct sdhci_of_data { ··· 176 175 static struct sdhci_of_data sdhci_esdhc = { 177 176 .quirks = SDHCI_QUIRK_FORCE_BLK_SZ_2048 | 178 177 SDHCI_QUIRK_BROKEN_CARD_DETECTION | 179 - SDHCI_QUIRK_INVERTED_WRITE_PROTECT | 180 178 SDHCI_QUIRK_NO_BUSY_IRQ | 181 179 SDHCI_QUIRK_NONSTANDARD_CLOCK | 182 180 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | ··· 219 219 220 220 #endif 221 221 222 + static bool __devinit sdhci_of_wp_inverted(struct device_node *np) 223 + { 224 + if (of_get_property(np, "sdhci,wp-inverted", NULL)) 225 + return true; 226 + 227 + /* Old device trees don't have the wp-inverted property. */ 228 + return machine_is(mpc837x_rdb) || machine_is(mpc837x_mds); 229 + } 230 + 222 231 static int __devinit sdhci_of_probe(struct of_device *ofdev, 223 232 const struct of_device_id *match) 224 233 { ··· 269 260 270 261 if (of_get_property(np, "sdhci,1-bit-only", NULL)) 271 262 host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; 263 + 264 + if (sdhci_of_wp_inverted(np)) 265 + host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT; 272 266 273 267 clk = of_get_property(np, "clock-frequency", &size); 274 268 if (clk && size == sizeof(*clk) && *clk)