Accessing flash memory from Linux
Raw NOR and NAND flash memory is handled by the Memory Technology Device subsystem, or MTD, which provides you with basic interfaces to read, erase, and write blocks of flash memory. In the case of NAND flash, there are also functions that handle the OOB area and are used to identify bad blocks.
For managed flash, you need drivers to handle a particular hardware interface. MMC/SD cards and eMMC use the mmcblk
driver, while CompactFlash and hard drives use the SCSI disk driver, sd
. USB flash drives use the usb_storage
driver, together with the sd
driver.
Memory technology devices
The MTD subsystem was started by David Woodhouse in 1999 and has been extensively developed over the intervening years. In this section, I will concentrate on the way it handles the two main technologies, NOR and NAND flash.
MTD consists of three layers: a core set of functions, a set of drivers for various types of chips, and user-level drivers that present the...