[Yaffs-archive] Re: [yaffs] About NAND_YAFFS_OOB

Thomas Gleixner tglx@linutronix.de
Mon, 10 Mar 2003 11:24:30 +0100


--Boundary_(ID_g8bYIcAOExxTkHXkMRfl5g)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT

On Monday 10 March 2003 04:25, Edward J. Lee wrote:
> Thomas Gleixner ? ?:
Yep
> Hmm. I just got a new set of code from the CVS
> (:pserver:anonymous@cvs.aleph1.co.uk:/home/aleph1/cvs co yaffs)
> , looked into yaffs_mtdif.c and couldn't find the string yaffs_oobinfo.
> Strange. I'm Puzzled. Is there a different CVS running so that I
> couldn't get the latest code?
Sorry, I was not aware, that this peace of code was not checked in yet.

Charles ?

See attached patch against YAFFS CVS. It should work with current MTD CVS.

-- 
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de

--Boundary_(ID_g8bYIcAOExxTkHXkMRfl5g)
Content-type: text/x-diff; charset=iso-8859-1; name=yaffsmtd.diff
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=yaffsmtd.diff

diff -u -r1.7 yaffs_mtdif.c
--- yaffs/yaffs_mtdif.c	17 Jan 2003 04:19:08 -0000	1.7
+++ yaffs/yaffs_mtdif.c	18 Feb 2003 21:15:26 -0000
@@ -29,6 +29,16 @@
 #include "linux/mtd/nand.h"
 #endif
 
+struct nand_oobinfo yaffs_oobinfo = {
+	useecc: 1,
+	eccpos: {8, 9, 10, 13, 14, 15}
+};
+
+struct nand_oobinfo yaffs_noeccinfo = {
+	useecc: 0,
+};
+
+
 int nandmtd_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, yaffs_Spare *spare)
 {
 	struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
@@ -43,9 +53,9 @@
 	if(data && spare)
 	{
 		if(dev->useNANDECC)
-			mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,NAND_YAFFS_OOB);
+			mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_oobinfo);
 		else
-			mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,NAND_NONE_OOB);
+			mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_noeccinfo);
 	}
 	else
 	{
@@ -80,12 +90,12 @@
 		if(dev->useNANDECC)
 		{
 		        u8 tmpSpare[ YAFFS_BYTES_PER_SPARE + (2*sizeof(int)) ];
-			retval = mtd->read_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,tmpSpare,NAND_YAFFS_OOB);
+			retval = mtd->read_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,tmpSpare,&yaffs_oobinfo);
 		        memcpy(spareAsBytes, tmpSpare, YAFFS_BYTES_PER_SPARE);
 		}
 		else
 		{
-			retval = mtd->read_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,NAND_NONE_OOB);
+			retval = mtd->read_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_noeccinfo);
 		}
 	}
 	else

--Boundary_(ID_g8bYIcAOExxTkHXkMRfl5g)--

---------------------------------------------------------------------------------------
This mailing list is hosted by Toby Churchill open software (www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself from the list by 
sending an email to yaffs-request@toby-churchill.org with the text "unsubscribe" 
(without the quotes) as the subject.