Http://lists.infradead.org/pipermail/linux-mtd-cvs/2006-May/005519.html
The official introduction of OOB knowledge, especially mtd_oob_raw, mtd_oob_place, mtd_oob_auto.
[MTD] rework the out of band handling completely
Hopefully the last iteration on this!
The handling of out of band data on NAND was accompanied by tons of fruitless
Discussions and halfarsed patches to make it work for a participant
Problem. sufficiently annoyed by I all those "I know it better" mails and
Resonable amount of discarded "it solves my problem" patches, I finally decided
To go for the big rework. After removing the _ ECC variants of MTD read/write
Functions The solution to satisfy the various requirements was to refactor
Read/write _ OOB functions in MTD.
The major change is that read/write_oob now takes a pointer to an operation
Descriptor structure "struct mtd_oob_ops". Instead of having a function with
Least seven arguments.
Read/write_oob which shocould probably renamed to a more descriptive name, can do
The following tasks:
-Read/write out of band data
-Read/write data content and out of band data
-Read/write raw data content and out of band data (ECC disabled)
Struct mtd_oob_ops has a mode field, which determines the OOB handling mode.
Aside of the mtd_oob_raw mode, which is intended to be especially
Diagnostic purposes and some internal functions e.g. Bad Block table creation,
The other two modes are for MTD clients:
Mtd_oob_place puts/gets the given OOB data exactly to/from the place which is
Described by the ooboffs and ooblen fields of the mtd_oob_ops strcuture. It's
Up to the caller to make sure that the byte positions are not used by the ECC
Placement algorithms.
Mtd_oob_auto puts/gets the given OOB data automaticaly to/from the places in
The out of band area which are described by the oobfree tuples in the ecclayout
Data Structre which is associated to the devicee.
The demo-whether data plus OOB or OOB only handling is done depends on
Setting of the datbuf Member of the data structure. When datbuf = NULL then
The internal read/write_oob functions are selected, otherwise the read/write
Data routines are invoked.
Tested on a few platforms with all variants. Please be aware of possible
Regressions for your particle device/Application Scenario
Disclaimer: Any whining will be ignored from those who just contributed "hot
Air blurb "and never sat down to tackle the underlying problem of the mess in
The NAND driver grown over time and the big chunk of work to fix up
Existing users. The problem was not the holiness of the existing MTD
Interfaces. The problems was the lack of time to go for the big overhaul. It's
Easy to add more mess to the existing one, but it takes alot of effort to go
For a real solution.
Improvements and bugfixes are welcome!