public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* NAND bbt build reads wrong oob data
@ 2005-07-15  3:19 Todd Poynor
  2005-07-15  7:22 ` Thomas Gleixner
  0 siblings, 1 reply; 8+ messages in thread
From: Todd Poynor @ 2005-07-15  3:19 UTC (permalink / raw)
  To: linux-mtd

The recent change to read only the bad block marker while building the
bad block table is giving me some trouble on an OMAP16xx H2, and I'm
trying to figure out where the problem lies (and I'm pretty new at NAND
flash as may become obvious).

The value read seems to be a different byte, perhaps offset 14 instead
of offset 5 as specified by the placement scheme.  The hack that seems
to fix it for me, namely to read the whole OOB area instead of the
individual byte, is below.  (I also got rid of some refs to scanlen
which is forced to zero for the ! NAND_BBT_SCANEMPTY case, and
NAND_BBT_SCAN2NDPAGE is triggering a BUG I haven't investigated yet.)

If anybody has a clue for me I'd be thankful; in any case, I'll further
educate myself on how this is supposed to work. -- Todd

Index: linux/drivers/mtd/nand/nand_bbt.c
===================================================================
--- linux.orig/drivers/mtd/nand/nand_bbt.c	2005-07-15 02:26:18.000000000 +0000
+++ linux/drivers/mtd/nand/nand_bbt.c	2005-07-15 02:42:41.000000000 +0000
@@ -300,7 +300,7 @@
 	if (!(bd->options & NAND_BBT_SCANEMPTY)) {
 		/* We need only read few bytes from the OOB area */
 		scanlen = ooblen = 0;
-		readlen = bd->len;
+		readlen = mtd->oobblock;
 	} else {
 		/* Full page content should be read */
 		scanlen	= mtd->oobblock + mtd->oobsize;
@@ -338,12 +338,13 @@
 				size_t retlen;
 				
 				/* No need to read pages fully, just read required OOB bytes */
-				ret = mtd->read_oob(mtd, from + j * mtd->oobblock + bd->offs,
-							readlen, &retlen, &buf[0]);
+				ret = mtd->read_oob(mtd, 
+						    from + j * mtd->oobblock,
+						    readlen, &retlen, &buf[0]);
 				if (ret)
 					return ret;
 
-				if (check_short_pattern (&buf[j * scanlen], scanlen, mtd->oobblock, bd)) {
+				if (check_short_pattern (&buf[bd->offs], readlen, mtd->oobblock, bd)) {
 					this->bbt[i >> 3] |= 0x03 << (i & 0x6);
 					printk (KERN_WARNING "Bad eraseblock %d at 0x%08x\n", 
 						i >> 1, (unsigned int) from);
@@ -969,7 +970,7 @@
 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
 
 static struct nand_bbt_descr smallpage_memorybased = {
-	.options = NAND_BBT_SCAN2NDPAGE,
+	.options = 0,
 	.offs = 5,
 	.len = 1,
 	.pattern = scan_ff_pattern

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: NAND bbt build reads wrong oob data
@ 2005-07-15 16:51 Martin Fouts
  2005-07-15 18:57 ` Todd Poynor
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Fouts @ 2005-07-15 16:51 UTC (permalink / raw)
  To: Todd Poynor, tglx; +Cc: linux-mtd

 

-----Original Message-----
From: linux-mtd-bounces@lists.infradead.org
[mailto:linux-mtd-bounces@lists.infradead.org] On Behalf Of Todd Poynor
Sent: Friday, July 15, 2005 12:59 AM
To: tglx@linutronix.de
Cc: linux-mtd@lists.infradead.org
Subject: Re: NAND bbt build reads wrong oob data


> OK, this is pretty unexpected, so I'll try harder to figure out where
it goes wrong or whether 
> I've got another board that it affects (a colleague reported some new
bad blocks messages after 
> upgrading to the same software on a different board, will see if
there's a similar situation).

I can confirm that it happens on other boards. I have the same problem
with the same NAND chip on a P2 board.  I haven't had time to
investigate yet.

Marty

^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <DE88BDF02F4319469812588C7950A97E931035@ussunex1.palmsource.com>]

end of thread, other threads:[~2005-07-16 11:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-15  3:19 NAND bbt build reads wrong oob data Todd Poynor
2005-07-15  7:22 ` Thomas Gleixner
2005-07-15  7:58   ` Todd Poynor
2005-07-15 13:57     ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2005-07-15 16:51 Martin Fouts
2005-07-15 18:57 ` Todd Poynor
     [not found] <DE88BDF02F4319469812588C7950A97E931035@ussunex1.palmsource.com>
2005-07-15 20:32 ` Thomas Gleixner
2005-07-16 11:33   ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox