MTD NAND Driver Programming Interface

Thomas Gleixner


Table of Contents
Known Bugs And Assumptions
Documentation hints
Function identifiers [XXX]
Struct member identifiers [XXX]
Basic board driver
Basic defines
Partition defines
Hardware control function
Device ready function
Init function
Exit function
Advanced board driver functions
Multiple chip control
Hardware ECC support
Functions and constants
Hardware ECC with syndrome calculation
Bad block table support
Flash based tables
User defined tables
Spare area (auto)placement
Placement defined by fs driver
Automatic placement
User space placement selection
Spare area autoplacement default schemes
256 byte pagesize
512 byte pagesize
2048 byte pagesize
Filesystem support
Chip option constants
Constants for chip id table
Constants for runtime options
ECC selection constants
Hardware control related constants
Bad block table related constants
struct nand_hw_control --  Control structure for hardware controller (e.g ECC generator) shared among independend devices
struct nand_chip --  NAND Private Flash Chip Data
struct nand_flash_dev --  NAND Flash Device ID Structure
struct nand_manufacturers --  NAND Flash Manufacturer ID Structure
struct nand_bbt_descr --  bad block table descriptor
Public Functions Provided
nand_scan --  [NAND Interface] Scan for the NAND device
nand_release --  [NAND Interface] Free resources held by the NAND device
nand_scan_bbt --  [NAND Interface] scan, find, read and maybe create bad block table(s)
nand_default_bbt --  [NAND Interface] Select a default bad block table for the device
nand_calculate_ecc --  [NAND Interface] Calculate 3 byte ECC code for 256 byte block
nand_correct_data --  [NAND Interface] Detect and correct bit error(s)
Internal Functions Provided
nand_release_device --  [GENERIC] release chip
nand_read_byte --  [DEFAULT] read one byte from the chip
nand_write_byte --  [DEFAULT] write one byte to the chip
nand_read_byte16 --  [DEFAULT] read one byte endianess aware from the chip
nand_write_byte16 --  [DEFAULT] write one byte endianess aware to the chip
nand_read_word --  [DEFAULT] read one word from the chip
nand_write_word --  [DEFAULT] write one word to the chip
nand_select_chip --  [DEFAULT] control CE line
nand_write_buf --  [DEFAULT] write buffer to chip
nand_read_buf --  [DEFAULT] read chip data into buffer
nand_verify_buf --  [DEFAULT] Verify chip data against buffer
nand_write_buf16 --  [DEFAULT] write buffer to chip
nand_read_buf16 --  [DEFAULT] read chip data into buffer
nand_verify_buf16 --  [DEFAULT] Verify chip data against buffer
nand_block_bad --  [DEFAULT] Read bad block marker from the chip
nand_default_block_markbad --  [DEFAULT] mark a block bad
nand_check_wp --  [GENERIC] check if the chip is write protected
nand_block_checkbad --  [GENERIC] Check if a block is marked bad
nand_command --  [DEFAULT] Send command to NAND device
nand_command_lp --  [DEFAULT] Send command to NAND large page device
nand_get_device --  [GENERIC] Get chip for selected access
nand_wait --  [DEFAULT] wait until the command is done
nand_write_page --  [GENERIC] write one page
nand_verify_pages --  [GENERIC] verify the chip contents after a write
nand_read --  [MTD Interface] MTD compability function for nand_do_read_ecc
nand_read_ecc --  [MTD Interface] MTD compability function for nand_do_read_ecc
nand_do_read_ecc --  [MTD Interface] Read data with ECC
nand_read_oob --  [MTD Interface] NAND read out-of-band
nand_read_raw --  [GENERIC] Read raw data including oob into buffer
nand_prepare_oobbuf --  [GENERIC] Prepare the out of band buffer
nand_write --  [MTD Interface] compability function for nand_write_ecc
nand_write_ecc --  [MTD Interface] NAND write with ECC
nand_write_oob --  [MTD Interface] NAND write out-of-band
nand_writev --  [MTD Interface] compabilty function for nand_writev_ecc
nand_writev_ecc --  [MTD Interface] write with iovec with ecc
single_erase_cmd --  [GENERIC] NAND standard block erase command function
multi_erase_cmd --  [GENERIC] AND specific block erase command function
nand_erase --  [MTD Interface] erase block(s)
nand_erase_nand --  [NAND Interface] erase block(s)
nand_sync --  [MTD Interface] sync
nand_block_isbad --  [MTD Interface] Check whether the block at the given offset is bad
nand_block_markbad --  [MTD Interface] Mark the block at the given offset as bad
check_pattern --  [GENERIC] check if a pattern is in the buffer
read_bbt --  [GENERIC] Read the bad block table starting from page
read_abs_bbt --  [GENERIC] Read the bad block table starting at a given page
read_abs_bbts --  [GENERIC] Read the bad block table(s) for all chips starting at a given page
create_bbt --  [GENERIC] Create a bad block table by scanning the device
search_bbt --  [GENERIC] scan the device for a specific bad block table
search_read_bbts --  [GENERIC] scan the device for bad block table(s)
write_bbt --  [GENERIC] (Re)write the bad block table
nand_memory_bbt --  [GENERIC] create a memory based bad block table
check_create --  [GENERIC] create and write bbt(s) if neccecary
mark_bbt_region --  [GENERIC] mark the bad block table regions
nand_update_bbt --  [NAND Interface] update bad block table(s)
nand_isbad_bbt --  [NAND Interface] Check if a block is bad
nand_trans_result --  [GENERIC] create non-inverted ECC