NAND OOB data.

Brian Norris computersforpeace at gmail.com
Mon Jun 20 19:49:03 EDT 2011


On Mon, Jun 20, 2011 at 10:53 AM, ANDY KENNEDY <ANDY.KENNEDY at adtran.com> wrote:
> Okay, so how do I (without the luxury of u-boot), in user or
> kernel space, wipe the OOB data?  I'm looking at the code for
> u-boot nand_erase_nand right now.  I mean, I'm not above writing
> an userspace app that will do kernel level work for me.  I'm okay
> with using /dev/mem and screwing with stuff.  Am I on the right
> track?  I mean, I hate to go down this road if I'm just heading
> for a dead-end.

Well, it's hack-ish, but the easiest way I've found is just to
(temporarily) remove this piece of code from nand_erase_nand():
                /*
                 * heck if we have a bad block, we do not erase bad blocks !
                 */
                if (nand_block_checkbad(mtd, ((loff_t) page) <<
                                        chip->page_shift, 0, allowbbt)) {
                        printk(KERN_WARNING "%s: attempt to erase a bad block "
                                        "at page 0x%08x\n", __func__, page);
                        instr->state = MTD_ERASE_FAILED;
                        goto erase_exit;
                }

Then you can trick the MTD layer into erasing your bad blocks. Be sure
to undo this code change after you've erased the chip!

Brian



More information about the linux-mtd mailing list