public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [GIT PULL] sharpsl-nand driver model hookup
@ 2008-10-16 23:11 Dmitry Baryshkov
  2008-10-16 23:13 ` Dmitry Baryshkov
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2008-10-16 23:11 UTC (permalink / raw)
  To: linux-mtd; +Cc: Eric Miao

Hi,

Please have a look at the patches making sharpsl-nand more clean driver,
correctly hooked in the driver model.

The following changes since commit 6bb7a935489dab20802dde6c2cb7d8582f4849bf:
  Linus Torvalds (1):
        Merge branch 'for-linus' of git://git.kernel.org/.../tiwai/sound-2.6

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/lumag/tosa-2.6.git misc/mtd/sharpsl-nand

Dmitry Baryshkov (6):
      [MTD] sharpsl_nand: switch to driver model usage.
      [MTD] sharpsl_nand: make drvdata non-static
      [MTD] sharpsl_nand: move io addr to struct sharpsl_nand
      [MTD] sharpsl-nand: cleanup partitions support
      [MTD] sharpsl-nand: use platform_data for model-specific values
      [MTD] sharpsl-nand: move registration to board code

 arch/arm/mach-pxa/corgi.c   |   54 ++++++++++
 arch/arm/mach-pxa/poodle.c  |   51 +++++++++
 arch/arm/mach-pxa/spitz.c   |   76 +++++++++++++
 drivers/mtd/nand/sharpsl.c  |  248 +++++++++++++++++++++----------------------
 include/linux/mtd/sharpsl.h |   20 ++++
 5 files changed, 324 insertions(+), 125 deletions(-)
 create mode 100644 include/linux/mtd/sharpsl.h

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [GIT PULL] sharpsl-nand driver model hookup
  2008-10-16 23:11 [GIT PULL] sharpsl-nand driver model hookup Dmitry Baryshkov
@ 2008-10-16 23:13 ` Dmitry Baryshkov
  2008-10-16 23:15 ` [PATCH 1/6] [MTD] sharpsl_nand: switch to driver model usage Dmitry Baryshkov
  2008-11-25  9:05 ` [GIT PULL] sharpsl-nand driver model hookup Eric Miao
  2 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2008-10-16 23:13 UTC (permalink / raw)
  To: linux-mtd; +Cc: Eric Miao

On Fri, Oct 17, 2008 at 03:11:27AM +0400, Dmitry Baryshkov wrote:
> Hi,
> 
> Please have a look at the patches making sharpsl-nand more clean driver,
> correctly hooked in the driver model.

Unfortunately patches from this branch have been held by mailman.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/6] [MTD] sharpsl_nand: switch to driver model usage.
  2008-10-16 23:11 [GIT PULL] sharpsl-nand driver model hookup Dmitry Baryshkov
  2008-10-16 23:13 ` Dmitry Baryshkov
@ 2008-10-16 23:15 ` Dmitry Baryshkov
  2008-10-16 23:15   ` [PATCH 2/6] [MTD] sharpsl_nand: make drvdata non-static Dmitry Baryshkov
  2008-11-25  9:05 ` [GIT PULL] sharpsl-nand driver model hookup Eric Miao
  2 siblings, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2008-10-16 23:15 UTC (permalink / raw)
  To: linux-mtd; +Cc: Dmitry Baryshkov, Eric Miao

Start cleanup of sharpsl_nand driver. Convert it to platform driver.
Corresponding device is temprorary registered in sharpsl.c but will be
later moved to corresponding board files.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
---
 drivers/mtd/nand/sharpsl.c |   63 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c
index 30a518e..0a99188 100644
--- a/drivers/mtd/nand/sharpsl.c
+++ b/drivers/mtd/nand/sharpsl.c
@@ -20,12 +20,13 @@
 #include <linux/mtd/nand_ecc.h>
 #include <linux/mtd/partitions.h>
 #include <linux/interrupt.h>
+#include <linux/platform_device.h>
+
 #include <asm/io.h>
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 
 static void __iomem *sharpsl_io_base;
-static int sharpsl_phys_base = 0x0C000000;
 
 /* register offset */
 #define ECCLPLB	 	sharpsl_io_base+0x00	/* line parity 7 - 0 bit */
@@ -150,10 +151,11 @@ const char *part_probes[] = { "cmdlinepart", NULL };
 /*
  * Main initialization routine
  */
-static int __init sharpsl_nand_init(void)
+static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 {
 	struct nand_chip *this;
 	struct mtd_partition *sharpsl_partition_info;
+	struct resource *r;
 	int err = 0;
 
 	/* Allocate memory for MTD device structure and private data */
@@ -163,8 +165,15 @@ static int __init sharpsl_nand_init(void)
 		return -ENOMEM;
 	}
 
+	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!r) {
+		dev_err(&pdev->dev, "no io memory resource defined!\n");
+		err = -ENODEV;
+		goto err_get_res;
+	}
+
 	/* map physical address */
-	sharpsl_io_base = ioremap(sharpsl_phys_base, 0x1000);
+	sharpsl_io_base = ioremap(r->start, resource_size(r));
 	if (!sharpsl_io_base) {
 		printk("ioremap to access Sharp SL NAND chip failed\n");
 		kfree(sharpsl_mtd);
@@ -242,14 +251,16 @@ static int __init sharpsl_nand_init(void)
 
 	/* Return happy */
 	return 0;
-}
 
-module_init(sharpsl_nand_init);
+err_get_res:
+	kfree(sharpsl_mtd);
+	return err;
+}
 
 /*
  * Clean up routine
  */
-static void __exit sharpsl_nand_cleanup(void)
+static int __devexit sharpsl_nand_remove(struct platform_device *pdev)
 {
 	/* Release resources, unregister device */
 	nand_release(sharpsl_mtd);
@@ -258,9 +269,47 @@ static void __exit sharpsl_nand_cleanup(void)
 
 	/* Free the MTD device structure */
 	kfree(sharpsl_mtd);
+
+	return 0;
+}
+
+static struct platform_driver sharpsl_nand_driver = {
+	.driver = {
+		.name	= "sharpsl-nand",
+		.owner	= THIS_MODULE,
+	},
+	.probe		= sharpsl_nand_probe,
+	.remove		= __devexit_p(sharpsl_nand_remove),
+};
+
+static struct resource sharpsl_nand_resources[] = {
+	{
+		.start	= 0x0C000000,
+		.end	= 0x0C000FFF,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device sharpsl_nand_device = {
+	.name		= "sharpsl-nand",
+	.id		= -1,
+	.resource	= sharpsl_nand_resources,
+	.num_resources	= ARRAY_SIZE(sharpsl_nand_resources),
+};
+
+static int __init sharpsl_nand_init(void)
+{
+	platform_device_register(&sharpsl_nand_device);
+	return platform_driver_register(&sharpsl_nand_driver);
 }
+module_init(sharpsl_nand_init);
 
-module_exit(sharpsl_nand_cleanup);
+static void __exit sharpsl_nand_exit(void)
+{
+	platform_driver_unregister(&sharpsl_nand_driver);
+	platform_device_unregister(&sharpsl_nand_device);
+}
+module_exit(sharpsl_nand_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/6] [MTD] sharpsl_nand: make drvdata non-static
  2008-10-16 23:15 ` [PATCH 1/6] [MTD] sharpsl_nand: switch to driver model usage Dmitry Baryshkov
@ 2008-10-16 23:15   ` Dmitry Baryshkov
  2008-10-16 23:15     ` [PATCH 3/6] [MTD] sharpsl_nand: move io addr to struct sharpsl_nand Dmitry Baryshkov
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2008-10-16 23:15 UTC (permalink / raw)
  To: linux-mtd; +Cc: Dmitry Baryshkov, Eric Miao

Merge mtd_info and nand_chip info special struct and
make it drvdata instead of plain static variable.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
---
 drivers/mtd/nand/sharpsl.c |   53 ++++++++++++++++++++++++--------------------
 1 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c
index 0a99188..6851806 100644
--- a/drivers/mtd/nand/sharpsl.c
+++ b/drivers/mtd/nand/sharpsl.c
@@ -26,6 +26,11 @@
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 
+struct sharpsl_nand {
+	struct mtd_info		mtd;
+	struct nand_chip	chip;
+};
+
 static void __iomem *sharpsl_io_base;
 
 /* register offset */
@@ -46,11 +51,6 @@ static void __iomem *sharpsl_io_base;
 #define FLCE0		(1 << 0)
 
 /*
- * MTD structure for SharpSL
- */
-static struct mtd_info *sharpsl_mtd = NULL;
-
-/*
  * Define partitions for flash device
  */
 #define DEFAULT_NUM_PARTITIONS 3
@@ -157,10 +157,11 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 	struct mtd_partition *sharpsl_partition_info;
 	struct resource *r;
 	int err = 0;
+	struct sharpsl_nand *sharpsl;
 
 	/* Allocate memory for MTD device structure and private data */
-	sharpsl_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
-	if (!sharpsl_mtd) {
+	sharpsl = kzalloc(sizeof(struct sharpsl_nand), GFP_KERNEL);
+	if (!sharpsl) {
 		printk("Unable to allocate SharpSL NAND MTD device structure.\n");
 		return -ENOMEM;
 	}
@@ -176,20 +177,18 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 	sharpsl_io_base = ioremap(r->start, resource_size(r));
 	if (!sharpsl_io_base) {
 		printk("ioremap to access Sharp SL NAND chip failed\n");
-		kfree(sharpsl_mtd);
-		return -EIO;
+		err = -EIO;
+		goto err_ioremap;
 	}
 
 	/* Get pointer to private data */
-	this = (struct nand_chip *)(&sharpsl_mtd[1]);
-
-	/* Initialize structures */
-	memset(sharpsl_mtd, 0, sizeof(struct mtd_info));
-	memset(this, 0, sizeof(struct nand_chip));
+	this = (struct nand_chip *)(&sharpsl->chip);
 
 	/* Link the private data with the MTD structure */
-	sharpsl_mtd->priv = this;
-	sharpsl_mtd->owner = THIS_MODULE;
+	sharpsl->mtd.priv = this;
+	sharpsl->mtd.owner = THIS_MODULE;
+
+	platform_set_drvdata(pdev, sharpsl);
 
 	/*
 	 * PXA initialize
@@ -218,16 +217,17 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 	this->ecc.correct = nand_correct_data;
 
 	/* Scan to find existence of the device */
-	err = nand_scan(sharpsl_mtd, 1);
+	err = nand_scan(&sharpsl->mtd, 1);
 	if (err) {
+		platform_set_drvdata(pdev, NULL);
 		iounmap(sharpsl_io_base);
-		kfree(sharpsl_mtd);
+		kfree(sharpsl);
 		return err;
 	}
 
 	/* Register the partitions */
-	sharpsl_mtd->name = "sharpsl-nand";
-	nr_partitions = parse_mtd_partitions(sharpsl_mtd, part_probes, &sharpsl_partition_info, 0);
+	sharpsl->mtd.name = "sharpsl-nand";
+	nr_partitions = parse_mtd_partitions(&sharpsl->mtd, part_probes, &sharpsl_partition_info, 0);
 
 	if (nr_partitions <= 0) {
 		nr_partitions = DEFAULT_NUM_PARTITIONS;
@@ -247,13 +247,14 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 		}
 	}
 
-	add_mtd_partitions(sharpsl_mtd, sharpsl_partition_info, nr_partitions);
+	add_mtd_partitions(&sharpsl->mtd, sharpsl_partition_info, nr_partitions);
 
 	/* Return happy */
 	return 0;
 
+err_ioremap:
 err_get_res:
-	kfree(sharpsl_mtd);
+	kfree(sharpsl);
 	return err;
 }
 
@@ -262,13 +263,17 @@ err_get_res:
  */
 static int __devexit sharpsl_nand_remove(struct platform_device *pdev)
 {
+	struct sharpsl_nand *sharpsl = platform_get_drvdata(pdev);
+
 	/* Release resources, unregister device */
-	nand_release(sharpsl_mtd);
+	nand_release(&sharpsl->mtd);
+
+	platform_set_drvdata(pdev, NULL);
 
 	iounmap(sharpsl_io_base);
 
 	/* Free the MTD device structure */
-	kfree(sharpsl_mtd);
+	kfree(sharpsl);
 
 	return 0;
 }
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/6] [MTD] sharpsl_nand: move io addr to struct sharpsl_nand
  2008-10-16 23:15   ` [PATCH 2/6] [MTD] sharpsl_nand: make drvdata non-static Dmitry Baryshkov
@ 2008-10-16 23:15     ` Dmitry Baryshkov
  2008-10-16 23:15       ` [PATCH 4/6] [MTD] sharpsl-nand: cleanup partitions support Dmitry Baryshkov
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2008-10-16 23:15 UTC (permalink / raw)
  To: linux-mtd; +Cc: Dmitry Baryshkov, Eric Miao

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
---
 drivers/mtd/nand/sharpsl.c |   59 +++++++++++++++++++++++--------------------
 1 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c
index 6851806..328e02e 100644
--- a/drivers/mtd/nand/sharpsl.c
+++ b/drivers/mtd/nand/sharpsl.c
@@ -29,18 +29,20 @@
 struct sharpsl_nand {
 	struct mtd_info		mtd;
 	struct nand_chip	chip;
+
+	void __iomem		*io;
 };
 
-static void __iomem *sharpsl_io_base;
+#define mtd_to_sharpsl(_mtd)	container_of(_mtd, struct sharpsl_nand, mtd)
 
 /* register offset */
-#define ECCLPLB	 	sharpsl_io_base+0x00	/* line parity 7 - 0 bit */
-#define ECCLPUB	 	sharpsl_io_base+0x04	/* line parity 15 - 8 bit */
-#define ECCCP	   	sharpsl_io_base+0x08	/* column parity 5 - 0 bit */
-#define ECCCNTR	 	sharpsl_io_base+0x0C	/* ECC byte counter */
-#define ECCCLRR	 	sharpsl_io_base+0x10	/* cleare ECC */
-#define FLASHIO	 	sharpsl_io_base+0x14	/* Flash I/O */
-#define FLASHCTL	sharpsl_io_base+0x18	/* Flash Control */
+#define ECCLPLB		0x00	/* line parity 7 - 0 bit */
+#define ECCLPUB		0x04	/* line parity 15 - 8 bit */
+#define ECCCP		0x08	/* column parity 5 - 0 bit */
+#define ECCCNTR		0x0C	/* ECC byte counter */
+#define ECCCLRR		0x10	/* cleare ECC */
+#define FLASHIO		0x14	/* Flash I/O */
+#define FLASHCTL	0x18	/* Flash Control */
 
 /* Flash control bit */
 #define FLRYBY		(1 << 5)
@@ -85,6 +87,7 @@ static struct mtd_partition sharpsl_nand_default_partition_info[] = {
 static void sharpsl_nand_hwcontrol(struct mtd_info *mtd, int cmd,
 				   unsigned int ctrl)
 {
+	struct sharpsl_nand *sharpsl = mtd_to_sharpsl(mtd);
 	struct nand_chip *chip = mtd->priv;
 
 	if (ctrl & NAND_CTRL_CHANGE) {
@@ -94,7 +97,7 @@ static void sharpsl_nand_hwcontrol(struct mtd_info *mtd, int cmd,
 
 		bits ^= 0x11;
 
-		writeb((readb(FLASHCTL) & ~0x17) | bits, FLASHCTL);
+		writeb((readb(sharpsl->io + FLASHCTL) & ~0x17) | bits, sharpsl->io + FLASHCTL);
 	}
 
 	if (cmd != NAND_CMD_NONE)
@@ -128,20 +131,23 @@ static struct nand_ecclayout akita_oobinfo = {
 
 static int sharpsl_nand_dev_ready(struct mtd_info *mtd)
 {
-	return !((readb(FLASHCTL) & FLRYBY) == 0);
+	struct sharpsl_nand *sharpsl = mtd_to_sharpsl(mtd);
+	return !((readb(sharpsl->io + FLASHCTL) & FLRYBY) == 0);
 }
 
 static void sharpsl_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 {
-	writeb(0, ECCCLRR);
+	struct sharpsl_nand *sharpsl = mtd_to_sharpsl(mtd);
+	writeb(0, sharpsl->io + ECCCLRR);
 }
 
 static int sharpsl_nand_calculate_ecc(struct mtd_info *mtd, const u_char * dat, u_char * ecc_code)
 {
-	ecc_code[0] = ~readb(ECCLPUB);
-	ecc_code[1] = ~readb(ECCLPLB);
-	ecc_code[2] = (~readb(ECCCP) << 2) | 0x03;
-	return readb(ECCCNTR) != 0;
+	struct sharpsl_nand *sharpsl = mtd_to_sharpsl(mtd);
+	ecc_code[0] = ~readb(sharpsl->io + ECCLPUB);
+	ecc_code[1] = ~readb(sharpsl->io + ECCLPLB);
+	ecc_code[2] = (~readb(sharpsl->io + ECCCP) << 2) | 0x03;
+	return readb(sharpsl->io + ECCCNTR) != 0;
 }
 
 #ifdef CONFIG_MTD_PARTITIONS
@@ -174,8 +180,8 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 	}
 
 	/* map physical address */
-	sharpsl_io_base = ioremap(r->start, resource_size(r));
-	if (!sharpsl_io_base) {
+	sharpsl->io = ioremap(r->start, resource_size(r));
+	if (!sharpsl->io) {
 		printk("ioremap to access Sharp SL NAND chip failed\n");
 		err = -EIO;
 		goto err_ioremap;
@@ -193,11 +199,11 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 	/*
 	 * PXA initialize
 	 */
-	writeb(readb(FLASHCTL) | FLWP, FLASHCTL);
+	writeb(readb(sharpsl->io + FLASHCTL) | FLWP, sharpsl->io + FLASHCTL);
 
 	/* Set address of NAND IO lines */
-	this->IO_ADDR_R = FLASHIO;
-	this->IO_ADDR_W = FLASHIO;
+	this->IO_ADDR_R = sharpsl->io + FLASHIO;
+	this->IO_ADDR_W = sharpsl->io + FLASHIO;
 	/* Set address of hardware control function */
 	this->cmd_ctrl = sharpsl_nand_hwcontrol;
 	this->dev_ready = sharpsl_nand_dev_ready;
@@ -218,12 +224,8 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 
 	/* Scan to find existence of the device */
 	err = nand_scan(&sharpsl->mtd, 1);
-	if (err) {
-		platform_set_drvdata(pdev, NULL);
-		iounmap(sharpsl_io_base);
-		kfree(sharpsl);
-		return err;
-	}
+	if (err)
+		goto err_scan;
 
 	/* Register the partitions */
 	sharpsl->mtd.name = "sharpsl-nand";
@@ -252,6 +254,9 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 	/* Return happy */
 	return 0;
 
+err_scan:
+	platform_set_drvdata(pdev, NULL);
+	iounmap(sharpsl->io);
 err_ioremap:
 err_get_res:
 	kfree(sharpsl);
@@ -270,7 +275,7 @@ static int __devexit sharpsl_nand_remove(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, NULL);
 
-	iounmap(sharpsl_io_base);
+	iounmap(sharpsl->io);
 
 	/* Free the MTD device structure */
 	kfree(sharpsl);
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/6] [MTD] sharpsl-nand: cleanup partitions support
  2008-10-16 23:15     ` [PATCH 3/6] [MTD] sharpsl_nand: move io addr to struct sharpsl_nand Dmitry Baryshkov
@ 2008-10-16 23:15       ` Dmitry Baryshkov
  2008-10-16 23:15         ` [PATCH 5/6] [MTD] sharpsl-nand: use platform_data for model-specific values Dmitry Baryshkov
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2008-10-16 23:15 UTC (permalink / raw)
  To: linux-mtd; +Cc: Dmitry Baryshkov, Eric Miao

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
---
 drivers/mtd/nand/sharpsl.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c
index 328e02e..17625c0 100644
--- a/drivers/mtd/nand/sharpsl.c
+++ b/drivers/mtd/nand/sharpsl.c
@@ -2,6 +2,7 @@
  * drivers/mtd/nand/sharpsl.c
  *
  *  Copyright (C) 2004 Richard Purdie
+ *  Copyright (C) 2008 Dmitry Baryshkov
  *
  *  Based on Sharp's NAND driver sharp_sl.c
  *
@@ -52,12 +53,12 @@ struct sharpsl_nand {
 #define FLCLE		(1 << 1)
 #define FLCE0		(1 << 0)
 
+#ifdef CONFIG_MTD_PARTITIONS
 /*
  * Define partitions for flash device
  */
 #define DEFAULT_NUM_PARTITIONS 3
 
-static int nr_partitions;
 static struct mtd_partition sharpsl_nand_default_partition_info[] = {
 	{
 	 .name = "System Area",
@@ -75,6 +76,7 @@ static struct mtd_partition sharpsl_nand_default_partition_info[] = {
 	 .size = MTDPART_SIZ_FULL,
 	 },
 };
+#endif
 
 /*
  *	hardware specific access to control-lines
@@ -151,7 +153,7 @@ static int sharpsl_nand_calculate_ecc(struct mtd_info *mtd, const u_char * dat,
 }
 
 #ifdef CONFIG_MTD_PARTITIONS
-const char *part_probes[] = { "cmdlinepart", NULL };
+static const char *part_probes[] = { "cmdlinepart", NULL };
 #endif
 
 /*
@@ -160,7 +162,10 @@ const char *part_probes[] = { "cmdlinepart", NULL };
 static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 {
 	struct nand_chip *this;
+#ifdef CONFIG_MTD_PARTITIONS
 	struct mtd_partition *sharpsl_partition_info;
+	int nr_partitions;
+#endif
 	struct resource *r;
 	int err = 0;
 	struct sharpsl_nand *sharpsl;
@@ -229,10 +234,11 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 
 	/* Register the partitions */
 	sharpsl->mtd.name = "sharpsl-nand";
+#ifdef CONFIG_MTD_PARTITIONS
 	nr_partitions = parse_mtd_partitions(&sharpsl->mtd, part_probes, &sharpsl_partition_info, 0);
 
 	if (nr_partitions <= 0) {
-		nr_partitions = DEFAULT_NUM_PARTITIONS;
+		nr_partitions = ARRAY_SIZE(sharpsl_nand_default_partition_info);
 		sharpsl_partition_info = sharpsl_nand_default_partition_info;
 		if (machine_is_poodle()) {
 			sharpsl_partition_info[1].size = 22 * 1024 * 1024;
@@ -249,11 +255,19 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 		}
 	}
 
-	add_mtd_partitions(&sharpsl->mtd, sharpsl_partition_info, nr_partitions);
+	err = add_mtd_partitions(&sharpsl->mtd, sharpsl_partition_info, nr_partitions);
+#else
+	err = add_mtd_device(&sharpsl->mtd);
+#endif
+	if (err)
+		goto err_add;
 
 	/* Return happy */
 	return 0;
 
+err_add:
+	nand_release(&sharpsl->mtd);
+
 err_scan:
 	platform_set_drvdata(pdev, NULL);
 	iounmap(sharpsl->io);
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/6] [MTD] sharpsl-nand: use platform_data for model-specific values
  2008-10-16 23:15       ` [PATCH 4/6] [MTD] sharpsl-nand: cleanup partitions support Dmitry Baryshkov
@ 2008-10-16 23:15         ` Dmitry Baryshkov
  2008-10-16 23:15           ` [PATCH 6/6] [MTD] sharpsl-nand: move registration to board code Dmitry Baryshkov
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2008-10-16 23:15 UTC (permalink / raw)
  To: linux-mtd; +Cc: Dmitry Baryshkov, Eric Miao

Add platform_data which holds all model-specific values, like badblocks
pattern, oobinfo, partitions.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
---
 drivers/mtd/nand/sharpsl.c  |  158 +++++++++++++++++++++++--------------------
 include/linux/mtd/sharpsl.h |   20 ++++++
 2 files changed, 104 insertions(+), 74 deletions(-)
 create mode 100644 include/linux/mtd/sharpsl.h

diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c
index 17625c0..698378c 100644
--- a/drivers/mtd/nand/sharpsl.c
+++ b/drivers/mtd/nand/sharpsl.c
@@ -20,6 +20,7 @@
 #include <linux/mtd/nand.h>
 #include <linux/mtd/nand_ecc.h>
 #include <linux/mtd/partitions.h>
+#include <linux/mtd/sharpsl.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 
@@ -53,31 +54,6 @@ struct sharpsl_nand {
 #define FLCLE		(1 << 1)
 #define FLCE0		(1 << 0)
 
-#ifdef CONFIG_MTD_PARTITIONS
-/*
- * Define partitions for flash device
- */
-#define DEFAULT_NUM_PARTITIONS 3
-
-static struct mtd_partition sharpsl_nand_default_partition_info[] = {
-	{
-	 .name = "System Area",
-	 .offset = 0,
-	 .size = 7 * 1024 * 1024,
-	 },
-	{
-	 .name = "Root Filesystem",
-	 .offset = 7 * 1024 * 1024,
-	 .size = 30 * 1024 * 1024,
-	 },
-	{
-	 .name = "Home Filesystem",
-	 .offset = MTDPART_OFS_APPEND,
-	 .size = MTDPART_SIZ_FULL,
-	 },
-};
-#endif
-
 /*
  *	hardware specific access to control-lines
  *	ctrl:
@@ -106,31 +82,6 @@ static void sharpsl_nand_hwcontrol(struct mtd_info *mtd, int cmd,
 		writeb(cmd, chip->IO_ADDR_W);
 }
 
-static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
-
-static struct nand_bbt_descr sharpsl_bbt = {
-	.options = 0,
-	.offs = 4,
-	.len = 2,
-	.pattern = scan_ff_pattern
-};
-
-static struct nand_bbt_descr sharpsl_akita_bbt = {
-	.options = 0,
-	.offs = 4,
-	.len = 1,
-	.pattern = scan_ff_pattern
-};
-
-static struct nand_ecclayout akita_oobinfo = {
-	.eccbytes = 24,
-	.eccpos = {
-		   0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
-		   0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
-		   0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
-	.oobfree = {{0x08, 0x09}}
-};
-
 static int sharpsl_nand_dev_ready(struct mtd_info *mtd)
 {
 	struct sharpsl_nand *sharpsl = mtd_to_sharpsl(mtd);
@@ -169,6 +120,12 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 	struct resource *r;
 	int err = 0;
 	struct sharpsl_nand *sharpsl;
+	struct sharpsl_nand_platform_data *data = pdev->dev.platform_data;
+
+	if (!data) {
+		dev_err(&pdev->dev, "no platform data!\n");
+		return -EINVAL;
+	}
 
 	/* Allocate memory for MTD device structure and private data */
 	sharpsl = kzalloc(sizeof(struct sharpsl_nand), GFP_KERNEL);
@@ -218,11 +175,8 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 	this->ecc.mode = NAND_ECC_HW;
 	this->ecc.size = 256;
 	this->ecc.bytes = 3;
-	this->badblock_pattern = &sharpsl_bbt;
-	if (machine_is_akita() || machine_is_borzoi()) {
-		this->badblock_pattern = &sharpsl_akita_bbt;
-		this->ecc.layout = &akita_oobinfo;
-	}
+	this->badblock_pattern = data->badblock_pattern;
+	this->ecc.layout = data->ecc_layout;
 	this->ecc.hwctl = sharpsl_nand_enable_hwecc;
 	this->ecc.calculate = sharpsl_nand_calculate_ecc;
 	this->ecc.correct = nand_correct_data;
@@ -236,29 +190,16 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)
 	sharpsl->mtd.name = "sharpsl-nand";
 #ifdef CONFIG_MTD_PARTITIONS
 	nr_partitions = parse_mtd_partitions(&sharpsl->mtd, part_probes, &sharpsl_partition_info, 0);
-
 	if (nr_partitions <= 0) {
-		nr_partitions = ARRAY_SIZE(sharpsl_nand_default_partition_info);
-		sharpsl_partition_info = sharpsl_nand_default_partition_info;
-		if (machine_is_poodle()) {
-			sharpsl_partition_info[1].size = 22 * 1024 * 1024;
-		} else if (machine_is_corgi() || machine_is_shepherd()) {
-			sharpsl_partition_info[1].size = 25 * 1024 * 1024;
-		} else if (machine_is_husky()) {
-			sharpsl_partition_info[1].size = 53 * 1024 * 1024;
-		} else if (machine_is_spitz()) {
-			sharpsl_partition_info[1].size = 5 * 1024 * 1024;
-		} else if (machine_is_akita()) {
-			sharpsl_partition_info[1].size = 58 * 1024 * 1024;
-		} else if (machine_is_borzoi()) {
-			sharpsl_partition_info[1].size = 32 * 1024 * 1024;
-		}
+		nr_partitions = data->nr_partitions;
+		sharpsl_partition_info = data->partitions;
 	}
 
-	err = add_mtd_partitions(&sharpsl->mtd, sharpsl_partition_info, nr_partitions);
-#else
-	err = add_mtd_device(&sharpsl->mtd);
+	if (nr_partitions > 0)
+		err = add_mtd_partitions(&sharpsl->mtd, sharpsl_partition_info, nr_partitions);
+	else
 #endif
+	err = add_mtd_device(&sharpsl->mtd);
 	if (err)
 		goto err_add;
 
@@ -306,6 +247,58 @@ static struct platform_driver sharpsl_nand_driver = {
 	.remove		= __devexit_p(sharpsl_nand_remove),
 };
 
+/*
+ * Define partitions for flash device
+ */
+static struct mtd_partition sharpsl_nand_partitions[] = {
+	{
+	 .name = "System Area",
+	 .offset = 0,
+	 .size = 7 * 1024 * 1024,
+	 },
+	{
+	 .name = "Root Filesystem",
+	 .offset = 7 * 1024 * 1024,
+	 .size = 30 * 1024 * 1024,
+	 },
+	{
+	 .name = "Home Filesystem",
+	 .offset = MTDPART_OFS_APPEND,
+	 .size = MTDPART_SIZ_FULL,
+	 },
+};
+
+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+
+static struct nand_bbt_descr sharpsl_bbt = {
+	.options = 0,
+	.offs = 4,
+	.len = 2,
+	.pattern = scan_ff_pattern
+};
+
+static struct nand_bbt_descr sharpsl_akita_bbt = {
+	.options = 0,
+	.offs = 4,
+	.len = 1,
+	.pattern = scan_ff_pattern
+};
+
+static struct nand_ecclayout akita_oobinfo = {
+	.eccbytes = 24,
+	.eccpos = {
+		   0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
+		   0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
+		   0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
+	.oobfree = {{0x08, 0x09}}
+};
+
+static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
+	.badblock_pattern	= &sharpsl_bbt,
+	.partitions		= sharpsl_nand_partitions,
+	.nr_partitions		= ARRAY_SIZE(sharpsl_nand_partitions),
+};
+
 static struct resource sharpsl_nand_resources[] = {
 	{
 		.start	= 0x0C000000,
@@ -319,10 +312,27 @@ static struct platform_device sharpsl_nand_device = {
 	.id		= -1,
 	.resource	= sharpsl_nand_resources,
 	.num_resources	= ARRAY_SIZE(sharpsl_nand_resources),
+	.dev.platform_data	= &sharpsl_nand_platform_data,
 };
 
 static int __init sharpsl_nand_init(void)
 {
+	if (machine_is_poodle()) {
+		sharpsl_nand_partitions[1].size = 22 * 1024 * 1024;
+	} else if (machine_is_corgi() || machine_is_shepherd()) {
+		sharpsl_nand_partitions[1].size = 25 * 1024 * 1024;
+	} else if (machine_is_husky()) {
+		sharpsl_nand_partitions[1].size = 53 * 1024 * 1024;
+	} else if (machine_is_spitz()) {
+		sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
+	} else if (machine_is_akita()) {
+		sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
+		sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
+		sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
+	} else if (machine_is_borzoi()) {
+		sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
+	}
+
 	platform_device_register(&sharpsl_nand_device);
 	return platform_driver_register(&sharpsl_nand_driver);
 }
diff --git a/include/linux/mtd/sharpsl.h b/include/linux/mtd/sharpsl.h
new file mode 100644
index 0000000..25f4d2a
--- /dev/null
+++ b/include/linux/mtd/sharpsl.h
@@ -0,0 +1,20 @@
+/*
+ * SharpSL NAND support
+ *
+ * Copyright (C) 2008 Dmitry Baryshkov
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/mtd/nand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+struct sharpsl_nand_platform_data {
+	struct nand_bbt_descr	*badblock_pattern;
+	struct nand_ecclayout	*ecc_layout;
+	struct mtd_partition	*partitions;
+	unsigned int		nr_partitions;
+};
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/6] [MTD] sharpsl-nand: move registration to board code
  2008-10-16 23:15         ` [PATCH 5/6] [MTD] sharpsl-nand: use platform_data for model-specific values Dmitry Baryshkov
@ 2008-10-16 23:15           ` Dmitry Baryshkov
  0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2008-10-16 23:15 UTC (permalink / raw)
  To: linux-mtd; +Cc: Dmitry Baryshkov, Eric Miao

Finally move registration of sharpsl-nand device to board-specific code.
sharpsl nand driver is now clean and simple.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
---
 arch/arm/mach-pxa/corgi.c  |   54 +++++++++++++++++++++++++++
 arch/arm/mach-pxa/poodle.c |   51 ++++++++++++++++++++++++++
 arch/arm/mach-pxa/spitz.c  |   76 ++++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/sharpsl.c |   87 +-------------------------------------------
 4 files changed, 182 insertions(+), 86 deletions(-)

diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index e703a8d..a46b785 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -21,6 +21,7 @@
 #include <linux/mmc/host.h>
 #include <linux/pm.h>
 #include <linux/backlight.h>
+#include <linux/mtd/sharpsl.h>
 #include <video/w100fb.h>
 
 #include <asm/setup.h>
@@ -483,6 +484,55 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
 	.gpio_pullup		= CORGI_GPIO_USB_PULLUP,
 };
 
+static struct mtd_partition sharpsl_nand_partitions[] = {
+	{
+		.name = "System Area",
+		.offset = 0,
+		.size = 7 * 1024 * 1024,
+	},
+	{
+		.name = "Root Filesystem",
+		.offset = 7 * 1024 * 1024,
+		.size = 25 * 1024 * 1024,
+	},
+	{
+		.name = "Home Filesystem",
+		.offset = MTDPART_OFS_APPEND,
+		.size = MTDPART_SIZ_FULL,
+	},
+};
+
+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+
+static struct nand_bbt_descr sharpsl_bbt = {
+	.options = 0,
+	.offs = 4,
+	.len = 2,
+	.pattern = scan_ff_pattern
+};
+
+static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
+	.badblock_pattern	= &sharpsl_bbt,
+	.partitions		= sharpsl_nand_partitions,
+	.nr_partitions		= ARRAY_SIZE(sharpsl_nand_partitions),
+};
+
+static struct resource sharpsl_nand_resources[] = {
+	{
+		.start	= 0x0C000000,
+		.end	= 0x0C000FFF,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device sharpsl_nand_device = {
+	.name		= "sharpsl-nand",
+	.id		= -1,
+	.resource	= sharpsl_nand_resources,
+	.num_resources	= ARRAY_SIZE(sharpsl_nand_resources),
+	.dev.platform_data	= &sharpsl_nand_platform_data,
+};
+
 
 static struct platform_device *devices[] __initdata = {
 	&corgiscoop_device,
@@ -492,6 +542,7 @@ static struct platform_device *devices[] __initdata = {
 	&corgibl_device,
 	&corgits_device,
 	&corgiled_device,
+	&sharpsl_nand_device,
 };
 
 static void corgi_poweroff(void)
@@ -537,6 +588,9 @@ static void __init corgi_init(void)
 
 	platform_scoop_config = &corgi_pcmcia_config;
 
+	if (machine_is_husky())
+		sharpsl_nand_partitions[1].size = 53 * 1024 * 1024;
+
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 }
 
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 3f5f484..2edb8e3 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -20,6 +20,7 @@
 #include <linux/fb.h>
 #include <linux/pm.h>
 #include <linux/delay.h>
+#include <linux/mtd/sharpsl.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -320,11 +321,61 @@ static struct pxafb_mach_info poodle_fb_info = {
 	.lccr3		= 0,
 };
 
+static struct mtd_partition sharpsl_nand_partitions[] = {
+	{
+		.name = "System Area",
+		.offset = 0,
+		.size = 7 * 1024 * 1024,
+	},
+	{
+		.name = "Root Filesystem",
+		.offset = 7 * 1024 * 1024,
+		.size = 22 * 1024 * 1024,
+	},
+	{
+		.name = "Home Filesystem",
+		.offset = MTDPART_OFS_APPEND,
+		.size = MTDPART_SIZ_FULL,
+	},
+};
+
+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+
+static struct nand_bbt_descr sharpsl_bbt = {
+	.options = 0,
+	.offs = 4,
+	.len = 2,
+	.pattern = scan_ff_pattern
+};
+
+static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
+	.badblock_pattern	= &sharpsl_bbt,
+	.partitions		= sharpsl_nand_partitions,
+	.nr_partitions		= ARRAY_SIZE(sharpsl_nand_partitions),
+};
+
+static struct resource sharpsl_nand_resources[] = {
+	{
+		.start	= 0x0C000000,
+		.end	= 0x0C000FFF,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device sharpsl_nand_device = {
+	.name		= "sharpsl-nand",
+	.id		= -1,
+	.resource	= sharpsl_nand_resources,
+	.num_resources	= ARRAY_SIZE(sharpsl_nand_resources),
+	.dev.platform_data	= &sharpsl_nand_platform_data,
+};
+
 static struct platform_device *devices[] __initdata = {
 	&poodle_locomo_device,
 	&poodle_scoop_device,
 	&poodle_ssp_device,
 	&poodle_ts_device,
+	&sharpsl_nand_device,
 };
 
 static void poodle_poweroff(void)
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index b569f3b..fb6b74b 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -22,6 +22,7 @@
 #include <linux/mmc/host.h>
 #include <linux/pm.h>
 #include <linux/backlight.h>
+#include <linux/mtd/sharpsl.h>
 
 #include <asm/setup.h>
 #include <asm/memory.h>
@@ -522,6 +523,54 @@ static struct pxafb_mach_info spitz_pxafb_info = {
 	.pxafb_lcd_power = spitz_lcd_power,
 };
 
+static struct mtd_partition sharpsl_nand_partitions[] = {
+	{
+		.name = "System Area",
+		.offset = 0,
+		.size = 7 * 1024 * 1024,
+	},
+	{
+		.name = "Root Filesystem",
+		.offset = 7 * 1024 * 1024,
+	},
+	{
+		.name = "Home Filesystem",
+		.offset = MTDPART_OFS_APPEND,
+		.size = MTDPART_SIZ_FULL,
+	},
+};
+
+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+
+static struct nand_bbt_descr sharpsl_bbt = {
+	.options = 0,
+	.offs = 4,
+	.len = 2,
+	.pattern = scan_ff_pattern
+};
+
+static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
+	.badblock_pattern	= &sharpsl_bbt,
+	.partitions		= sharpsl_nand_partitions,
+	.nr_partitions		= ARRAY_SIZE(sharpsl_nand_partitions),
+};
+
+static struct resource sharpsl_nand_resources[] = {
+	{
+		.start	= 0x0C000000,
+		.end	= 0x0C000FFF,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device sharpsl_nand_device = {
+	.name		= "sharpsl-nand",
+	.id		= -1,
+	.resource	= sharpsl_nand_resources,
+	.num_resources	= ARRAY_SIZE(sharpsl_nand_resources),
+	.dev.platform_data	= &sharpsl_nand_platform_data,
+};
+
 
 static struct platform_device *devices[] __initdata = {
 	&spitzscoop_device,
@@ -552,6 +601,14 @@ static void __init common_init(void)
 	pm_power_off = spitz_poweroff;
 	arm_pm_restart = spitz_restart;
 
+	if (machine_is_spitz()) {
+		sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
+	} else if (machine_is_akita()) {
+		sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
+	} else if (machine_is_borzoi()) {
+		sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
+	}
+
 	PMCR = 0x00;
 
 	/* setup sleep mode values */
@@ -642,10 +699,29 @@ static void akita_bl_set_intensity(int intensity)
 		akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
 }
 
+static struct nand_bbt_descr sharpsl_akita_bbt = {
+	.options = 0,
+	.offs = 4,
+	.len = 1,
+	.pattern = scan_ff_pattern
+};
+
+static struct nand_ecclayout akita_oobinfo = {
+	.eccbytes = 24,
+	.eccpos = {
+		   0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
+		   0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
+		   0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
+	.oobfree = {{0x08, 0x09}}
+};
+
 static void __init akita_init(void)
 {
 	spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
 
+	sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
+	sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
+
 	/* We just pretend the second element of the array doesn't exist */
 	spitz_pcmcia_config.num_devs = 1;
 	platform_scoop_config = &spitz_pcmcia_config;
diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c
index 698378c..97b69ce 100644
--- a/drivers/mtd/nand/sharpsl.c
+++ b/drivers/mtd/nand/sharpsl.c
@@ -247,93 +247,8 @@ static struct platform_driver sharpsl_nand_driver = {
 	.remove		= __devexit_p(sharpsl_nand_remove),
 };
 
-/*
- * Define partitions for flash device
- */
-static struct mtd_partition sharpsl_nand_partitions[] = {
-	{
-	 .name = "System Area",
-	 .offset = 0,
-	 .size = 7 * 1024 * 1024,
-	 },
-	{
-	 .name = "Root Filesystem",
-	 .offset = 7 * 1024 * 1024,
-	 .size = 30 * 1024 * 1024,
-	 },
-	{
-	 .name = "Home Filesystem",
-	 .offset = MTDPART_OFS_APPEND,
-	 .size = MTDPART_SIZ_FULL,
-	 },
-};
-
-static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
-
-static struct nand_bbt_descr sharpsl_bbt = {
-	.options = 0,
-	.offs = 4,
-	.len = 2,
-	.pattern = scan_ff_pattern
-};
-
-static struct nand_bbt_descr sharpsl_akita_bbt = {
-	.options = 0,
-	.offs = 4,
-	.len = 1,
-	.pattern = scan_ff_pattern
-};
-
-static struct nand_ecclayout akita_oobinfo = {
-	.eccbytes = 24,
-	.eccpos = {
-		   0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
-		   0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
-		   0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
-	.oobfree = {{0x08, 0x09}}
-};
-
-static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
-	.badblock_pattern	= &sharpsl_bbt,
-	.partitions		= sharpsl_nand_partitions,
-	.nr_partitions		= ARRAY_SIZE(sharpsl_nand_partitions),
-};
-
-static struct resource sharpsl_nand_resources[] = {
-	{
-		.start	= 0x0C000000,
-		.end	= 0x0C000FFF,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct platform_device sharpsl_nand_device = {
-	.name		= "sharpsl-nand",
-	.id		= -1,
-	.resource	= sharpsl_nand_resources,
-	.num_resources	= ARRAY_SIZE(sharpsl_nand_resources),
-	.dev.platform_data	= &sharpsl_nand_platform_data,
-};
-
 static int __init sharpsl_nand_init(void)
 {
-	if (machine_is_poodle()) {
-		sharpsl_nand_partitions[1].size = 22 * 1024 * 1024;
-	} else if (machine_is_corgi() || machine_is_shepherd()) {
-		sharpsl_nand_partitions[1].size = 25 * 1024 * 1024;
-	} else if (machine_is_husky()) {
-		sharpsl_nand_partitions[1].size = 53 * 1024 * 1024;
-	} else if (machine_is_spitz()) {
-		sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
-	} else if (machine_is_akita()) {
-		sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
-		sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
-		sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
-	} else if (machine_is_borzoi()) {
-		sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
-	}
-
-	platform_device_register(&sharpsl_nand_device);
 	return platform_driver_register(&sharpsl_nand_driver);
 }
 module_init(sharpsl_nand_init);
@@ -341,10 +256,10 @@ module_init(sharpsl_nand_init);
 static void __exit sharpsl_nand_exit(void)
 {
 	platform_driver_unregister(&sharpsl_nand_driver);
-	platform_device_unregister(&sharpsl_nand_device);
 }
 module_exit(sharpsl_nand_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
 MODULE_DESCRIPTION("Device specific logic for NAND flash on Sharp SL-C7xx Series");
+
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [GIT PULL] sharpsl-nand driver model hookup
  2008-10-16 23:11 [GIT PULL] sharpsl-nand driver model hookup Dmitry Baryshkov
  2008-10-16 23:13 ` Dmitry Baryshkov
  2008-10-16 23:15 ` [PATCH 1/6] [MTD] sharpsl_nand: switch to driver model usage Dmitry Baryshkov
@ 2008-11-25  9:05 ` Eric Miao
  2008-12-01  2:13   ` Dmitry
  2 siblings, 1 reply; 12+ messages in thread
From: Eric Miao @ 2008-11-25  9:05 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Dmitry Baryshkov, Eric Miao, linux-mtd

Hi Dmitry,

Sorry for late reply, I had nearly ignored this patch set. All 6 patches look
good to me (I was long hoping someone can get this cleaned up). With
the remaining board patches in your branch, poodle/corgi/spitz all boot
up without problems. So all

Acked-by: Eric Miao <eric.miao@marvell.com>

David,

Could you help to merge this patch series into the mtd tree?

Thanks very much!

On Fri, Oct 17, 2008 at 7:11 AM, Dmitry Baryshkov <dbaryshkov@gmail.com> wrote:
> Hi,
>
> Please have a look at the patches making sharpsl-nand more clean driver,
> correctly hooked in the driver model.
>
> The following changes since commit 6bb7a935489dab20802dde6c2cb7d8582f4849bf:
>  Linus Torvalds (1):
>        Merge branch 'for-linus' of git://git.kernel.org/.../tiwai/sound-2.6
>
> are available in the git repository at:
>
>  git://git.kernel.org/pub/scm/linux/kernel/git/lumag/tosa-2.6.git misc/mtd/sharpsl-nand
>
> Dmitry Baryshkov (6):
>      [MTD] sharpsl_nand: switch to driver model usage.
>      [MTD] sharpsl_nand: make drvdata non-static
>      [MTD] sharpsl_nand: move io addr to struct sharpsl_nand
>      [MTD] sharpsl-nand: cleanup partitions support
>      [MTD] sharpsl-nand: use platform_data for model-specific values
>      [MTD] sharpsl-nand: move registration to board code
>
>  arch/arm/mach-pxa/corgi.c   |   54 ++++++++++
>  arch/arm/mach-pxa/poodle.c  |   51 +++++++++
>  arch/arm/mach-pxa/spitz.c   |   76 +++++++++++++
>  drivers/mtd/nand/sharpsl.c  |  248 +++++++++++++++++++++----------------------
>  include/linux/mtd/sharpsl.h |   20 ++++
>  5 files changed, 324 insertions(+), 125 deletions(-)
>  create mode 100644 include/linux/mtd/sharpsl.h
>
> --
> With best wishes
> Dmitry
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>



-- 
Cheers
- eric

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [GIT PULL] sharpsl-nand driver model hookup
  2008-11-25  9:05 ` [GIT PULL] sharpsl-nand driver model hookup Eric Miao
@ 2008-12-01  2:13   ` Dmitry
  2008-12-10 15:59     ` David Woodhouse
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry @ 2008-12-01  2:13 UTC (permalink / raw)
  To: Eric Miao; +Cc: linux-mtd, Eric Miao, David Woodhouse

Hi,

2008/11/25 Eric Miao <eric.y.miao@gmail.com>:
> Hi Dmitry,
>
> Sorry for late reply, I had nearly ignored this patch set. All 6 patches look
> good to me (I was long hoping someone can get this cleaned up). With
> the remaining board patches in your branch, poodle/corgi/spitz all boot
> up without problems. So all
>
> Acked-by: Eric Miao <eric.miao@marvell.com>
>
> David,
>
> Could you help to merge this patch series into the mtd tree?

I still don't see this serie merged. David, are there any objections
from your side,
will it be merged later, or did you just miss this patchserie? Thank you.

>
> Thanks very much!
>
> On Fri, Oct 17, 2008 at 7:11 AM, Dmitry Baryshkov <dbaryshkov@gmail.com> wrote:
>> Hi,
>>
>> Please have a look at the patches making sharpsl-nand more clean driver,
>> correctly hooked in the driver model.
>>
>> The following changes since commit 6bb7a935489dab20802dde6c2cb7d8582f4849bf:
>>  Linus Torvalds (1):
>>        Merge branch 'for-linus' of git://git.kernel.org/.../tiwai/sound-2.6
>>
>> are available in the git repository at:
>>
>>  git://git.kernel.org/pub/scm/linux/kernel/git/lumag/tosa-2.6.git misc/mtd/sharpsl-nand
>>
>> Dmitry Baryshkov (6):
>>      [MTD] sharpsl_nand: switch to driver model usage.
>>      [MTD] sharpsl_nand: make drvdata non-static
>>      [MTD] sharpsl_nand: move io addr to struct sharpsl_nand
>>      [MTD] sharpsl-nand: cleanup partitions support
>>      [MTD] sharpsl-nand: use platform_data for model-specific values
>>      [MTD] sharpsl-nand: move registration to board code
>>
>>  arch/arm/mach-pxa/corgi.c   |   54 ++++++++++
>>  arch/arm/mach-pxa/poodle.c  |   51 +++++++++
>>  arch/arm/mach-pxa/spitz.c   |   76 +++++++++++++
>>  drivers/mtd/nand/sharpsl.c  |  248 +++++++++++++++++++++----------------------
>>  include/linux/mtd/sharpsl.h |   20 ++++
>>  5 files changed, 324 insertions(+), 125 deletions(-)
>>  create mode 100644 include/linux/mtd/sharpsl.h
>>
>> --
>> With best wishes
>> Dmitry
>>
>>
>> ______________________________________________________
>> Linux MTD discussion mailing list
>> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>>
>
>
>
> --
> Cheers
> - eric
>



-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [GIT PULL] sharpsl-nand driver model hookup
  2008-12-01  2:13   ` Dmitry
@ 2008-12-10 15:59     ` David Woodhouse
  2008-12-11  1:08       ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 12+ messages in thread
From: David Woodhouse @ 2008-12-10 15:59 UTC (permalink / raw)
  To: Dmitry; +Cc: linux-mtd, Eric Miao, Eric Miao

On Mon, 2008-12-01 at 05:13 +0300, Dmitry wrote:
> 
> I still don't see this serie merged. David, are there any objections
> from your side,
> will it be merged later, or did you just miss this patchserie? Thank
> you.

It's merged now. I had some other things to go to Linus before 2.6.28,
and now I'm collecting bits for 2.6.29. Thanks.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [GIT PULL] sharpsl-nand driver model hookup
  2008-12-10 15:59     ` David Woodhouse
@ 2008-12-11  1:08       ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Eremin-Solenikov @ 2008-12-11  1:08 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd, Eric Miao, Eric Miao

2008/12/10 David Woodhouse <dwmw2@infradead.org>:
> On Mon, 2008-12-01 at 05:13 +0300, Dmitry wrote:
>>
>> I still don't see this serie merged. David, are there any objections
>> from your side,
>> will it be merged later, or did you just miss this patchserie? Thank
>> you.
>
> It's merged now. I had some other things to go to Linus before 2.6.28,
> and now I'm collecting bits for 2.6.29. Thanks.

Thank you.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-12-11  1:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-16 23:11 [GIT PULL] sharpsl-nand driver model hookup Dmitry Baryshkov
2008-10-16 23:13 ` Dmitry Baryshkov
2008-10-16 23:15 ` [PATCH 1/6] [MTD] sharpsl_nand: switch to driver model usage Dmitry Baryshkov
2008-10-16 23:15   ` [PATCH 2/6] [MTD] sharpsl_nand: make drvdata non-static Dmitry Baryshkov
2008-10-16 23:15     ` [PATCH 3/6] [MTD] sharpsl_nand: move io addr to struct sharpsl_nand Dmitry Baryshkov
2008-10-16 23:15       ` [PATCH 4/6] [MTD] sharpsl-nand: cleanup partitions support Dmitry Baryshkov
2008-10-16 23:15         ` [PATCH 5/6] [MTD] sharpsl-nand: use platform_data for model-specific values Dmitry Baryshkov
2008-10-16 23:15           ` [PATCH 6/6] [MTD] sharpsl-nand: move registration to board code Dmitry Baryshkov
2008-11-25  9:05 ` [GIT PULL] sharpsl-nand driver model hookup Eric Miao
2008-12-01  2:13   ` Dmitry
2008-12-10 15:59     ` David Woodhouse
2008-12-11  1:08       ` Dmitry Eremin-Solenikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox