forked from luck/tmp_suning_uos_patched
[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>
This commit is contained in:
parent
e102d54abf
commit
59da721a22
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: fs.c,v 1.61 2005/07/24 15:29:56 dedekind Exp $
|
||||
* $Id: fs.c,v 1.62 2005/08/06 04:51:30 nico Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -664,7 +664,14 @@ static int jffs2_flash_setup(struct jffs2_sb_info *c) {
|
|||
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 @@ void jffs2_flash_cleanup(struct jffs2_sb_info *c) {
|
|||
if (jffs2_dataflash(c)) {
|
||||
jffs2_dataflash_cleanup(c);
|
||||
}
|
||||
|
||||
/* and Intel "Sibley" flash */
|
||||
if (jffs2_nor_wbuf_flash(c)) {
|
||||
jffs2_nor_wbuf_flash_cleanup(c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: os-linux.h,v 1.59 2005/07/17 11:13:46 dedekind Exp $
|
||||
* $Id: os-linux.h,v 1.60 2005/08/06 04:51:30 nico Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -85,16 +85,21 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
|
|||
#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 @@ void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c);
|
|||
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 */
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: wbuf.c,v 1.96 2005/07/22 10:32:08 dedekind Exp $
|
||||
* $Id: wbuf.c,v 1.97 2005/08/06 04:51:30 nico Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -1235,3 +1235,23 @@ int jffs2_nor_ecc_flash_setup(struct jffs2_sb_info *c) {
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user