[Yaffs] yaffs2 oob offset problem

Ian McDonnell ian at brightstareng.com
Wed Aug 3 16:44:27 BST 2005


On Wednesday 03 August 2005 07:00, Artis Kugevics 
artis at mikrotik.com wrote:
> I wonder, at what oob offset yaffs2 out-of-band data is placed
> for curent yaffs2 users? This offset is taken from default
> nand_oobinfo structure in MTD. If not overriden, then it is
> nand_oob_64 in mtd/nand/nand_base.c, which sets offset to 2
> (oobfree = {{2,38}}).

I should have included the following with my last posting...

The hacked nand_read_oob function included in my earlier posting assumes
that the first element in the 'oobfree' list defines a region that is
sufficient for yaffs2 tags, i.e. at least 28 bytes. The hack does not
do the full oob scatter/gather thing.

The root problem is that YAFFS2 needs AUTOPLACMENT functionality
on mtd->read_oob when MTD is provided the ECC functionality, and
mtd->read_oob is providing a raw interface.

Our mtd flash i/o setup uses its own struct nand_oobinfo nand_oob_64,
see below.  I 'reserved' the first 6 bytes because the ST large-page
chip we are using (NAND01GW3B2AN6) has bad-block markers at the 1st
and the 6th bytes.  MTD's equivalent struct (in nand_base.c) starts
user data at offset 2 so would/will overwrite the factory installed
bad-block status in the sixth byte.  [For this reason too we have our
own mtd nand_block_bad function and there was some MTD hacking necessary
to get that working -- if you need that, e-mail].

-imcd

==============

This is from our board-specific NAND setup code:

/* We use our own oobinfo data for the STM 128Mbyte large page device.
 * It has factory bad block indicators in the 1st and 6th bytes.
 * MTD's oobinfo data for these type of parts is different.
 *
 * Large page (2k) devices have 64 bytes of 'spare' (oob) data.
 * We provide 34 bytes of 'oobfree' data for user/filesystem use;
 * bytes 6-40 inclusive.  YAFFS2 needs 28 bytes for its tags; this
 * is stored in the 'oobfree' area.  24 bytes of ECC for the 2K page
 * is stored in 'eccpos', see below; this is managed by MTD.
 */
static struct nand_oobinfo nand_oob_64 = {
        .useecc = MTD_NANDECC_AUTOPLACE,
        .eccbytes = 24,
        .eccpos = {
                40, 41, 42, 43, 44, 45, 46, 47,
                48, 49, 50, 51, 52, 53, 54, 55,
                56, 57, 58, 59, 60, 61, 62, 63
        },
        .oobfree = { {6, 34} }
};



More information about the yaffs mailing list