Skip to contentSkip to conversation

nand oob corruption recovery

DISCUSSION David Updegraff 2 participants 3 messages Jul 1, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

I realize that specs say that if you wipe out mfg. bad block markers that there is "no way to recover them".. but...

Are there suggestions for plausibly reliable test sequences that one could run a nand chip thru to regenerate valid bad block markers?

Presumeably, it is insufficient to simply try to erase all blocks, marking failures as bad... perhaps verified full page writes ?

Suggestions?

Thanks.

-dbu / Dave Updegraff / [email protected]

#1 lore raw
Quoted 7 lines · David Updegraff

I realize that specs say that if you wipe out mfg. bad block markers that there is "no way to recover them".. but...
Are there suggestions for plausibly reliable test sequences that one could run a nand chip thru to regenerate valid bad block markers?

Presumeably, it is insufficient to simply try to erase all blocks, marking failures as bad... perhaps verified full page writes ?

Erasing may be not sufficient, as the block could be al ff. Writing all blocks to all zeros and verify that it works. Maybe try a 0x55 and 0xAA pattern too.

Signature · 11 lines
Thomas
_____________________________________________________________________
From slash dot org
"When customers are visiting, engineers are not allowed to wear ties. 
That way the customer can tell who is the engineer and who is the 
salesman (and therefore whom to believe.). Ties cut off blood flow 
to the brain, making it easier for the salesmen to do their jobs." 
_____________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: [email protected]
#2 lore raw

Relevant to this; enclosed is small nandwrite.c patch that fixes segfault and at least warns about upcomming OOB destruction in large-block devices.

-dbu.

util/nandwrite.c renamed from util/nandwrite.c.orig +15 -2
@@ -42,8 +42,8 @@
 /*
  * Buffer array used for writing data
  */
-unsigned char writebuf[512];
-unsigned char oobbuf[16];
+unsigned char *writebuf;
+unsigned char *oobbuf;
 
 // oob layouts to pass into the kernel as default
 struct nand_oobinfo none_oobinfo = { 
@@ -223,6 +223,19 @@
 		close(fd);
 		exit(1);
 	}
+
+	/* NOW! allocate writebuf and oobbuf.. */
+	writebuf = malloc (meminfo.oobblock);
+	oobbuf = malloc (meminfo.oobsize);
+	if (!writebuf || !oobbuf)
+		perror ("cannot allocate buffers\n");
+	if ((forcejffs2 || forceyaffs || autoplace) && (meminfo.oobsize > 16))
+	{
+		fprintf (stderr, "\nDanger!Danger! Will Robinson, Overriding driver's AUTO_ECC layout for \nlarge-block chips will almost certainly trash OOB!\n Continue? (y/N)\n");
+		if (getchar () != 'y') {
+			exit(1);
+		}
+	}
 	
 	// write without ecc ?
 	if (noecc) {