Re: [RFC 1/5] mtd: support MTD_MODE_RAW for writing OOB

Brian Norris
2011-08-23T19:57:50Z

On Mon, Aug 22, 2011 at 10:25 PM, Jason Liu <liu.h.jason@gmail.com> wrote:
> 2011/8/18 Brian Norris <computersforpeace@gmail.com>:
>> This fixes issues with `nandwrite -n' and the MEMWRITEOOB[64] ioctls.
>
> It's worthy here stating clear what the issue you meet and how it fix.

The issue is simply that `nandwrite -n -o' does not work on my system;
`nandwrite -n' can write page data to my flash without applying ECC,
but when I use the `-o' option, ECC is applied (incorrectly), contrary
to the `--noecc' option.

I found that this is the case because my hardware computes and writes
ECC data to flash upon either OOB write or page write. Thus, to
support a proper "no ECC" write, my driver must know when we're
performing a raw OOB write vs. a normal ECC OOB write. However, MTD
does not pass any raw mode information to the write_oob functions.
This patch addresses the problems by:
1) Passing MTD_OOB_RAW down to lower layers, instead of just
defaulting to MTD_OOB_PLACE
2) Handling MTD_OOB_RAW within the NAND layer's `nand_do_write_oob'

Is this a better description? I'll include this description for v2.

Note that I have yet to update the appropriate `nand_write_page_raw'
function to properly handle an OOB-only write. I've fixed my own
driver, but there's an issue in the nand_base version. Will include in
v2.

Thanks,
Brian