[U-Boot] Q: NAND read/write: unaligned offset

Scott Wood scottwood at freescale.com
Fri Jul 1 20:50:45 CEST 2011


On Fri, 1 Jul 2011 11:38:40 -0700
Ran Shalit <ranshalit at gmail.com> wrote:

> Hello,
> 
> I am trying to read\write NAND from unaligned offset & length.
> I saw Scott Wood patch in
> http://lists.denx.de/pipermail/u-boot/2010-August/076435.html for allowing
> unaligned length, but I see that it still demands unaligned offset in write,
> and also the patch added demand for unaligned offset in reading too.
> My question: Should I wrap the call to
> nand_read_skip_bad\nand_write_skip_bad to that I will call the function with
> aligned offset and then retrieve the data parts which I am intereseted in
> (for the write I should also wrap the data of start of page with
> "FFFFF..."),
> or Is there a way to patch nand_read_skip_bad\nand_write_skip_bad in a way
> that I will be able to read\write from unaligned offset ?

Because of how we skip bad blocks, you have to start looking for bad blocks
at the beginning of the partition (with partition defined loosely as an
independent region of flash, which you'll never be accessing as part
of a block-skipping access that starts elsewhere), or you could be accessing
the wrong offset.

Currently we don't have support for performing an access at an address
within a partition that has been adjusted due to bad blocks earlier in the
partition.

So yes, you'll need a wrapper for read.

For writes, you'll need to do a read-modify-write sequence on the entire
block, after you determine what the proper block is given prior
block-skipping.  Or better, don't try to use this simplistic mechanism to
do writes in the middle of a partition -- use something like ubi that was
meant for this.

-Scott



More information about the U-Boot mailing list