mtd/fs/jffs2 fs.c,1.61,1.62 os-linux.h,1.59,1.60 wbuf.c,1.96,1.97
Nicolas Pitre
nico at infradead.org
Sat Aug 6 00:51:33 EDT 2005
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv14995/fs/jffs2
Modified Files:
fs.c os-linux.h wbuf.c
Log Message:
[JFFS2] teach JFFS2 about Sibley flash
Signed-off-by: Nicolas Pitre <nico at cam.org>
Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- fs.c 24 Jul 2005 15:29:56 -0000 1.61
+++ fs.c 6 Aug 2005 04:51:30 -0000 1.62
@@ -664,7 +664,14 @@
if (ret)
return ret;
}
-
+
+ /* and Intel "Sibley" flash */
+ if (jffs2_nor_wbuf_flash(c)) {
+ ret = jffs2_nor_wbuf_flash_setup(c);
+ if (ret)
+ return ret;
+ }
+
return ret;
}
@@ -683,4 +690,9 @@
if (jffs2_dataflash(c)) {
jffs2_dataflash_cleanup(c);
}
+
+ /* and Intel "Sibley" flash */
+ if (jffs2_nor_wbuf_flash(c)) {
+ jffs2_nor_wbuf_flash_cleanup(c);
+ }
}
Index: os-linux.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/os-linux.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- os-linux.h 17 Jul 2005 11:13:46 -0000 1.59
+++ os-linux.h 6 Aug 2005 04:51:30 -0000 1.60
@@ -85,16 +85,21 @@
#define jffs2_wbuf_process NULL
#define jffs2_nor_ecc(c) (0)
#define jffs2_dataflash(c) (0)
+#define jffs2_nor_wbuf_flash(c) (0)
#define jffs2_nor_ecc_flash_setup(c) (0)
#define jffs2_nor_ecc_flash_cleanup(c) do {} while (0)
#define jffs2_dataflash_setup(c) (0)
#define jffs2_dataflash_cleanup(c) do {} while (0)
+#define jffs2_nor_wbuf_flash_setup(c) (0)
+#define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0)
#else /* NAND and/or ECC'd NOR support present */
#define jffs2_is_writebuffered(c) (c->wbuf != NULL)
#define SECTOR_ADDR(x) ( ((unsigned long)(x) / (unsigned long)(c->sector_size)) * c->sector_size )
-#define jffs2_can_mark_obsolete(c) ((c->mtd->type == MTD_NORFLASH && !(c->mtd->flags & MTD_ECC)) || c->mtd->type == MTD_RAM)
+#define jffs2_can_mark_obsolete(c) \
+ ((c->mtd->type == MTD_NORFLASH && !(c->mtd->flags & (MTD_ECC|MTD_PROGRAM_REGIONS))) || \
+ c->mtd->type == MTD_RAM)
#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH)
#define jffs2_flash_write_oob(c, ofs, len, retlen, buf) ((c)->mtd->write_oob((c)->mtd, ofs, len, retlen, buf))
@@ -124,6 +129,10 @@
int jffs2_dataflash_setup(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))
+int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c);
+void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c);
+
#endif /* WRITEBUFFER */
/* erase.c */
Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- wbuf.c 22 Jul 2005 10:32:08 -0000 1.96
+++ wbuf.c 6 Aug 2005 04:51:30 -0000 1.97
@@ -1233,3 +1233,23 @@
void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c) {
kfree(c->wbuf);
}
+
+int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c) {
+ /* Cleanmarker currently occupies a whole programming region */
+ c->cleanmarker_size = MTD_PROGREGION_SIZE(c->mtd);
+
+ /* Initialize write buffer */
+ init_rwsem(&c->wbuf_sem);
+ c->wbuf_pagesize = MTD_PROGREGION_SIZE(c->mtd);
+ c->wbuf_ofs = 0xFFFFFFFF;
+
+ c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
+ if (!c->wbuf)
+ return -ENOMEM;
+
+ return 0;
+}
+
+void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) {
+ kfree(c->wbuf);
+}
More information about the linux-mtd-cvs
mailing list