[U-Boot] handling of bad blocks in nand

Grant Edwards grant.b.edwards at gmail.com
Fri Aug 13 23:22:21 CEST 2010


On 2010-07-09, Scott Wood <scottwood at freescale.com> wrote:
> On Fri, Jul 09, 2010 at 08:56:40AM -0400, Ben Gardiner wrote:
>
>> If you are putting an MTD filesystem in that partition then the
>> filesystem itself will take care of bad blocks that might occur in
>> the partition during runtime. During the flash programming of this
>> filesystem using nand write.jffs2 (or .e) will skip bad blocks that
>> might occur in the partition.
>> 
>> If you are putting an image (kernel or initrd) into the partition then
>> the 'nand read.e' and 'nand write.e' (as well as mtd-utils nandwrite)
>> will handle bad blocks by skipping over them.
>
> On any recent u-boot, the .jffs2/.e/.i suffixes are maintained for
> compatibility only -- bad block skipping is now the default behavior.

I'm using 1.3.4 (that's what's supported by Atmel).  While that's the
current "released" version, it appears to be over two years old?

I've been reading nand flash docs and source code for a while now, and
I must admit the more I read the more questions I have.

 1) Is there any documentation for the "nand" commands?
 
    There's nothing in the manual, and doc/README.nand appears to be
    incomplete, and self-contradictory.  [There's no mention at all of
    .e or .i, and there are contradictory descriptions for .jffs2.]

 2) Are the behaviors of ".jffs2", ".e", and ".i" the same? (It
    appears so from the source code.) If not how do they differ?

 3) In the 1.3.4 source code, there are lots of instances where there
    are boolean flags with names like "jffs2".  AFAICT those flags
    have nothing to do with the JFFS2 filesystem, but simply control
    whether or not bad flash blocks are skipped during read/write
    operations.  Am I reading the code correctly?

 4) If in a custom command, I want to read/write a large block of data
    to/from nand flash while skipping bad blocks what functions do I
    call?  Right now I'm doing something like this:

      nand_info[0].read(nand_info+0, offset, sizeof(buffer), &len, buffer)
    
      nand_info[0].write(nand_info+0, offset, bytecount, &len, buffer)
    
    but, I have a feeling that's not right (though it seems to work, I
    suspect it's not going to skip bad blocks).
    
-- 
Grant Edwards               grant.b.edwards        Yow! Hello, GORRY-O!!
                                  at               I'm a GENIUS from HARVARD!!
                              gmail.com            



More information about the U-Boot mailing list