linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: pxa3xx_nand: add cmdline part parser support
@ 2010-05-06  2:42 Lei Wen
  0 siblings, 0 replies; only message in thread
From: Lei Wen @ 2010-05-06  2:42 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Lei Wen <leiwen@marvell.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
 drivers/mtd/nand/pxa3xx_nand.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 2eebd20..793b64c 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -349,6 +349,9 @@ static struct pxa3xx_nand_flash __devinitdata
builtin_flash_types[] = {
 	{ 0, 10, 35, 15, 25, 15, 25, 25000, 0, 60, 10, }, },
 };

+#ifdef CONFIG_MTD_CMDLINE_PARTS
+static const char *part_probes[] = { "cmdlinepart", NULL };
+#endif
 static const char *mtd_names[] = {"pxa3xx_nand-0", "pxa3xx_nand-1", NULL};

 /* convert nano-seconds to nand flash controller clock cycles */
@@ -1726,6 +1729,10 @@ static int __devinit pxa3xx_nand_probe(struct
platform_device *pdev)
 	struct pxa3xx_nand *nand;
 	struct mtd_info *mtd;
 	int ret, cs, probe_success = 0;
+#ifdef CONFIG_MTD_PARTITIONS
+	struct mtd_partition *partitions = NULL;
+	int num_part = 0;
+#endif

 	pdata = pdev->dev.platform_data;
 	if (!pdata) {
@@ -1747,8 +1754,23 @@ static int __devinit pxa3xx_nand_probe(struct
platform_device *pdev)
 			dev_err(&pdev->dev, "failed to scan cs#%d nand\n", cs);
 			continue;
 		}
-		ret = add_mtd_partitions(mtd, pdata->parts[cs],
-				pdata->nr_parts[cs]);
+		mtd->name = mtd_names[cs];
+#ifdef CONFIG_MTD_PARTITIONS
+#ifdef CONFIG_MTD_CMDLINE_PARTS
+		num_part = parse_mtd_partitions(mtd, part_probes, &partitions, 0);
+#endif
+		if (num_part <= 0) {
+			num_part = pdata->nr_parts[cs];
+			partitions = pdata->parts[cs];
+		}
+
+		if (partitions && num_part > 0)
+			ret = add_mtd_partitions(mtd, partitions, num_part);
+		else
+			ret = add_mtd_device(mtd);
+#else
+		ret = add_mtd_device(mtd);
+#endif
 		if (!ret)
 			probe_success = 1;
 	}
-- 
1.5.6.5

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

only message in thread, other threads:[~2010-05-06  2:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06  2:42 [PATCH] mtd: pxa3xx_nand: add cmdline part parser support Lei Wen

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).