X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_mtdif.c;h=582563abdf0b73445964126b0f7cbc17d0312f91;hp=1e096502c0a891657bae9060b46ca108207e4a9d;hb=6f1de4473200f31d1ca1cf4672baf7afcdec2db0;hpb=378bbdf4d64b8b26db55a495ab6ae520ff62e471 diff --git a/yaffs_mtdif.c b/yaffs_mtdif.c index 1e09650..582563a 100644 --- a/yaffs_mtdif.c +++ b/yaffs_mtdif.c @@ -1,8 +1,7 @@ /* - * YAFFS: Yet another FFS. A NAND-flash specific file system. - * yaffs_mtdif.c NAND mtd wrapper functions. + * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. * - * Copyright (C) 2002 Aleph One Ltd. + * Copyright (C) 2002-2007 Aleph One Ltd. * for Toby Churchill Ltd and Brightstar Engineering * * Created by Charles Manning @@ -14,7 +13,7 @@ */ const char *yaffs_mtdif_c_version = - "$Id: yaffs_mtdif.c,v 1.15 2006-10-03 10:13:03 charles Exp $"; + "$Id: yaffs_mtdif.c,v 1.18 2007-02-12 16:55:26 wookey Exp $"; #include "yportenv.h" @@ -64,8 +63,10 @@ static inline void translate_oob2spare(yaffs_Spare *spare, __u8 *oob) spare->tagByte5 = oob[5] == 0xff ? 0xff : oob[5] & 0x3f; spare->blockStatus = oob[5] & 0x80 ? 0xff : 'Y'; spare->pageStatus = oob[5] & 0x40 ? 0xff : 0; + spare->ecc1[0] = spare->ecc1[1] = spare->ecc1[2] = 0xff; spare->tagByte6 = oob[6]; spare->tagByte7 = oob[7]; + spare->ecc2[0] = spare->ecc2[1] = spare->ecc2[2] = 0xff; nspare->eccres1 = nspare->eccres2 = 0; /* FIXME */ } @@ -86,7 +87,7 @@ int nandmtd_WriteChunkToNAND(yaffs_Device * dev, int chunkInNAND, __u8 spareAsBytes[8]; /* OOB */ if (data && !spare) - retval = mtd->write(mtd, addr, dev->nBytesPerChunk, + retval = mtd->write(mtd, addr, dev->nDataBytesPerChunk, &dummy, data); else if (spare) { if (dev->useNANDECC) { @@ -97,7 +98,7 @@ int nandmtd_WriteChunkToNAND(yaffs_Device * dev, int chunkInNAND, ops.mode = MTD_OOB_RAW; ops.ooblen = YAFFS_BYTES_PER_SPARE; } - ops.len = data ? dev->nBytesPerChunk : ops.ooblen; + ops.len = data ? dev->nDataBytesPerChunk : ops.ooblen; ops.datbuf = (u8 *)data; ops.ooboffs = 0; ops.oobbuf = spareAsBytes; @@ -150,7 +151,7 @@ int nandmtd_ReadChunkFromNAND(yaffs_Device * dev, int chunkInNAND, __u8 * data, __u8 spareAsBytes[8]; /* OOB */ if (data && !spare) - retval = mtd->read(mtd, addr, dev->nBytesPerChunk, + retval = mtd->read(mtd, addr, dev->nDataBytesPerChunk, &dummy, data); else if (spare) { if (dev->useNANDECC) { @@ -160,7 +161,7 @@ int nandmtd_ReadChunkFromNAND(yaffs_Device * dev, int chunkInNAND, __u8 * data, ops.mode = MTD_OOB_RAW; ops.ooblen = YAFFS_BYTES_PER_SPARE; } - ops.len = data ? dev->nBytesPerChunk : ops.ooblen; + ops.len = data ? dev->nDataBytesPerChunk : ops.ooblen; ops.datbuf = data; ops.ooboffs = 0; ops.oobbuf = spareAsBytes;