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

Top Page
Attachments:
Message as email
+ (text/plain)
+ yaffsmtd.diff (text/x-diff)
Delete this message
Reply to this message
Author: Thomas Gleixner
Date:  
To: Edward J. Lee, yaffs
CC: Charles Manning
New-Topics: [Yaffs-archive] NAND emulator update to latest MTD interface? and list problems?, [Yaffs-archive] NAND emulator update to latest MTD interface?
Subject: [Yaffs-archive] Re: [yaffs] About NAND_YAFFS_OOB
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::/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:
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