NAND bad blocks

J.D. Bakker bakker at thorgal.et.tudelft.nl
Thu Apr 15 12:39:55 EDT 2004


Hi all,

There's a slight discrepancy between what mtd and mkyaffs consider a bad block.

 From mtd/drivers/mtd/nand/nand.c:

   static int nand_block_bad(struct mtd_info *mtd, unsigned long page)
   {
         struct nand_chip *this = mtd->priv;

         this->cmdfunc (mtd, NAND_CMD_READOOB, NAND_BADBLOCK_POS, page);
         if (this->read_byte(mtd) != 0xff)
                 return 1;

         return 0;
   }

...which would indicate that even one bit set to zero would mark the 
block bad. However, mkyaffs.c has this code:

   /* Read the OOB data to determine if the block is valid.
    * If the block is damaged, then byte 5 of the OOB data will
    * have at least 2 zero bits.
    */

..snip..

   if(countBits[oobbuf[5]] < 7)
   {
	printf("Block at 0x08%lx is damaged and is not being 
formatted\n",addr);
   }

So, which is it ?

JDB
-- 
LART. 250 MIPS under one Watt. Free hardware design files.
http://www.lart.tudelft.nl/



More information about the linux-mtd mailing list