aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2010-04-19 11:20:41 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-05-13 20:03:46 -0400
commitc3611570ddf601609f8803574ea83889ff969aa0 (patch)
tree43e0aa84df91365b2bc5c484da1342d83bda9137 /drivers/mtd
parenta47bfd2eb66837653dc3b42541dfe4283dd41251 (diff)
mtd: sm_common: split smartmedia and xD table
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> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/r852.c2
-rw-r--r--drivers/mtd/nand/sm_common.c37
-rw-r--r--drivers/mtd/nand/sm_common.h2
3 files changed, 23 insertions, 18 deletions
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index 96bfbd8e8fdb..6dfbb4713162 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)
666 666
667 r852_engine_enable(dev); 667 r852_engine_enable(dev);
668 668
669 if (sm_register_device(dev->mtd)) 669 if (sm_register_device(dev->mtd, dev->sm))
670 goto error2; 670 goto error2;
671 671
672 if (device_create_file(&dev->mtd->dev, &dev_attr_media_type)) 672 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 aae0b9acd7ae..ac80fb362e63 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)
68 68
69 69
70static struct nand_flash_dev nand_smartmedia_flash_ids[] = { 70static struct nand_flash_dev nand_smartmedia_flash_ids[] = {
71
72 /* SmartMedia */
73 {"SmartMedia 1MiB 5V", 0x6e, 256, 1, 0x1000, 0}, 71 {"SmartMedia 1MiB 5V", 0x6e, 256, 1, 0x1000, 0},
74 {"SmartMedia 1MiB 3,3V", 0xe8, 256, 1, 0x1000, 0}, 72 {"SmartMedia 1MiB 3,3V", 0xe8, 256, 1, 0x1000, 0},
75 {"SmartMedia 1MiB 3,3V", 0xec, 256, 1, 0x1000, 0}, 73 {"SmartMedia 1MiB 3,3V", 0xec, 256, 1, 0x1000, 0},
@@ -82,28 +80,34 @@ static struct nand_flash_dev nand_smartmedia_flash_ids[] = {
82 {"SmartMedia 4MiB 3,3V ROM", 0xd5, 512, 4, 0x2000, NAND_ROM}, 80 {"SmartMedia 4MiB 3,3V ROM", 0xd5, 512, 4, 0x2000, NAND_ROM},
83 {"SmartMedia 8MiB 3,3V", 0xe6, 512, 8, 0x2000, 0}, 81 {"SmartMedia 8MiB 3,3V", 0xe6, 512, 8, 0x2000, 0},
84 {"SmartMedia 8MiB 3,3V ROM", 0xd6, 512, 8, 0x2000, NAND_ROM}, 82 {"SmartMedia 8MiB 3,3V ROM", 0xd6, 512, 8, 0x2000, NAND_ROM},
85 83 {"SmartMedia 16MiB 3,3V", 0x73, 512, 16, 0x4000, 0},
86#define XD_TYPEM (NAND_NO_AUTOINCR | NAND_BROKEN_XD)
87 /* xD / SmartMedia */
88 {"SmartMedia/xD 16MiB 3,3V", 0x73, 512, 16, 0x4000, 0},
89 {"SmartMedia 16MiB 3,3V ROM", 0x57, 512, 16, 0x4000, NAND_ROM}, 84 {"SmartMedia 16MiB 3,3V ROM", 0x57, 512, 16, 0x4000, NAND_ROM},
90 {"SmartMedia/xD 32MiB 3,3V", 0x75, 512, 32, 0x4000, 0}, 85 {"SmartMedia 32MiB 3,3V", 0x75, 512, 32, 0x4000, 0},
91 {"SmartMedia 32MiB 3,3V ROM", 0x58, 512, 32, 0x4000, NAND_ROM}, 86 {"SmartMedia 32MiB 3,3V ROM", 0x58, 512, 32, 0x4000, NAND_ROM},
92 {"SmartMedia/xD 64MiB 3,3V", 0x76, 512, 64, 0x4000, 0}, 87 {"SmartMedia 64MiB 3,3V", 0x76, 512, 64, 0x4000, 0},
93 {"SmartMedia 64MiB 3,3V ROM", 0xd9, 512, 64, 0x4000, NAND_ROM}, 88 {"SmartMedia 64MiB 3,3V ROM", 0xd9, 512, 64, 0x4000, NAND_ROM},
94 {"SmartMedia/xD 128MiB 3,3V", 0x79, 512, 128, 0x4000, 0}, 89 {"SmartMedia 128MiB 3,3V", 0x79, 512, 128, 0x4000, 0},
95 {"SmartMedia 128MiB 3,3V ROM", 0xda, 512, 128, 0x4000, NAND_ROM}, 90 {"SmartMedia 128MiB 3,3V ROM", 0xda, 512, 128, 0x4000, NAND_ROM},
96 {"SmartMedia/xD 256MiB 3,3V", 0x71, 512, 256, 0x4000, XD_TYPEM}, 91 {"SmartMedia 256MiB 3,3V", 0x71, 512, 256, 0x4000 },
97 {"SmartMedia 256MiB 3,3V ROM", 0x5b, 512, 256, 0x4000, NAND_ROM}, 92 {"SmartMedia 256MiB 3,3V ROM", 0x5b, 512, 256, 0x4000, NAND_ROM},
93 {NULL,}
94};
98 95
99 /* xD only */ 96#define XD_TYPEM (NAND_NO_AUTOINCR | NAND_BROKEN_XD)
100 {"xD 512MiB 3,3V", 0xDC, 512, 512, 0x4000, XD_TYPEM}, 97static struct nand_flash_dev nand_xd_flash_ids[] = {
101 {"xD 1GiB 3,3V", 0xD3, 512, 1024, 0x4000, XD_TYPEM}, 98
102 {"xD 2GiB 3,3V", 0xD5, 512, 2048, 0x4000, XD_TYPEM}, 99 {"xD 16MiB 3,3V", 0x73, 512, 16, 0x4000, 0},
100 {"xD 32MiB 3,3V", 0x75, 512, 32, 0x4000, 0},
101 {"xD 64MiB 3,3V", 0x76, 512, 64, 0x4000, 0},
102 {"xD 128MiB 3,3V", 0x79, 512, 128, 0x4000, 0},
103 {"xD 256MiB 3,3V", 0x71, 512, 256, 0x4000, XD_TYPEM},
104 {"xD 512MiB 3,3V", 0xdc, 512, 512, 0x4000, XD_TYPEM},
105 {"xD 1GiB 3,3V", 0xd3, 512, 1024, 0x4000, XD_TYPEM},
106 {"xD 2GiB 3,3V", 0xd5, 512, 2048, 0x4000, XD_TYPEM},
103 {NULL,} 107 {NULL,}
104}; 108};
105 109
106int sm_register_device(struct mtd_info *mtd) 110int sm_register_device(struct mtd_info *mtd, int smartmedia)
107{ 111{
108 struct nand_chip *chip = (struct nand_chip *)mtd->priv; 112 struct nand_chip *chip = (struct nand_chip *)mtd->priv;
109 int ret; 113 int ret;
@@ -111,7 +115,8 @@ int sm_register_device(struct mtd_info *mtd)
111 chip->options |= NAND_SKIP_BBTSCAN; 115 chip->options |= NAND_SKIP_BBTSCAN;
112 116
113 /* Scan for card properties */ 117 /* Scan for card properties */
114 ret = nand_scan_ident(mtd, 1, nand_smartmedia_flash_ids); 118 ret = nand_scan_ident(mtd, 1, smartmedia ?
119 nand_smartmedia_flash_ids : nand_xd_flash_ids);
115 120
116 if (ret) 121 if (ret)
117 return ret; 122 return ret;
diff --git a/drivers/mtd/nand/sm_common.h b/drivers/mtd/nand/sm_common.h
index 18284f5fae64..00f4a83359b2 100644
--- a/drivers/mtd/nand/sm_common.h
+++ b/drivers/mtd/nand/sm_common.h
@@ -36,7 +36,7 @@ struct sm_oob {
36#define SM_SMALL_OOB_SIZE 8 36#define SM_SMALL_OOB_SIZE 8
37 37
38 38
39extern int sm_register_device(struct mtd_info *mtd); 39extern int sm_register_device(struct mtd_info *mtd, int smartmedia);
40 40
41 41
42static inline int sm_sector_valid(struct sm_oob *oob) 42static inline int sm_sector_valid(struct sm_oob *oob)