summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMingkai Hu <Mingkai.hu@freescale.com>2010-10-12 18:18:34 +0800
committerGrant Likely <grant.likely@secretlab.ca>2010-10-22 01:37:16 -0600
commit97ff46cb69da22037346670ae515217c658ace02 (patch)
tree84acc87dfb6e1abcde654c1109a354c670c42ca4 /drivers/mtd
parent530719b2341fea925f58a5d6be0353fa43a88baf (diff)
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')
-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] = "