diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-09-22 19:45:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 10:39:37 -0400 |
commit | 8226a219254bbcd20492df185f191a11a7a81dcd (patch) | |
tree | c9715c09c3a010b9b78aab3c044be1f47084fc60 /drivers/mmc | |
parent | 50dfe70fe9e216cf356830194630f9a39e498d76 (diff) |
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>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci-of.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-of.c b/drivers/mmc/host/sdhci-of.c index 56041dc74ce1..c8dab07e34b8 100644 --- a/drivers/mmc/host/sdhci-of.c +++ b/drivers/mmc/host/sdhci-of.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/of.h> | 21 | #include <linux/of.h> |
22 | #include <linux/of_platform.h> | 22 | #include <linux/of_platform.h> |
23 | #include <linux/mmc/host.h> | 23 | #include <linux/mmc/host.h> |
24 | #include <asm/machdep.h> | ||
24 | #include "sdhci.h" | 25 | #include "sdhci.h" |
25 | 26 | ||
26 | struct sdhci_of_data { | 27 | struct sdhci_of_data { |
@@ -175,7 +176,6 @@ static unsigned int esdhc_get_min_clock(struct sdhci_host *host) | |||
175 | static struct sdhci_of_data sdhci_esdhc = { | 176 | static struct sdhci_of_data sdhci_esdhc = { |
176 | .quirks = SDHCI_QUIRK_FORCE_BLK_SZ_2048 | | 177 | .quirks = SDHCI_QUIRK_FORCE_BLK_SZ_2048 | |
177 | SDHCI_QUIRK_BROKEN_CARD_DETECTION | | 178 | SDHCI_QUIRK_BROKEN_CARD_DETECTION | |
178 | SDHCI_QUIRK_INVERTED_WRITE_PROTECT | | ||
179 | SDHCI_QUIRK_NO_BUSY_IRQ | | 179 | SDHCI_QUIRK_NO_BUSY_IRQ | |
180 | SDHCI_QUIRK_NONSTANDARD_CLOCK | | 180 | SDHCI_QUIRK_NONSTANDARD_CLOCK | |
181 | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | | 181 | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | |
@@ -219,6 +219,15 @@ static int sdhci_of_resume(struct of_device *ofdev) | |||
219 | 219 | ||
220 | #endif | 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 | static int __devinit sdhci_of_probe(struct of_device *ofdev, | 231 | static int __devinit sdhci_of_probe(struct of_device *ofdev, |
223 | const struct of_device_id *match) | 232 | const struct of_device_id *match) |
224 | { | 233 | { |
@@ -261,6 +270,9 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev, | |||
261 | if (of_get_property(np, "sdhci,1-bit-only", NULL)) | 270 | if (of_get_property(np, "sdhci,1-bit-only", NULL)) |
262 | host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; | 271 | host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; |
263 | 272 | ||
273 | if (sdhci_of_wp_inverted(np)) | ||
274 | host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT; | ||
275 | |||
264 | clk = of_get_property(np, "clock-frequency", &size); | 276 | clk = of_get_property(np, "clock-frequency", &size); |
265 | if (clk && size == sizeof(*clk) && *clk) | 277 | if (clk && size == sizeof(*clk) && *clk) |
266 | of_host->clock = *clk; | 278 | of_host->clock = *clk; |