aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoern Engel <joern@wh.fh-wedel.de>2006-05-22 17:18:29 -0400
committerJoern Engel <joern@wh.fh-wedel.de>2006-05-22 17:18:29 -0400
commit5fa433942ba4e399f7e28764c9db4ade89e91d40 (patch)
tree29a2691729645bf27fd2d7d8d61a5c720c6569c1
parentc8b229de2b05c2b3e8d282ce260935a88ac030ca (diff)
[MTD] Introduce MTD_BIT_WRITEABLE
o Add a flag MTD_BIT_WRITEABLE for devices that allow single bits to be cleared. o Replace MTD_PROGRAM_REGIONS with a cleared MTD_BIT_WRITEABLE flag for STMicro and Intel Sibley flashes with internal ECC. Those flashes disallow clearing of single bits, unlike regular NOR flashes, so the new flag models their behaviour better. o Remove MTD_ECC. After the STMicro/Sibley merge, this flag is only set and never checked. Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c2
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c3
-rw-r--r--drivers/mtd/nand/nand_base.c2
-rw-r--r--drivers/mtd/onenand/onenand_base.c2
-rw-r--r--fs/jffs2/os-linux.h6
-rw-r--r--include/mtd/mtd-abi.h7
6 files changed, 9 insertions, 13 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 35c3689bc5c1..0d435814aaa1 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -548,7 +548,7 @@ static int cfi_intelext_partition_fixup(struct mtd_info *mtd,
548 mtd->writesize = cfi->interleave << prinfo->ProgRegShift; 548 mtd->writesize = cfi->interleave << prinfo->ProgRegShift;
549 MTD_PROGREGION_CTRLMODE_VALID(mtd) = cfi->interleave * prinfo->ControlValid; 549 MTD_PROGREGION_CTRLMODE_VALID(mtd) = cfi->interleave * prinfo->ControlValid;
550 MTD_PROGREGION_CTRLMODE_INVALID(mtd) = cfi->interleave * prinfo->ControlInvalid; 550 MTD_PROGREGION_CTRLMODE_INVALID(mtd) = cfi->interleave * prinfo->ControlInvalid;
551 mtd->flags |= MTD_PROGRAM_REGIONS; 551 mtd->flags &= ~MTD_BIT_WRITEABLE;
552 printk(KERN_DEBUG "%s: program region size/ctrl_valid/ctrl_inval = %d/%d/%d\n", 552 printk(KERN_DEBUG "%s: program region size/ctrl_valid/ctrl_inval = %d/%d/%d\n",
553 map->name, mtd->writesize, 553 map->name, mtd->writesize,
554 MTD_PROGREGION_CTRLMODE_VALID(mtd), 554 MTD_PROGREGION_CTRLMODE_VALID(mtd),
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index d745285fccf8..fae70a5db540 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -238,8 +238,7 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
238 mtd->unlock = cfi_staa_unlock; 238 mtd->unlock = cfi_staa_unlock;
239 mtd->suspend = cfi_staa_suspend; 239 mtd->suspend = cfi_staa_suspend;
240 mtd->resume = cfi_staa_resume; 240 mtd->resume = cfi_staa_resume;
241 mtd->flags = MTD_CAP_NORFLASH; 241 mtd->flags = MTD_CAP_NORFLASH & ~MTD_BIT_WRITEABLE;
242 mtd->flags |= MTD_PROGRAM_REGIONS; /* FIXME: Not all STMicro flashes have this */
243 mtd->writesize = 8; /* FIXME: Should be 0 for STMicro flashes w/out ECC */ 242 mtd->writesize = 8; /* FIXME: Should be 0 for STMicro flashes w/out ECC */
244 map->fldrv = &cfi_staa_chipdrv; 243 map->fldrv = &cfi_staa_chipdrv;
245 __module_get(THIS_MODULE); 244 __module_get(THIS_MODULE);
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 055f6608a2ec..cd90a46bf56a 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2668,7 +2668,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2668 2668
2669 /* Fill in remaining MTD driver data */ 2669 /* Fill in remaining MTD driver data */
2670 mtd->type = MTD_NANDFLASH; 2670 mtd->type = MTD_NANDFLASH;
2671 mtd->flags = MTD_CAP_NANDFLASH | MTD_ECC; 2671 mtd->flags = MTD_CAP_NANDFLASH;
2672 mtd->ecctype = MTD_ECC_SW; 2672 mtd->ecctype = MTD_ECC_SW;
2673 mtd->erase = nand_erase; 2673 mtd->erase = nand_erase;
2674 mtd->point = NULL; 2674 mtd->point = NULL;
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 198bb8562d93..4c2c61d54b3a 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1943,7 +1943,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
1943 1943
1944 /* Fill in remaining MTD driver data */ 1944 /* Fill in remaining MTD driver data */
1945 mtd->type = MTD_NANDFLASH; 1945 mtd->type = MTD_NANDFLASH;
1946 mtd->flags = MTD_CAP_NANDFLASH | MTD_ECC; 1946 mtd->flags = MTD_CAP_NANDFLASH;
1947 mtd->ecctype = MTD_ECC_SW; 1947 mtd->ecctype = MTD_ECC_SW;
1948 mtd->erase = onenand_erase; 1948 mtd->erase = onenand_erase;
1949 mtd->point = NULL; 1949 mtd->point = NULL;
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 1a6eb955e0be..743c9e52152d 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -105,9 +105,7 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
105#ifdef CONFIG_JFFS2_SUMMARY 105#ifdef CONFIG_JFFS2_SUMMARY
106#define jffs2_can_mark_obsolete(c) (0) 106#define jffs2_can_mark_obsolete(c) (0)
107#else 107#else
108#define jffs2_can_mark_obsolete(c) \ 108#define jffs2_can_mark_obsolete(c) (c->mtd->flags & (MTD_BIT_WRITEABLE))
109 ((c->mtd->type == MTD_NORFLASH && !(c->mtd->flags & (MTD_PROGRAM_REGIONS))) || \
110 c->mtd->type == MTD_RAM)
111#endif 109#endif
112 110
113#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH) 111#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH)
@@ -135,7 +133,7 @@ void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c);
135int jffs2_dataflash_setup(struct jffs2_sb_info *c); 133int jffs2_dataflash_setup(struct jffs2_sb_info *c);
136void jffs2_dataflash_cleanup(struct jffs2_sb_info *c); 134void jffs2_dataflash_cleanup(struct jffs2_sb_info *c);
137 135
138#define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && (c->mtd->flags & MTD_PROGRAM_REGIONS)) 136#define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE))
139int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c); 137int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c);
140void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c); 138void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c);
141 139
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 520a3b483100..1e09e4c8f485 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -30,14 +30,13 @@ struct mtd_oob_buf {
30#define MTD_NANDFLASH 4 30#define MTD_NANDFLASH 4
31#define MTD_DATAFLASH 6 31#define MTD_DATAFLASH 6
32 32
33#define MTD_ECC 128 // Device capable of automatic ECC
34#define MTD_PROGRAM_REGIONS 512 // Configurable Programming Regions
35#define MTD_WRITEABLE 0x400 /* Device is writeable */ 33#define MTD_WRITEABLE 0x400 /* Device is writeable */
34#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
36 35
37// Some common devices / combinations of capabilities 36// Some common devices / combinations of capabilities
38#define MTD_CAP_ROM 0 37#define MTD_CAP_ROM 0
39#define MTD_CAP_RAM (MTD_WRITEABLE) 38#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
40#define MTD_CAP_NORFLASH (MTD_WRITEABLE) 39#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
41#define MTD_CAP_NANDFLASH (MTD_WRITEABLE) 40#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
42 41
43 42