aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2005-08-06 00:51:33 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 14:13:52 -0500
commit59da721a2288b8aec751a2716f7ab60f2ea0c925 (patch)
tree902a0a61cd3ed7e2dab27f20b4fd541566f598a1 /fs/jffs2
parente102d54abf6806b95c89142cd0b7e94d709ebcd7 (diff)
[JFFS2] Teach JFFS2 about Sibley flash
Intels Sibley flash needs JFFS2 write buffer functionality Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/fs.c16
-rw-r--r--fs/jffs2/os-linux.h13
-rw-r--r--fs/jffs2/wbuf.c22
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);
124int jffs2_dataflash_setup(struct jffs2_sb_info *c); 129int jffs2_dataflash_setup(struct jffs2_sb_info *c);
125void jffs2_dataflash_cleanup(struct jffs2_sb_info *c); 130void 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))
133int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c);
134void 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) {
1235void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c) { 1235void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c) {
1236 kfree(c->wbuf); 1236 kfree(c->wbuf);
1237} 1237}
1238
1239int 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
1255void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) {
1256 kfree(c->wbuf);
1257}