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

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 ?
Thank you very much for your time,
Ran

On Fri, 1 Jul 2011 11:38:40 -0700 Ran Shalit ranshalit@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

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
Hello Scott,
Thank you for the kind reply. Is it also possible instead of using read-modify-write which you've suggested, just to call the nand_write_skip_bad (the patch version) with 0xFFFF... at the start of partition, so that nand_write_skip_bad is given aligned offset & unaligned length? As I undesratnd, an attempt to write "ff" in nand will result in no change of data.
Best Regards,
Ran

On Fri, 1 Jul 2011 12:42:12 -0700 Ran Shalit ranshalit@gmail.com wrote:
Thank you for the kind reply. Is it also possible instead of using read-modify-write which you've suggested, just to call the nand_write_skip_bad (the patch version) with 0xFFFF... at the start of partition, so that nand_write_skip_bad is given aligned offset & unaligned length? As I undesratnd, an attempt to write "ff" in nand will result in no change of data.
This will result in improper ECC being written.
-Scott

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
Thank you for the kind reply. Is it also possible instead of using read-modify-write which you've suggested, just to call the nand_write_skip_bad (the patch version) with 0xFFFF... at the start of partition, so that nand_write_skip_bad is given aligned offset & unaligned length? As I undesratnd, an attempt to write "ff" in nand will result in
no
change of data.
This will result in improper ECC being written.
-Scott
I might be missing something... When using nand_write_skip_bad, the aligned offset refers to page (not sector or block), so if as I understand , I can read from the start of page the whole relevant data, then modify only the parts which is changed, and then write it again, but the writing is not for the entire block: I will use the nand_write_skip_bad given offset of the start of page, and length will be the unaligned length for the whole data being written (which is part of the entire block).
Ran
participants (2)
-
Ran Shalit
-
Scott Wood