<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>MTD NAND Driver Programming Interface</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="MTD NAND Driver Programming Interface" /><link rel="next" href="ch01.html" title="Chapter 1. Introduction" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">MTD NAND Driver Programming Interface</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr></table><hr /></div><div class="book" title="MTD NAND Driver Programming Interface"><div class="titlepage"><div><div><h1 class="title"><a id="MTD-NAND-Guide"></a>MTD NAND Driver Programming Interface</h1></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Thomas</span> <span class="surname">Gleixner</span></h3><div class="affiliation"><div class="address"><p><br />       <code class="email"><<a class="email" href="mailto:tglx@linutronix.de">tglx@linutronix.de</a>></code><br />      </p></div></div></div></div></div><div><p class="copyright">Copyright © 2004 Thomas Gleixner</p></div><div><div class="legalnotice" title="Legal Notice"><a id="id2995220"></a><p> This documentation is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. </p><p> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </p><p> You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA </p><p> For more details see the file COPYING in the source distribution of Linux. </p></div></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="ch01.html">1. Introduction</a></span></dt><dt><span class="chapter"><a href="ch02.html">2. Known Bugs And Assumptions</a></span></dt><dt><span class="chapter"><a href="ch03.html">3. Documentation hints</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch03.html#Function_identifiers_XXX">Function identifiers [XXX]</a></span></dt><dt><span class="sect1"><a href="ch03s02.html">Struct member identifiers [XXX]</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch04.html">4. Basic board driver</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch04.html#Basic_defines">Basic defines</a></span></dt><dt><span class="sect1"><a href="ch04s02.html">Partition defines</a></span></dt><dt><span class="sect1"><a href="ch04s03.html">Hardware control function</a></span></dt><dt><span class="sect1"><a href="ch04s04.html">Device ready function</a></span></dt><dt><span class="sect1"><a href="ch04s05.html">Init function</a></span></dt><dt><span class="sect1"><a href="ch04s06.html">Exit function</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch05.html">5. Advanced board driver functions</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch05.html#Multiple_chip_control">Multiple chip control</a></span></dt><dt><span class="sect1"><a href="ch05s02.html">Hardware ECC support</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch05s02.html#Functions_and_constants">Functions and constants</a></span></dt><dt><span class="sect2"><a href="ch05s02.html#Hardware_ECC_with_syndrome_calculation">Hardware ECC with syndrome calculation</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch05s03.html">Bad block table support</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch05s03.html#Flash_based_tables">Flash based tables</a></span></dt><dt><span class="sect2"><a href="ch05s03.html#User_defined_tables">User defined tables</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch05s04.html">Spare area (auto)placement</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch05s04.html#Placement_defined_by_fs_driver">Placement defined by fs driver</a></span></dt><dt><span class="sect2"><a href="ch05s04.html#Automatic_placement">Automatic placement</a></span></dt><dt><span class="sect2"><a href="ch05s04.html#User_space_placement_selection">User space placement selection</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch05s05.html">Spare area autoplacement default schemes</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch05s05.html#pagesize_256">256 byte pagesize</a></span></dt><dt><span class="sect2"><a href="ch05s05.html#pagesize_512">512 byte pagesize</a></span></dt><dt><span class="sect2"><a href="ch05s05.html#pagesize_2048">2048 byte pagesize</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="ch06.html">6. Filesystem support</a></span></dt><dt><span class="chapter"><a href="ch07.html">7. Tools</a></span></dt><dt><span class="chapter"><a href="ch08.html">8. Constants</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch08.html#Chip_option_constants">Chip option constants</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch08.html#Constants_for_chip_id_table">Constants for chip id table</a></span></dt><dt><span class="sect2"><a href="ch08.html#Constants_for_runtime_options">Constants for runtime options</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch08s02.html">ECC selection constants</a></span></dt><dt><span class="sect1"><a href="ch08s03.html">Hardware control related constants</a></span></dt><dt><span class="sect1"><a href="ch08s04.html">Bad block table related constants</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch09.html">9. Structures</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="re01.html"><span>struct nand_hw_control</span></a></span><span class="refpurpose"> — Control structure for hardware controller (e.g ECC generator) shared among independent devices </span></dt><dt><span class="refentrytitle"><a href="re02.html"><span>struct nand_ecc_ctrl</span></a></span><span class="refpurpose"> — Control structure for ecc </span></dt><dt><span class="refentrytitle"><a href="re03.html"><span>struct nand_buffers</span></a></span><span class="refpurpose"> — buffer structure for read/write </span></dt><dt><span class="refentrytitle"><a href="re04.html"><span>struct nand_chip</span></a></span><span class="refpurpose"> — NAND Private Flash Chip Data </span></dt><dt><span class="refentrytitle"><a href="re05.html"><span>struct nand_flash_dev</span></a></span><span class="refpurpose"> — NAND Flash Device ID Structure </span></dt><dt><span class="refentrytitle"><a href="re06.html"><span>struct nand_manufacturers</span></a></span><span class="refpurpose"> — NAND Flash Manufacturer ID Structure </span></dt><dt><span class="refentrytitle"><a href="re07.html"><span>struct nand_bbt_descr</span></a></span><span class="refpurpose"> — bad block table descriptor </span></dt><dt><span class="refentrytitle"><a href="re08.html"><span>struct platform_nand_chip</span></a></span><span class="refpurpose"> — chip level device structure </span></dt><dt><span class="refentrytitle"><a href="re09.html"><span>struct platform_nand_ctrl</span></a></span><span class="refpurpose"> — controller level device structure </span></dt><dt><span class="refentrytitle"><a href="re10.html"><span>struct platform_nand_data</span></a></span><span class="refpurpose"> — container structure for platform-specific data </span></dt></dl></dd><dt><span class="chapter"><a href="ch10.html">10. Public Functions Provided</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="re11.html"><span>nand_scan_ident</span></a></span><span class="refpurpose"> — [NAND Interface] Scan for the NAND device </span></dt><dt><span class="refentrytitle"><a href="re12.html"><span>nand_scan_tail</span></a></span><span class="refpurpose"> — [NAND Interface] Scan for the NAND device </span></dt><dt><span class="refentrytitle"><a href="re13.html"><span>nand_scan</span></a></span><span class="refpurpose"> — [NAND Interface] Scan for the NAND device </span></dt><dt><span class="refentrytitle"><a href="re14.html"><span>nand_release</span></a></span><span class="refpurpose"> — [NAND Interface] Free resources held by the NAND device </span></dt><dt><span class="refentrytitle"><a href="re15.html"><span>nand_scan_bbt</span></a></span><span class="refpurpose"> — [NAND Interface] scan, find, read and maybe create bad block table(s) </span></dt><dt><span class="refentrytitle"><a href="re16.html"><span>nand_default_bbt</span></a></span><span class="refpurpose"> — [NAND Interface] Select a default bad block table for the device </span></dt><dt><span class="refentrytitle"><a href="re17.html"><span>nand_calculate_ecc</span></a></span><span class="refpurpose"> — [NAND Interface] Calculate 3-byte ECC for 256/512-byte block </span></dt><dt><span class="refentrytitle"><a href="re18.html"><span>__nand_correct_data</span></a></span><span class="refpurpose"> — [NAND Interface] Detect and correct bit error(s) </span></dt><dt><span class="refentrytitle"><a href="re19.html"><span>nand_correct_data</span></a></span><span class="refpurpose"> — [NAND Interface] Detect and correct bit error(s) </span></dt></dl></dd><dt><span class="chapter"><a href="ch11.html">11. Internal Functions Provided</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="re20.html"><span>nand_release_device</span></a></span><span class="refpurpose"> — [GENERIC] release chip </span></dt><dt><span class="refentrytitle"><a href="re21.html"><span>nand_read_byte</span></a></span><span class="refpurpose"> — [DEFAULT] read one byte from the chip </span></dt><dt><span class="refentrytitle"><a href="re22.html"><span>nand_read_byte16</span></a></span><span class="refpurpose"> — [DEFAULT] read one byte endianess aware from the chip </span></dt><dt><span class="refentrytitle"><a href="re23.html"><span>nand_read_word</span></a></span><span class="refpurpose"> — [DEFAULT] read one word from the chip </span></dt><dt><span class="refentrytitle"><a href="re24.html"><span>nand_select_chip</span></a></span><span class="refpurpose"> — [DEFAULT] control CE line </span></dt><dt><span class="refentrytitle"><a href="re25.html"><span>nand_write_buf</span></a></span><span class="refpurpose"> — [DEFAULT] write buffer to chip </span></dt><dt><span class="refentrytitle"><a href="re26.html"><span>nand_read_buf</span></a></span><span class="refpurpose"> — [DEFAULT] read chip data into buffer </span></dt><dt><span class="refentrytitle"><a href="re27.html"><span>nand_verify_buf</span></a></span><span class="refpurpose"> — [DEFAULT] Verify chip data against buffer </span></dt><dt><span class="refentrytitle"><a href="re28.html"><span>nand_write_buf16</span></a></span><span class="refpurpose"> — [DEFAULT] write buffer to chip </span></dt><dt><span class="refentrytitle"><a href="re29.html"><span>nand_read_buf16</span></a></span><span class="refpurpose"> — [DEFAULT] read chip data into buffer </span></dt><dt><span class="refentrytitle"><a href="re30.html"><span>nand_verify_buf16</span></a></span><span class="refpurpose"> — [DEFAULT] Verify chip data against buffer </span></dt><dt><span class="refentrytitle"><a href="re31.html"><span>nand_block_bad</span></a></span><span class="refpurpose"> — [DEFAULT] Read bad block marker from the chip </span></dt><dt><span class="refentrytitle"><a href="re32.html"><span>nand_default_block_markbad</span></a></span><span class="refpurpose"> — [DEFAULT] mark a block bad </span></dt><dt><span class="refentrytitle"><a href="re33.html"><span>nand_check_wp</span></a></span><span class="refpurpose"> — [GENERIC] check if the chip is write protected </span></dt><dt><span class="refentrytitle"><a href="re34.html"><span>nand_block_checkbad</span></a></span><span class="refpurpose"> — [GENERIC] Check if a block is marked bad </span></dt><dt><span class="refentrytitle"><a href="re35.html"><span>nand_command</span></a></span><span class="refpurpose"> — [DEFAULT] Send command to NAND device </span></dt><dt><span class="refentrytitle"><a href="re36.html"><span>nand_command_lp</span></a></span><span class="refpurpose"> — [DEFAULT] Send command to NAND large page device </span></dt><dt><span class="refentrytitle"><a href="re37.html"><span>nand_get_device</span></a></span><span class="refpurpose"> — [GENERIC] Get chip for selected access </span></dt><dt><span class="refentrytitle"><a href="re38.html"><span>nand_wait</span></a></span><span class="refpurpose"> — [DEFAULT] wait until the command is done </span></dt><dt><span class="refentrytitle"><a href="re39.html"><span>nand_read_page_raw</span></a></span><span class="refpurpose"> — [Intern] read raw page data without ecc </span></dt><dt><span class="refentrytitle"><a href="re40.html"><span>nand_read_page_raw_syndrome</span></a></span><span class="refpurpose"> — [Intern] read raw page data without ecc </span></dt><dt><span class="refentrytitle"><a href="re41.html"><span>nand_read_page_swecc</span></a></span><span class="refpurpose"> — [REPLACABLE] software ecc based page read function </span></dt><dt><span class="refentrytitle"><a href="re42.html"><span>nand_read_subpage</span></a></span><span class="refpurpose"> — [REPLACABLE] software ecc based sub-page read function </span></dt><dt><span class="refentrytitle"><a href="re43.html"><span>nand_read_page_hwecc</span></a></span><span class="refpurpose"> — [REPLACABLE] hardware ecc based page read function </span></dt><dt><span class="refentrytitle"><a href="re44.html"><span>nand_read_page_hwecc_oob_first</span></a></span><span class="refpurpose"> — [REPLACABLE] hw ecc, read oob first </span></dt><dt><span class="refentrytitle"><a href="re45.html"><span>nand_read_page_syndrome</span></a></span><span class="refpurpose"> — [REPLACABLE] hardware ecc syndrom based page read </span></dt><dt><span class="refentrytitle"><a href="re46.html"><span>nand_transfer_oob</span></a></span><span class="refpurpose"> — [Internal] Transfer oob to client buffer </span></dt><dt><span class="refentrytitle"><a href="re47.html"><span>nand_do_read_ops</span></a></span><span class="refpurpose"> — [Internal] Read data with ECC </span></dt><dt><span class="refentrytitle"><a href="re48.html"><span>nand_read</span></a></span><span class="refpurpose"> — [MTD Interface] MTD compability function for nand_do_read_ecc </span></dt><dt><span class="refentrytitle"><a href="re49.html"><span>nand_read_oob_std</span></a></span><span class="refpurpose"> — [REPLACABLE] the most common OOB data read function </span></dt><dt><span class="refentrytitle"><a href="re50.html"><span>nand_read_oob_syndrome</span></a></span><span class="refpurpose"> — [REPLACABLE] OOB data read function for HW ECC with syndromes </span></dt><dt><span class="refentrytitle"><a href="re51.html"><span>nand_write_oob_std</span></a></span><span class="refpurpose"> — [REPLACABLE] the most common OOB data write function </span></dt><dt><span class="refentrytitle"><a href="re52.html"><span>nand_write_oob_syndrome</span></a></span><span class="refpurpose"> — [REPLACABLE] OOB data write function for HW ECC with syndrome - only for large page flash ! </span></dt><dt><span class="refentrytitle"><a href="re53.html"><span>nand_do_read_oob</span></a></span><span class="refpurpose"> — [Intern] NAND read out-of-band </span></dt><dt><span class="refentrytitle"><a href="re54.html"><span>nand_read_oob</span></a></span><span class="refpurpose"> — [MTD Interface] NAND read data and/or out-of-band </span></dt><dt><span class="refentrytitle"><a href="re55.html"><span>nand_write_page_raw</span></a></span><span class="refpurpose"> — [Intern] raw page write function </span></dt><dt><span class="refentrytitle"><a href="re56.html"><span>nand_write_page_raw_syndrome</span></a></span><span class="refpurpose"> — [Intern] raw page write function </span></dt><dt><span class="refentrytitle"><a href="re57.html"><span>nand_write_page_swecc</span></a></span><span class="refpurpose"> — [REPLACABLE] software ecc based page write function </span></dt><dt><span class="refentrytitle"><a href="re58.html"><span>nand_write_page_hwecc</span></a></span><span class="refpurpose"> — [REPLACABLE] hardware ecc based page write function </span></dt><dt><span class="refentrytitle"><a href="re59.html"><span>nand_write_page_syndrome</span></a></span><span class="refpurpose"> — [REPLACABLE] hardware ecc syndrom based page write </span></dt><dt><span class="refentrytitle"><a href="re60.html"><span>nand_write_page</span></a></span><span class="refpurpose"> — [REPLACEABLE] write one page </span></dt><dt><span class="refentrytitle"><a href="re61.html"><span>nand_fill_oob</span></a></span><span class="refpurpose"> — [Internal] Transfer client buffer to oob </span></dt><dt><span class="refentrytitle"><a href="re62.html"><span>nand_do_write_ops</span></a></span><span class="refpurpose"> — [Internal] NAND write with ECC </span></dt><dt><span class="refentrytitle"><a href="re63.html"><span>nand_write</span></a></span><span class="refpurpose"> — [MTD Interface] NAND write with ECC </span></dt><dt><span class="refentrytitle"><a href="re64.html"><span>nand_do_write_oob</span></a></span><span class="refpurpose"> — [MTD Interface] NAND write out-of-band </span></dt><dt><span class="refentrytitle"><a href="re65.html"><span>nand_write_oob</span></a></span><span class="refpurpose"> — [MTD Interface] NAND write data and/or out-of-band </span></dt><dt><span class="refentrytitle"><a href="re66.html"><span>single_erase_cmd</span></a></span><span class="refpurpose"> — [GENERIC] NAND standard block erase command function </span></dt><dt><span class="refentrytitle"><a href="re67.html"><span>multi_erase_cmd</span></a></span><span class="refpurpose"> — [GENERIC] AND specific block erase command function </span></dt><dt><span class="refentrytitle"><a href="re68.html"><span>nand_erase</span></a></span><span class="refpurpose"> — [MTD Interface] erase block(s) </span></dt><dt><span class="refentrytitle"><a href="re69.html"><span>nand_erase_nand</span></a></span><span class="refpurpose"> — [Internal] erase block(s) </span></dt><dt><span class="refentrytitle"><a href="re70.html"><span>nand_sync</span></a></span><span class="refpurpose"> — [MTD Interface] sync </span></dt><dt><span class="refentrytitle"><a href="re71.html"><span>nand_block_isbad</span></a></span><span class="refpurpose"> — [MTD Interface] Check if block at offset is bad </span></dt><dt><span class="refentrytitle"><a href="re72.html"><span>nand_block_markbad</span></a></span><span class="refpurpose"> — [MTD Interface] Mark block at the given offset as bad </span></dt><dt><span class="refentrytitle"><a href="re73.html"><span>nand_suspend</span></a></span><span class="refpurpose"> — [MTD Interface] Suspend the NAND flash </span></dt><dt><span class="refentrytitle"><a href="re74.html"><span>nand_resume</span></a></span><span class="refpurpose"> — [MTD Interface] Resume the NAND flash </span></dt><dt><span class="refentrytitle"><a href="re75.html"><span>check_pattern</span></a></span><span class="refpurpose"> — [GENERIC] check if a pattern is in the buffer </span></dt><dt><span class="refentrytitle"><a href="re76.html"><span>check_short_pattern</span></a></span><span class="refpurpose"> — [GENERIC] check if a pattern is in the buffer </span></dt><dt><span class="refentrytitle"><a href="re77.html"><span>read_bbt</span></a></span><span class="refpurpose"> — [GENERIC] Read the bad block table starting from page </span></dt><dt><span class="refentrytitle"><a href="re78.html"><span>read_abs_bbt</span></a></span><span class="refpurpose"> — [GENERIC] Read the bad block table starting at a given page </span></dt><dt><span class="refentrytitle"><a href="re79.html"><span>read_abs_bbts</span></a></span><span class="refpurpose"> — [GENERIC] Read the bad block table(s) for all chips starting at a given page </span></dt><dt><span class="refentrytitle"><a href="re80.html"><span>create_bbt</span></a></span><span class="refpurpose"> — [GENERIC] Create a bad block table by scanning the device </span></dt><dt><span class="refentrytitle"><a href="re81.html"><span>search_bbt</span></a></span><span class="refpurpose"> — [GENERIC] scan the device for a specific bad block table </span></dt><dt><span class="refentrytitle"><a href="re82.html"><span>search_read_bbts</span></a></span><span class="refpurpose"> — [GENERIC] scan the device for bad block table(s) </span></dt><dt><span class="refentrytitle"><a href="re83.html"><span>write_bbt</span></a></span><span class="refpurpose"> — [GENERIC] (Re)write the bad block table </span></dt><dt><span class="refentrytitle"><a href="re84.html"><span>nand_memory_bbt</span></a></span><span class="refpurpose"> — [GENERIC] create a memory based bad block table </span></dt><dt><span class="refentrytitle"><a href="re85.html"><span>check_create</span></a></span><span class="refpurpose"> — [GENERIC] create and write bbt(s) if necessary </span></dt><dt><span class="refentrytitle"><a href="re86.html"><span>mark_bbt_region</span></a></span><span class="refpurpose"> — [GENERIC] mark the bad block table regions </span></dt><dt><span class="refentrytitle"><a href="re87.html"><span>nand_update_bbt</span></a></span><span class="refpurpose"> — [NAND Interface] update bad block table(s) </span></dt><dt><span class="refentrytitle"><a href="re88.html"><span>nand_isbad_bbt</span></a></span><span class="refpurpose"> — [NAND Interface] Check if a block is bad </span></dt></dl></dd><dt><span class="chapter"><a href="ch12.html">12. Credits</a></span></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. Introduction</td></tr></table></div></body></html>