Is the Linux MTD good enough for MLC NAND flash?

Posted by: Thom Denholm

On Linux, the Memory Technology Device (MTD) subsystem is designed to be a generic interface to memory devices, primarily Flash media. The integrated hardware driver handles the storage formats used on the media, and then MTD provides simple routines for block read, write and erase. MTD does not contain any bad block handling or wear leveling routines, so the use of MTD alone is not recommended on NAND flash media. Instead, developers are asked to use a full Flash File System on Linux, such as YAFFS, JFFS2 and UBIFS. Unfortunately, neither the low level driver portions of MTD nor the commonly available Flash File Systems have kept up with modern MLC NAND Flash media, which requires special handling in several ways. Among these are:

  • Shrinking dies have reduced costs but increased the error rate, resulting in higher requirements of Error Correcting Codes (ECC). A larger amount of storage is also required for the Error correcting data. Most ECCs are handled with hardware now, and this means either MTD or the low level driver must communicate with the hardware ECC controller located in the processor or on the board.
  • Persistent bit errors, often caused by a Read Disturb, need special handling to correct. Flash vendors recommend a procedure called scrubbing. A related Program Disturb error can cause errors in a subsequent page of the media if vendor programming guidelines are not followed. Flash vendor guidelines vary from manufacturer to manufacturer. The Linux MTD subsystem is generic, and does not contain any vendor-specific routines.
  • With both SLC and MLC NAND, all data writes to a given erase block should be sequential. The MTD subsystem by itself cannot enforce this policy, but a Flash File System can. None of the available Flash File Systems handle this for MLC.

Another problem worth mentioning, though more of a hardware problem, is power interruption while writing to a flash block. This is problematic for all NAND flash, but especially so for MLC. Pages on the media are coupled with other pages, so when power is interrupted during one block write, two (or more) pages may be corrupted. This significant problem has drawn some interest in the programming world, but unfortunately for Linux and MTD, the proposed solutions are all patented. By itself, MTD is not sufficient to handle MLC NAND flash. It does provide the necessary operations and information to the upper level Flash File Systems, but none of them have been architected to support MLC flash media. The MTD subsystem doesn't contain any vendor specific code, treating all NAND flash the same. The UBIFS documentation puts it this way: "Good FTL must be a rather complex piece of software." We tend to agree. Datalight Flash management software works closely with flash media vendors, providing far more than a simple read, write and erase driver. FlashFX Tera's bad block management, wear leveling and scrubbing algorithms are a key part of getting the best performance and endurance out of MLC NAND flash media.

Learn more about FlashFX Tera


Comments (0)


Add a Comment





Allowed tags: <b><i><br>Add a new comment: