[PATCH] s3c24xx nand: add command line partition table parsing support

Previous thread: Re: [RFC][Resend] Make NFS-Client readahead tunable by Martin Knoblauch on Wednesday, September 17, 2008 - 10:01 am. (1 message)

Next thread: none
From: Conke Hu
Date: Wednesday, September 17, 2008 - 10:32 am

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..bab7216 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
  */
@@ -649,6 +654,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);

@@ -808,6 +822,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev,
 	int size;
 	int nr_sets;
 	int setno;
+	char *name;

 	pr_debug("s3c2410_nand_probe(%p)\n", pdev);

@@ -875,7 +890,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev,

 	/* allocate our information */

-	size = nr_sets * sizeof(*info->mtds);
+	size = nr_sets * (sizeof(*info->mtds) + S3C_NAND_NAME_LEN);
 	info->mtds = kmalloc(size, GFP_KERNEL);
 	if (info->mtds == NULL) {
 		dev_err(&pdev->dev, "failed to allocate mtd storage\n");
@@ -888,10 +903,15 @@ static int s3c24xx_nand_probe(struct
platform_device *pdev,
 	/* initialise all possible chips ...
From: Russell King
Date: Wednesday, September 17, 2008 - 10:58 am

By sending this to the linux-arm list at vger, you're missing out the
majority of the ARM community.  Please use the proper (listed) mailing
list in MAINTAINERS.


-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
--

From: Conke Hu
Date: Wednesday, September 17, 2008 - 1:08 pm

Thank you, Russell
then I'd sent it to linux-arm-kernel@lists.arm.linux.org.uk &
ben-linux@fluff.org, right?
I am subscribing linux-arm-kernel@lists.arm.linux.org.uk :)

regards,
Conke

--

Previous thread: Re: [RFC][Resend] Make NFS-Client readahead tunable by Martin Knoblauch on Wednesday, September 17, 2008 - 10:01 am. (1 message)

Next thread: none