diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jffs2/fs.c | 16 | ||||
-rw-r--r-- | fs/jffs2/os-linux.h | 13 | ||||
-rw-r--r-- | fs/jffs2/wbuf.c | 22 |
3 files changed, 46 insertions, 5 deletions
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index cc18b92234c4..79b4bdc76f7a 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: fs.c,v 1.61 2005/07/24 15:29:56 dedekind Exp $ | 10 | * $Id: fs.c,v 1.62 2005/08/06 04:51:30 nico Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -664,7 +664,14 @@ static int jffs2_flash_setup(struct jffs2_sb_info *c) { | |||
664 | if (ret) | 664 | if (ret) |
665 | return ret; | 665 | return ret; |
666 | } | 666 | } |
667 | 667 | ||
668 | /* and Intel "Sibley" flash */ | ||
669 | if (jffs2_nor_wbuf_flash(c)) { | ||
670 | ret = jffs2_nor_wbuf_flash_setup(c); | ||
671 | if (ret) | ||
672 | return ret; | ||
673 | } | ||
674 | |||
668 | return ret; | 675 | return ret; |
669 | } | 676 | } |
670 | 677 | ||
@@ -683,4 +690,9 @@ void jffs2_flash_cleanup(struct jffs2_sb_info *c) { | |||
683 | if (jffs2_dataflash(c)) { | 690 | if (jffs2_dataflash(c)) { |
684 | jffs2_dataflash_cleanup(c); | 691 | jffs2_dataflash_cleanup(c); |
685 | } | 692 | } |
693 | |||
694 | /* and Intel "Sibley" flash */ | ||
695 | if (jffs2_nor_wbuf_flash(c)) { | ||
696 | jffs2_nor_wbuf_flash_cleanup(c); | ||
697 | } | ||
686 | } | 698 | } |
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index 0fc952eaf8c8..c3c1619fb137 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: os-linux.h,v 1.59 2005/07/17 11:13:46 dedekind Exp $ | 10 | * $Id: os-linux.h,v 1.60 2005/08/06 04:51:30 nico Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -85,16 +85,21 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f) | |||
85 | #define jffs2_wbuf_process NULL | 85 | #define jffs2_wbuf_process NULL |
86 | #define jffs2_nor_ecc(c) (0) | 86 | #define jffs2_nor_ecc(c) (0) |
87 | #define jffs2_dataflash(c) (0) | 87 | #define jffs2_dataflash(c) (0) |
88 | #define jffs2_nor_wbuf_flash(c) (0) | ||
88 | #define jffs2_nor_ecc_flash_setup(c) (0) | 89 | #define jffs2_nor_ecc_flash_setup(c) (0) |
89 | #define jffs2_nor_ecc_flash_cleanup(c) do {} while (0) | 90 | #define jffs2_nor_ecc_flash_cleanup(c) do {} while (0) |
90 | #define jffs2_dataflash_setup(c) (0) | 91 | #define jffs2_dataflash_setup(c) (0) |
91 | #define jffs2_dataflash_cleanup(c) do {} while (0) | 92 | #define jffs2_dataflash_cleanup(c) do {} while (0) |
93 | #define jffs2_nor_wbuf_flash_setup(c) (0) | ||
94 | #define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0) | ||
92 | 95 | ||
93 | #else /* NAND and/or ECC'd NOR support present */ | 96 | #else /* NAND and/or ECC'd NOR support present */ |
94 | 97 | ||
95 | #define jffs2_is_writebuffered(c) (c->wbuf != NULL) | 98 | #define jffs2_is_writebuffered(c) (c->wbuf != NULL) |
96 | #define SECTOR_ADDR(x) ( ((unsigned long)(x) / (unsigned long)(c->sector_size)) * c->sector_size ) | 99 | #define SECTOR_ADDR(x) ( ((unsigned long)(x) / (unsigned long)(c->sector_size)) * c->sector_size ) |
97 | #define jffs2_can_mark_obsolete(c) ((c->mtd->type == MTD_NORFLASH && !(c->mtd->flags & MTD_ECC)) || c->mtd->type == MTD_RAM) | 100 | #define jffs2_can_mark_obsolete(c) \ |
101 | ((c->mtd->type == MTD_NORFLASH && !(c->mtd->flags & (MTD_ECC|MTD_PROGRAM_REGIONS))) || \ | ||
102 | c->mtd->type == MTD_RAM) | ||
98 | #define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH) | 103 | #define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH) |
99 | 104 | ||
100 | #define jffs2_flash_write_oob(c, ofs, len, retlen, buf) ((c)->mtd->write_oob((c)->mtd, ofs, len, retlen, buf)) | 105 | #define jffs2_flash_write_oob(c, ofs, len, retlen, buf) ((c)->mtd->write_oob((c)->mtd, ofs, len, retlen, buf)) |
@@ -124,6 +129,10 @@ void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c); | |||
124 | int jffs2_dataflash_setup(struct jffs2_sb_info *c); | 129 | int jffs2_dataflash_setup(struct jffs2_sb_info *c); |
125 | void jffs2_dataflash_cleanup(struct jffs2_sb_info *c); | 130 | void jffs2_dataflash_cleanup(struct jffs2_sb_info *c); |
126 | 131 | ||
132 | #define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && (c->mtd->flags & MTD_PROGRAM_REGIONS)) | ||
133 | int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c); | ||
134 | void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c); | ||
135 | |||
127 | #endif /* WRITEBUFFER */ | 136 | #endif /* WRITEBUFFER */ |
128 | 137 | ||
129 | /* erase.c */ | 138 | /* erase.c */ |
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index 251ac3d86f99..8c06d3a2b17d 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * | 9 | * |
10 | * For licensing information, see the file 'LICENCE' in this directory. | 10 | * For licensing information, see the file 'LICENCE' in this directory. |
11 | * | 11 | * |
12 | * $Id: wbuf.c,v 1.96 2005/07/22 10:32:08 dedekind Exp $ | 12 | * $Id: wbuf.c,v 1.97 2005/08/06 04:51:30 nico Exp $ |
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
@@ -1235,3 +1235,23 @@ int jffs2_nor_ecc_flash_setup(struct jffs2_sb_info *c) { | |||
1235 | void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c) { | 1235 | void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c) { |
1236 | kfree(c->wbuf); | 1236 | kfree(c->wbuf); |
1237 | } | 1237 | } |
1238 | |||
1239 | int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c) { | ||
1240 | /* Cleanmarker currently occupies a whole programming region */ | ||
1241 | c->cleanmarker_size = MTD_PROGREGION_SIZE(c->mtd); | ||
1242 | |||
1243 | /* Initialize write buffer */ | ||
1244 | init_rwsem(&c->wbuf_sem); | ||
1245 | c->wbuf_pagesize = MTD_PROGREGION_SIZE(c->mtd); | ||
1246 | c->wbuf_ofs = 0xFFFFFFFF; | ||
1247 | |||
1248 | c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL); | ||
1249 | if (!c->wbuf) | ||
1250 | return -ENOMEM; | ||
1251 | |||
1252 | return 0; | ||
1253 | } | ||
1254 | |||
1255 | void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) { | ||
1256 | kfree(c->wbuf); | ||
1257 | } | ||