Commit 5fa43394 authored by Joern Engel's avatar Joern Engel

[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: default avatarJoern Engel <joern@wh.fh-wedel.de>
parent c8b229de
...@@ -548,7 +548,7 @@ static int cfi_intelext_partition_fixup(struct mtd_info *mtd, ...@@ -548,7 +548,7 @@ static int cfi_intelext_partition_fixup(struct mtd_info *mtd,
mtd->writesize = cfi->interleave << prinfo->ProgRegShift; mtd->writesize = cfi->interleave << prinfo->ProgRegShift;
MTD_PROGREGION_CTRLMODE_VALID(mtd) = cfi->interleave * prinfo->ControlValid; MTD_PROGREGION_CTRLMODE_VALID(mtd) = cfi->interleave * prinfo->ControlValid;
MTD_PROGREGION_CTRLMODE_INVALID(mtd) = cfi->interleave * prinfo->ControlInvalid; MTD_PROGREGION_CTRLMODE_INVALID(mtd) = cfi->interleave * prinfo->ControlInvalid;
mtd->flags |= MTD_PROGRAM_REGIONS; mtd->flags &= ~MTD_BIT_WRITEABLE;
printk(KERN_DEBUG "%s: program region size/ctrl_valid/ctrl_inval = %d/%d/%d\n", printk(KERN_DEBUG "%s: program region size/ctrl_valid/ctrl_inval = %d/%d/%d\n",
map->name, mtd->writesize, map->name, mtd->writesize,
MTD_PROGREGION_CTRLMODE_VALID(mtd), MTD_PROGREGION_CTRLMODE_VALID(mtd),
......
...@@ -238,8 +238,7 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map) ...@@ -238,8 +238,7 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
mtd->unlock = cfi_staa_unlock; mtd->unlock = cfi_staa_unlock;
mtd->suspend = cfi_staa_suspend; mtd->suspend = cfi_staa_suspend;
mtd->resume = cfi_staa_resume; mtd->resume = cfi_staa_resume;
mtd->flags = MTD_CAP_NORFLASH; mtd->flags = MTD_CAP_NORFLASH & ~MTD_BIT_WRITEABLE;
mtd->flags |= MTD_PROGRAM_REGIONS; /* FIXME: Not all STMicro flashes have this */
mtd->writesize = 8; /* FIXME: Should be 0 for STMicro flashes w/out ECC */ mtd->writesize = 8; /* FIXME: Should be 0 for STMicro flashes w/out ECC */
map->fldrv = &cfi_staa_chipdrv; map->fldrv = &cfi_staa_chipdrv;
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
......
...@@ -2668,7 +2668,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips) ...@@ -2668,7 +2668,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
/* Fill in remaining MTD driver data */ /* Fill in remaining MTD driver data */
mtd->type = MTD_NANDFLASH; mtd->type = MTD_NANDFLASH;
mtd->flags = MTD_CAP_NANDFLASH | MTD_ECC; mtd->flags = MTD_CAP_NANDFLASH;
mtd->ecctype = MTD_ECC_SW; mtd->ecctype = MTD_ECC_SW;
mtd->erase = nand_erase; mtd->erase = nand_erase;
mtd->point = NULL; mtd->point = NULL;
......
...@@ -1943,7 +1943,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) ...@@ -1943,7 +1943,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
/* Fill in remaining MTD driver data */ /* Fill in remaining MTD driver data */
mtd->type = MTD_NANDFLASH; mtd->type = MTD_NANDFLASH;
mtd->flags = MTD_CAP_NANDFLASH | MTD_ECC; mtd->flags = MTD_CAP_NANDFLASH;
mtd->ecctype = MTD_ECC_SW; mtd->ecctype = MTD_ECC_SW;
mtd->erase = onenand_erase; mtd->erase = onenand_erase;
mtd->point = NULL; mtd->point = NULL;
......
...@@ -105,9 +105,7 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f) ...@@ -105,9 +105,7 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
#ifdef CONFIG_JFFS2_SUMMARY #ifdef CONFIG_JFFS2_SUMMARY
#define jffs2_can_mark_obsolete(c) (0) #define jffs2_can_mark_obsolete(c) (0)
#else #else
#define jffs2_can_mark_obsolete(c) \ #define jffs2_can_mark_obsolete(c) (c->mtd->flags & (MTD_BIT_WRITEABLE))
((c->mtd->type == MTD_NORFLASH && !(c->mtd->flags & (MTD_PROGRAM_REGIONS))) || \
c->mtd->type == MTD_RAM)
#endif #endif
#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH) #define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH)
...@@ -135,7 +133,7 @@ void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c); ...@@ -135,7 +133,7 @@ void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c);
int jffs2_dataflash_setup(struct jffs2_sb_info *c); int jffs2_dataflash_setup(struct jffs2_sb_info *c);
void jffs2_dataflash_cleanup(struct jffs2_sb_info *c); void jffs2_dataflash_cleanup(struct jffs2_sb_info *c);
#define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && (c->mtd->flags & MTD_PROGRAM_REGIONS)) #define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE))
int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c); int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c);
void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c); void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c);
......
...@@ -30,14 +30,13 @@ struct mtd_oob_buf { ...@@ -30,14 +30,13 @@ struct mtd_oob_buf {
#define MTD_NANDFLASH 4 #define MTD_NANDFLASH 4
#define MTD_DATAFLASH 6 #define MTD_DATAFLASH 6
#define MTD_ECC 128 // Device capable of automatic ECC
#define MTD_PROGRAM_REGIONS 512 // Configurable Programming Regions
#define MTD_WRITEABLE 0x400 /* Device is writeable */ #define MTD_WRITEABLE 0x400 /* Device is writeable */
#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
// Some common devices / combinations of capabilities // Some common devices / combinations of capabilities
#define MTD_CAP_ROM 0 #define MTD_CAP_ROM 0
#define MTD_CAP_RAM (MTD_WRITEABLE) #define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
#define MTD_CAP_NORFLASH (MTD_WRITEABLE) #define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
#define MTD_CAP_NANDFLASH (MTD_WRITEABLE) #define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment