[PATCH 1/2] mtd: nand: add OOB argument to NAND {read, write}_page interfaces

Jon Povey Jon.Povey at racelogic.co.uk
Thu Apr 19 21:10:24 EDT 2012


linux-mtd-bounces at lists.infradead.org wrote:
> {read, write}_page interfaces
>
> Hi Mike,
>
> On Thu, Apr 19, 2012 at 9:50 AM, Mike Dunn
> <mikedunn at newsguy.com> wrote:
>> On 04/17/2012 08:44 PM, Brian Norris wrote:
>>
>>> Now, in future revisions of this ASIC, it may be possible to access
>>> OOB via DMA as well, but even if this happens, it doesn't make a lot
>>> of sense on this hardware to *always* pull OOB data.
>>
>>
>> No, it doesn't.  In fact, I'm not aware of any code within or on top
>> of mtd that does anything with the oob data when a page is read.  If
>> oob is needed, mtd_read_oob() is used.
>
> I guess this may not be an issue for page read, but I know one use for
> write_page data+OOB. MLC NAND, for instance, requires that you write
> *once* to a page, so I introduced ioctl(MEMWRITE) which generically
> allows page, OOB, or both to be written. This trickles down to the
> nand_ecc_ctrl.write_page function, I think. There are probably other
> cases that I'm not really thinking of right now.

Ability to write raw OOB including userland software-generated ECC is
needed for Linux to be able to update the bootloader on certain TI
DaVinci chips at least. This is because the ROM bootloader in the chip
has a wacky/bugged idea of OOB layout.

If you can do that you can also write MTD partitions in a different layout
from the one you are supporting, e.g. as part of a firmware update to a
kernel with a different filesystem and OOB layout. I have used this to
good effect.

I can think of a slightly obscure use for reading OOB on these TI chips:
Once booted to Linux, you could read and check in software the ECC for
the ROM bootloader looking for bitflips, and rewrite the bootloader if
it was starting to degrade. The bootloader has no way to rewrite or report
ECC corrections, you see. I have not done this myself.

In theory nobody should ever need to worry about OOB+ECC but being able
to fiddle with it has its uses and I hope that ability doesn't go away.

--
Jon Povey
jon.povey at racelogic.co.uk

Racelogic is a limited company registered in England. Registered number 2743719 .
Registered Office Unit 10, Swan Business Centre, Osier Way, Buckingham, Bucks, MK18 1TB .

The information contained in this electronic mail transmission is intended by Racelogic Ltd for the use of the named individual or entity to which it is directed and may contain information that is confidential or privileged. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email so that the sender's address records can be corrected. The views expressed by the sender of this communication do not necessarily represent those of Racelogic Ltd. Please note that Racelogic reserves the right to monitor e-mail communications passing through its network





More information about the linux-mtd mailing list