summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
authorMingkai Hu <Mingkai.hu@freescale.com>2010-10-12 12:18:34 +0200
committerGrant Likely <grant.likely@secretlab.ca>2010-10-22 09:37:16 +0200
commit97ff46cb69da22037346670ae515217c658ace02 (patch)
tree84acc87dfb6e1abcde654c1109a354c670c42ca4 /drivers/mtd/devices
parentof/irq: of_irq.c needs to include linux/irq.h (diff)
downloadlinux-97ff46cb69da22037346670ae515217c658ace02.tar.xz
linux-97ff46cb69da22037346670ae515217c658ace02.zip
mtd/m25p80: add support to parse the partitions by OF node
Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com> [grant.likely@secretlab.ca: wrap hunk with #ifdef CONFIG_OF] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/m25p80.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 6f512b5c117b..ea22520c0406 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -924,6 +924,13 @@ static int __devinit m25p_probe(struct spi_device *spi)
nr_parts = data->nr_parts;
}
+#ifdef CONFIG_OF
+ if (nr_parts <= 0 && spi->dev.of_node) {
+ nr_parts = of_mtd_parse_partitions(&spi->dev,
+ spi->dev.of_node, &parts);
+ }
+#endif
+
if (nr_parts > 0) {
for (i = 0; i < nr_parts; i++) {
DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = "