linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MTD: sm_common: split smartmedia and xD table
@ 2010-04-19 15:20 Maxim Levitsky
  2010-04-28 13:35 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Levitsky @ 2010-04-19 15:20 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd, Maxim Levitsky

2GB xD card, and 4MB SmartMedia ROM card share same ID, so to make both work
split xD and smartmedia ID tables.

Hardware driver must be able to know which type it handles (and probably just one).

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
 drivers/mtd/nand/r852.c      |    2 +-
 drivers/mtd/nand/sm_common.c |   37 +++++++++++++++++++++----------------
 drivers/mtd/nand/sm_common.h |    2 +-
 3 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index 96bfbd8..6dfbb47 100644
--- a/drivers/mtd/nand/r852.c
+++ b/drivers/mtd/nand/r852.c
@@ -666,7 +666,7 @@ int r852_register_nand_device(struct r852_device *dev)
 
 	r852_engine_enable(dev);
 
-	if (sm_register_device(dev->mtd))
+	if (sm_register_device(dev->mtd, dev->sm))
 		goto error2;
 
 	if (device_create_file(&dev->mtd->dev, &dev_attr_media_type))
diff --git a/drivers/mtd/nand/sm_common.c b/drivers/mtd/nand/sm_common.c
index aae0b9a..ac80fb3 100644
--- a/drivers/mtd/nand/sm_common.c
+++ b/drivers/mtd/nand/sm_common.c
@@ -68,8 +68,6 @@ static int sm_block_markbad(struct mtd_info *mtd, loff_t ofs)
 
 
 static struct nand_flash_dev nand_smartmedia_flash_ids[] = {
-
-	/* SmartMedia */
 	{"SmartMedia 1MiB 5V",          0x6e, 256, 1, 0x1000, 0},
 	{"SmartMedia 1MiB 3,3V",        0xe8, 256, 1, 0x1000, 0},
 	{"SmartMedia 1MiB 3,3V",        0xec, 256, 1, 0x1000, 0},
@@ -82,28 +80,34 @@ static struct nand_flash_dev nand_smartmedia_flash_ids[] = {
 	{"SmartMedia 4MiB 3,3V ROM",    0xd5, 512, 4, 0x2000, NAND_ROM},
 	{"SmartMedia 8MiB 3,3V",        0xe6, 512, 8, 0x2000, 0},
 	{"SmartMedia 8MiB 3,3V ROM",    0xd6, 512, 8, 0x2000, NAND_ROM},
-
-#define XD_TYPEM       (NAND_NO_AUTOINCR | NAND_BROKEN_XD)
-	/* xD / SmartMedia */
-	{"SmartMedia/xD 16MiB 3,3V",    0x73, 512, 16, 0x4000, 0},
+	{"SmartMedia 16MiB 3,3V",       0x73, 512, 16, 0x4000, 0},
 	{"SmartMedia 16MiB 3,3V ROM",   0x57, 512, 16, 0x4000, NAND_ROM},
-	{"SmartMedia/xD 32MiB 3,3V",    0x75, 512, 32, 0x4000, 0},
+	{"SmartMedia 32MiB 3,3V",       0x75, 512, 32, 0x4000, 0},
 	{"SmartMedia 32MiB 3,3V ROM",   0x58, 512, 32, 0x4000, NAND_ROM},
-	{"SmartMedia/xD 64MiB 3,3V",    0x76, 512, 64, 0x4000, 0},
+	{"SmartMedia 64MiB 3,3V",       0x76, 512, 64, 0x4000, 0},
 	{"SmartMedia 64MiB 3,3V ROM",   0xd9, 512, 64, 0x4000, NAND_ROM},
-	{"SmartMedia/xD 128MiB 3,3V",   0x79, 512, 128, 0x4000, 0},
+	{"SmartMedia 128MiB 3,3V",      0x79, 512, 128, 0x4000, 0},
 	{"SmartMedia 128MiB 3,3V ROM",  0xda, 512, 128, 0x4000, NAND_ROM},
-	{"SmartMedia/xD 256MiB 3,3V",   0x71, 512, 256, 0x4000, XD_TYPEM},
+	{"SmartMedia 256MiB 3,3V",      0x71, 512, 256, 0x4000 },
 	{"SmartMedia 256MiB 3,3V ROM",  0x5b, 512, 256, 0x4000, NAND_ROM},
+	{NULL,}
+};
 
-	/* xD only */
-	{"xD 512MiB 3,3V",              0xDC, 512, 512, 0x4000, XD_TYPEM},
-	{"xD 1GiB 3,3V",                0xD3, 512, 1024, 0x4000, XD_TYPEM},
-	{"xD 2GiB 3,3V",                0xD5, 512, 2048, 0x4000, XD_TYPEM},
+#define XD_TYPEM       (NAND_NO_AUTOINCR | NAND_BROKEN_XD)
+static struct nand_flash_dev nand_xd_flash_ids[] = {
+
+	{"xD 16MiB 3,3V",    0x73, 512, 16, 0x4000, 0},
+	{"xD 32MiB 3,3V",    0x75, 512, 32, 0x4000, 0},
+	{"xD 64MiB 3,3V",    0x76, 512, 64, 0x4000, 0},
+	{"xD 128MiB 3,3V",   0x79, 512, 128, 0x4000, 0},
+	{"xD 256MiB 3,3V",   0x71, 512, 256, 0x4000, XD_TYPEM},
+	{"xD 512MiB 3,3V",   0xdc, 512, 512, 0x4000, XD_TYPEM},
+	{"xD 1GiB 3,3V",     0xd3, 512, 1024, 0x4000, XD_TYPEM},
+	{"xD 2GiB 3,3V",     0xd5, 512, 2048, 0x4000, XD_TYPEM},
 	{NULL,}
 };
 
-int sm_register_device(struct mtd_info *mtd)
+int sm_register_device(struct mtd_info *mtd, int smartmedia)
 {
 	struct nand_chip *chip = (struct nand_chip *)mtd->priv;
 	int ret;
@@ -111,7 +115,8 @@ int sm_register_device(struct mtd_info *mtd)
 	chip->options |= NAND_SKIP_BBTSCAN;
 
 	/* Scan for card properties */
-	ret = nand_scan_ident(mtd, 1, nand_smartmedia_flash_ids);
+	ret = nand_scan_ident(mtd, 1, smartmedia ?
+		nand_smartmedia_flash_ids : nand_xd_flash_ids);
 
 	if (ret)
 		return ret;
diff --git a/drivers/mtd/nand/sm_common.h b/drivers/mtd/nand/sm_common.h
index 18284f5..00f4a83 100644
--- a/drivers/mtd/nand/sm_common.h
+++ b/drivers/mtd/nand/sm_common.h
@@ -36,7 +36,7 @@ struct sm_oob {
 #define SM_SMALL_OOB_SIZE	8
 
 
-extern int sm_register_device(struct mtd_info *mtd);
+extern int sm_register_device(struct mtd_info *mtd, int smartmedia);
 
 
 static inline int sm_sector_valid(struct sm_oob *oob)
-- 
1.7.0.4

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

* Re: [PATCH] MTD: sm_common: split smartmedia and xD table
  2010-04-19 15:20 [PATCH] MTD: sm_common: split smartmedia and xD table Maxim Levitsky
@ 2010-04-28 13:35 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-04-28 13:35 UTC (permalink / raw)
  To: Maxim Levitsky; +Cc: linux-mtd, David Woodhouse

On Mon, 2010-04-19 at 18:20 +0300, Maxim Levitsky wrote:
> 2GB xD card, and 4MB SmartMedia ROM card share same ID, so to make both work
> split xD and smartmedia ID tables.
> 
> Hardware driver must be able to know which type it handles (and probably just one).
> 
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>

Taken to l2-mtd-2.6.git / dunno

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

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

end of thread, other threads:[~2010-04-28 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-19 15:20 [PATCH] MTD: sm_common: split smartmedia and xD table Maxim Levitsky
2010-04-28 13:35 ` Artem Bityutskiy

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