Rework the out of band handling completely

Source: Internet
Author: User

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.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.