On 2010-08-16, Scott Wood <scottw...@freescale.com> wrote: > On Fri, Aug 13, 2010 at 09:22:21PM +0000, Grant Edwards wrote:
> At one point in the legacy NAND code, a distinction was made when > reading between completely skipping bad blocks, and filling the > buffer with zeroes in place of the bad blocks. It looks like > ".jffs2" or ".e" would get you zeroes, and ".jffs2s" or ".i" would > get you block skipping. > > The zero-fill mode is no longer supported. In 1.3.4, assuming you're > not using the legacy NAND code, you need to specify one of ".jffs2", > ".e", or ".i" to get block skipping. It doesn't matter which one. > In current u-boot these suffixes are accepted and ignored as legacy > (bad blocks are always skipped), except for "jffs2s" which apparently > never made an appearance outside the legacy code. OK, that clears up quite a bit of my confusion. > Yes, it's a bit of a mess. It does appear to be improving. :) >> 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? > > The user interface .jffs2 suffix was to indicate bad block skipping, > but opts->jffs2 (which is still around) refers to writing JFFS2 > cleanmarkers after erasing a block. Thanks, that helps. >> 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). > > You suspect correctly. > > In current code there is nand_write_skip_bad() and > nand_read_skip_bad() in drivers/mtd/nand/nand_util.c. Yup, I found those, and the read version is exactly what I need. I've still got to figure out how to write. The problem is that the data to be written is streaming. I don't know how much there is, and I don't want to allocate arbitrarily large buffers. So I want to write it one erase-block at a time as it arrives. AFAICT nand_write_skip_bad() can't be used in that situation. Since it provides no indication of how many blocks were skipped, I have no way of knowing where the next block should be written. I guess that means I need to use the same lower-level API that is being used by nand_write_skip_bad(). > In 1.3.4 use nand_read_opts()/nand_write_opts(). Or convince Atmel > to support something more recent. :-) It turns out that Atmel's patches have been merged into the main sources and 2010.6 works fine for the board in question. I don't know why the official Atmel web-page still instructs you to use 1.3.4+patches. -- Grant Edwards grant.b.edwards Yow! I'm encased in the at lining of a pure pork gmail.com sausage!! _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot