Messages in this thread Patch in this message | | | Date | Thu, 18 Sep 2008 23:58:14 +0800 | From | "Conke Hu" <> | Subject | Re: s3c24xx nand: add command line partition table parsing support (resend) |
| |
Add mtd id and command line partition table parsing support for s3c24xx nand driver.
Signed-off-by: Conke Hu <conke.hu@gmail.com> Signed-off-by: Linke Wang <linke.wang@gmail.com> ------------------ diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index 556139e..db0d331 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -48,6 +48,8 @@ #include <asm/plat-s3c/regs-nand.h> #include <asm/plat-s3c/nand.h>
+#define S3C_NAND_NAME_LEN 16 + #ifdef CONFIG_MTD_NAND_S3C2410_HWECC static int hardware_ecc = 1; #else @@ -60,6 +62,9 @@ static int clock_stop = 1; static const int clock_stop = 0; #endif
+#ifdef CONFIG_MTD_PARTITIONS +static const char *s3c_part_probes[] = {"cmdlinepart", NULL}; +#endif
/* new oob placement block for use with hardware ecc generation */ @@ -80,6 +85,7 @@ struct s3c2410_nand_mtd { struct s3c2410_nand_set *set; struct s3c2410_nand_info *info; int scan_res; + char name[S3C_NAND_NAME_LEN]; };
enum s3c_cpu_type { @@ -649,6 +655,15 @@ static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info, struct s3c2410_nand_mtd *mtd, struct s3c2410_nand_set *set) { +#ifdef CONFIG_MTD_CMDLINE_PARTS + int nr_parts; + struct mtd_partition *partitions; + + nr_parts = parse_mtd_partitions(&mtd->mtd, s3c_part_probes, &partitions, 0); + if (nr_parts > 0 && partitions != NULL) + return add_mtd_partitions(&mtd->mtd, partitions, nr_parts); +#endif + if (set == NULL) return add_mtd_device(&mtd->mtd);
@@ -892,6 +907,9 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, for (setno = 0; setno < nr_sets; setno++, nmtd++) { pr_debug("initialising set %d (%p, info %p)\n", setno, nmtd, info);
+ snprintf(nmtd->name, sizeof(nmtd->name), "s3c_nand%d", setno); + nmtd->mtd.name = nmtd->name; + s3c2410_nand_init_chip(info, nmtd, sets);
nmtd->scan_res = nand_scan_ident(&nmtd->mtd,
| |