linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: m25p80: don't probe device which has status of 'disabled'
@ 2011-10-14  7:49 Shaohui Xie
  0 siblings, 0 replies; only message in thread
From: Shaohui Xie @ 2011-10-14  7:49 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: linux-mtd, Shaohui Xie

On some platforms such as P3060QDS, has multiple spi flashes, but they are
not available at same time, so if their status is 'disabled', which is set
by u-boot, will not be probed.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
Disabled nodes should automatically not be probed. But I found this is only
true for spi node, for the flash nodes which embedded in spi node, still got
probed even it has a status of 'disabled'.

 drivers/mtd/devices/m25p80.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 4e20c4d..30d61d5 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -30,6 +30,7 @@
 #include <linux/mtd/cfi.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/of_platform.h>
 
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
@@ -829,6 +830,11 @@ static int __devinit m25p_probe(struct spi_device *spi)
 	struct mtd_partition		*parts = NULL;
 	int				nr_parts = 0;
 
+#ifdef CONFIG_MTD_OF_PARTS
+	if (!of_device_is_available(spi->dev.of_node))
+		return -ENODEV;
+#endif
+
 	/* Platform data helps sort out which chip type we have, as
 	 * well as how this board partitions it.  If we don't have
 	 * a chip ID, try the JEDEC id commands; they'll work for most
-- 
1.6.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-14  8:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-14  7:49 [PATCH] mtd: m25p80: don't probe device which has status of 'disabled' Shaohui Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).