mtd/fs/jffs2 wbuf.c,1.60,1.61

gleixner at infradead.org gleixner at infradead.org
Wed Apr 14 15:01:53 EDT 2004


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv15388

Modified Files:
	wbuf.c 
Log Message:
support for large page nand flash

Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- wbuf.c	28 Mar 2004 19:58:27 -0000	1.60
+++ wbuf.c	14 Apr 2004 19:01:51 -0000	1.61
@@ -921,7 +921,7 @@
 int jffs2_check_nand_cleanmarker (struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
 {
 	struct jffs2_unknown_node n;
-	unsigned char buf[32];
+	unsigned char buf[2 * NAND_MAX_OOBSIZE];
 	unsigned char *p;
 	int ret, i, cnt, retval = 0;
 	size_t retlen, offset;
@@ -1015,7 +1015,7 @@
  */
 int jffs2_nand_read_failcnt(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) {
 
-	unsigned char buf[16];
+	unsigned char buf[NAND_MAX_OOBSIZE];
 	int	ret;
 	size_t 	retlen;
 	int	oob_size;
@@ -1082,17 +1082,31 @@
 
 #define NAND_JFFS2_OOB8_FSDAPOS		6
 #define NAND_JFFS2_OOB16_FSDAPOS	8
+#define NAND_JFFS2_OOB64_FSDAPOS	16
 #define NAND_JFFS2_OOB8_FSDALEN		2
 #define NAND_JFFS2_OOB16_FSDALEN	8
+#define NAND_JFFS2_OOB64_FSDALEN	8
 
-static struct nand_oobinfo jffs2_oobinfo_swecc = {
-	.useecc = 1,
+static struct nand_oobinfo jffs2_oobinfo_swecc_8 = {
+	.useecc = MTD_NANDECC_PLACE,
+	.eccbytes = 3,
+	.eccpos = {JFFS2_OOB_ECCPOS0, JFFS2_OOB_ECCPOS1, JFFS2_OOB_ECCPOS2}
+};
+
+static struct nand_oobinfo jffs2_oobinfo_swecc_16 = {
+	.useecc = MTD_NANDECC_PLACE,
+	.eccbytes = 6,
 	.eccpos = {JFFS2_OOB_ECCPOS0, JFFS2_OOB_ECCPOS1, JFFS2_OOB_ECCPOS2,
 		   JFFS2_OOB_ECCPOS3, JFFS2_OOB_ECCPOS4, JFFS2_OOB_ECCPOS5}
 };
 
+static struct nand_oobinfo jffs2_oobinfo_autoplace = {
+	.useecc = MTD_NANDECC_AUTOPLACE,
+};
+
 static struct nand_oobinfo jffs2_oobinfo_docecc = {
-	.useecc = 1,
+	.useecc = MTD_NANDECC_PLACE,
+	.eccbytes = 6,
 	.eccpos = {0,1,2,3,4,5}
 };
 
@@ -1112,15 +1126,26 @@
 	switch(c->mtd->ecctype) {
 	case MTD_ECC_SW:
 		D1(printk(KERN_DEBUG "JFFS2 using software ECC\n"));
-		c->oobinfo = &jffs2_oobinfo_swecc;
-		if (c->mtd->oobsize == 8) {
+		switch (c->mtd->oobsize) {
+		case 8:
 			c->fsdata_pos = NAND_JFFS2_OOB8_FSDAPOS;
 			c->fsdata_len = NAND_JFFS2_OOB8_FSDALEN;
-		} else {
+			c->oobinfo = &jffs2_oobinfo_swecc_8;
+			c->badblock_pos = 5;
+			break;
+		case 16:
 			c->fsdata_pos = NAND_JFFS2_OOB16_FSDAPOS;
 			c->fsdata_len = NAND_JFFS2_OOB16_FSDALEN;
-		}
-		c->badblock_pos = 5;
+			c->oobinfo = &jffs2_oobinfo_swecc_16;
+			c->badblock_pos = 5;
+			break;
+		case 64:
+			c->fsdata_pos = NAND_JFFS2_OOB64_FSDAPOS;
+			c->fsdata_len = NAND_JFFS2_OOB64_FSDALEN;
+			c->oobinfo = &jffs2_oobinfo_autoplace;
+			c->badblock_pos = 0;
+			break;
+		}	
 		break;
 
 	case MTD_ECC_RS_DiskOnChip:




More information about the linux-mtd-cvs mailing list