This technote explains how to choose the correct MTD routine for your flash filesystem. Before you begin, you should first review the descriptions of all available MTD callouts for a flash driver. See "Building your flash filesystem driver" in Customizing the Flash Filesystem chapter of the Building Embedded Systems guide.
The MTD callouts are as follows:
Callout | Description |
---|---|
ident() | Identify the flash chip(s) |
reset() | Return flash to read state after an error |
read() | Read data from flash (if NULL, an internal memcpy() is used) |
write() | Write data to flash |
erase() | Erase a flash block (aka "unit") |
sync() | Poll for erase completion |
suspend() | Suspend an erase for a read/write operation (if supported) |
resume() | Resume a suspended erase after a read/write operation (if supported) |
islock() | Determine whether a block/unit is write protected |
lock() | Write-protect a block |
unlock() | Disable write protection |
unlockall() | Invoke a single command to unlock the whole chip (if supported) |
MTDv1 | MTDv2 |
---|---|
f3s_ident() | f3s_ident() |
f3s_reset() | f3s_reset() |
f3s_read() | f3s_v2read() |
f3s_write() | f3s_v2write() |
f3s_erase() | f3s_v2erase() |
f3s_sync() | f3s_v2sync() |
f3s_suspend() | f3s_v2suspend() |
f3s_resume() | f3s_v2resume() |
— | f3s_v2islock() |
— | f3s_v2lock() |
— | f3s_v2unlock() |
— | f3s_v2unlockall() |
Ideally, there should be a table that describes every combination of board and flash in existence, and tells you which callout to use. Since this is unrealistic, this technote focuses mainly on describing a general method for choosing the right combination of MTD callouts. You will need to: