clean marker size for NOR w/ECC

Timofey Kutergin tkutergin at mail.ru
Wed Jun 22 02:49:44 EDT 2005


Hi all !
Currently, JFFS2 WBUF implicitly assumes that cleanmarker size is multiple number of eccsize and sets it to 16 in jffs2_nor_ecc_flash_setup(). Which in fact mean 1,2,4,8 and 16 valid values for eccsize. Newer flashes may have ECC window more than that, 1024 bytes, for example. So at least it is suggested to change

 c->cleanmarker_size = 16;
to
 c->cleanmarker_size = c->mtd->eccsize>=16 ? c->mtd->eccsize:16;

in
jffs2_nor_ecc_flash_setup()

also, when using flash_eraseall utility with -j option, it also assumes cleanmarker size of 16 (sizeof(struct jffs2_unknown_inode)).
It is suggested to put similar check there:

 isNAND = meminfo.type == MTD_NANDFLASH ? 1 : 0;
 isNORECC = ((meminfo.type == MTD_NORFLASH) && ((meminfo.flags & MTD_ECC != 0))) ? 1 : 0;

....

if (!isNAND && !isNORECC)
   cleanmarker.totlen = cpu_to_je32 (sizeof (struct ffs2_unknown_node));
else if (isNORECC)
   cleanmarker.totlen = cpu_to_je32 (meminfo.eccsize >= sizeof (struct ffs2_unknown_node) ? meminfo.eccsize:sizeof (struct ffs2_unknown_node));
else {
...


Regards
Timofey





More information about the linux-mtd mailing list