On Friday 11 May 2007 04:46, David Goodenough wrote:
> Do I read this correctly to say that there are no changes
> needed to the MTD code in order to achieve this? If so that
> is great, otherwise I will go over to their list and campain
> for whatever is needed.
At a minimum, you would have to adjust the definition of
struct nand_ecclayout nand_oob_16 in nand_base.c to get the
ECC to match that used on the platform. You would also need
to use the MTD_OOB_PLACE option in the calls to MTD from yaffs
and then scatter/gather the tag bytes appropriately. Leaving the
ECC bytes 0xff on writes and have MTD do ECC.
If you are using a older version of mtd, one that uses nand_oobinfo
on the read/write calls, you should be able to get some of the old
code in Yaffs working. See the yaffs2 codebase file yaffs_mtdif.c,
also see if CONFIG_YAFFS_USE_OLD_MTD is applicable.
Looking at our version of yaffs2 codebase's yaffs_mtdif.c
we have running on an older 2.4.24 based product, we have:
struct nand_oobinfo yaffs_oobinfo = {
useecc: MTD_NANDECC_PLACE,
eccbytes: 6, // ++BSE: was missing, needed by mtd->read_ecc
#ifdef CONFIG_BSE_USE_ORIG_YAFFS1_ECC_LAYOUT
// swap 1st and 2nd bytes of each of the 3 byte ECC groups to
// match original yaffs/smartmedia layout.
eccpos: {9, 8, 10, 14, 13, 15}
#else
eccpos: {8, 9, 10, 13, 14, 15}
#endif
};
With the older MTD api, the application (yaffs) cooperates with
MTD when handling the oob/spare bytes -- you have to ensure that
both Yaffs and MTD have the same layout. You control this
using the struct nand_oobinfo passed of the calls to MTD, and/or
with the default nand_oobinfo defined in the mtd's nand_base.c.
Sorry to be non-specific, one needs to see the actual versions of
source to be sure.
-imcd