Initial MTD Study Notes

Source: Internet
Author: User

 

I. Basic Architecture

Flash memory is a erasable memory that does not require power supply and maintenance information. Flash memory is used together with the cropped, appropriate device drivers and file systems. In Linux systems, such specially designed drivers and file systems are provided by the MTD subsystem.

Composition of Linux-MTD

1. MTD Core

2. Map the driver.

3. Chip driver. Command support for Chip Communication.

After a user program initiates a request, it resolves the specific file system through VFS (Virtual File System), such as jffs2 and yaffs2.

MTD device drivers are divided into three layers

Operating System Interface Layer

Block device mtd_block.c mtd_blkdev.c

Character device mtd_char.c

 

Processing protocol layer

MTD Device Driver (nandbase. c)

Related to structure nand_chip

 

Related hardware layer (chip driver)

S3c2410_nand.c is related to hardware.

 

The MTD block device driver can disguise flash devices as Block devices.

Mtd_info is used to describe the original MTD device information. A large amount of MTD data and operation functions are defined. Such as page size, OOB size, block size, and ECC type.

Block devices can be accessed only when they are stored in the file system. Jffs2 is a complete file system specially designed for flash. Cramfs is a read-only file system with a high compression ratio. The yaffs file system is a file system designed for NAND Flash devices.

Ii. Data Structure

Mtd_partition identifies the partition of the flash memory chip

Map_info contact ing driver and chip driver

Mtd_info

Erase_info, erase_info_user, used to erase the management structure of flash memory

Cfi_private, device information maintained by the nor chip driver

Nand_ecclayout: OOB idle zone layout of the NAND chipset

Iii. NAND Flash Problems

NAND Flash consists of multiple blocks, each of which consists of several pages. The

The page has a reserved spare area ). The smallest unit for writing data is the page, and the smallest unit for erasure is

RMB is a block. Generally, each 512 bytes corresponds to a redundancy zone of 16 redundant bytes for poor storage.

Incorrect verification code, logical address, and so on.

 

Based on the bit that can be stored in a flash unit, flash can be divided into SLC and MLC. MLC

Flash storage 2 ~ 4-bit information.

Problems to be Solved Using Flash

1. Limited block erasure times

Use the loss smoothing method to make each block use an approximate balance

2. Ectopic update

After the data in Flash is modified, it must be placed in other idle areas. The original areas must be

When it is erased. Therefore, address ing and garbage collection technologies are required to manage buckets.

3. Bad blocks

Nand may produce bad blocks during production and use.

4. Error Verification Code

NAND Flash may cause a bit flip problem. The ECC algorithm is required for error correction.

All the above four problems must be solved in the file system (nftl Layer.

 

Use NAND Flash

The functions of NAND flash can be divided into the following parts:

1. valid data Zone

2. Substitution Zone

3. Free Zone

4. Areas to be erased

5. Bad Block Area

Therefore, you can divide the physical zone management into three parts:

1. ing area

2. Data Zone

3. Reserved Area

Bad Block tables must be included in the ing area (generally one page is enough)

The data zone is the place where you use it. Specifically, it refers to the idle zone, the available zone, and the alternative zone.

The retention zone is used to prevent bad blocks from being generated during flash usage.

During the first use, you must scan the entire system to create a bad block table. This step is done by querying the block Status bytes of the redundant zone. Then, you can use the redundancy zone to query the ECC information, address translation table information, and block status information of flash to complete the corresponding operations.

For the specific operation of NAND Flash, see the http://download.csdn.net/source/3568972

 

 

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.