📄 mtdnand.tmpl
字号:
<entry>reserved</entry></row><row><entry>0x05</entry><entry>Bad block marker</entry><entry>If any bit in this byte is zero, then this block is bad.This applies only to the first page in a block. In the remainingpages this byte is reserved</entry></row><row><entry>0x06</entry><entry>ECC byte 4</entry><entry>Error correction code byte 1 of the upper 256 Bytes of datain this page</entry></row><row><entry>0x07</entry><entry>ECC byte 5</entry><entry>Error correction code byte 2 of the upper 256 Bytes of datain this page</entry></row><row><entry>0x08 - 0x0F</entry><entry>Autoplace 0 - 7</entry><entry></entry></row></tbody></tgroup></informaltable> </sect2> <sect2> <title>2048 byte pagesize</title><informaltable><tgroup cols="3"><tbody><row><entry>Offset</entry><entry>Content</entry><entry>Comment</entry></row><row><entry>0x00</entry><entry>Bad block marker</entry><entry>If any bit in this byte is zero, then this block is bad.This applies only to the first page in a block. In the remainingpages this byte is reserved</entry></row><row><entry>0x01</entry><entry>Reserved</entry><entry>Reserved</entry></row><row><entry>0x02-0x27</entry><entry>Autoplace 0 - 37</entry><entry></entry></row><row><entry>0x28</entry><entry>ECC byte 0</entry><entry>Error correction code byte 0 of the first 256 Byte data inthis page</entry></row><row><entry>0x29</entry><entry>ECC byte 1</entry><entry>Error correction code byte 1 of the first 256 Bytes of datain this page</entry></row><row><entry>0x2A</entry><entry>ECC byte 2</entry><entry>Error correction code byte 2 of the first 256 Bytes data inthis page</entry></row><row><entry>0x2B</entry><entry>ECC byte 3</entry><entry>Error correction code byte 0 of the second 256 Bytes of datain this page</entry></row><row><entry>0x2C</entry><entry>ECC byte 4</entry><entry>Error correction code byte 1 of the second 256 Bytes of datain this page</entry></row><row><entry>0x2D</entry><entry>ECC byte 5</entry><entry>Error correction code byte 2 of the second 256 Bytes of datain this page</entry></row><row><entry>0x2E</entry><entry>ECC byte 6</entry><entry>Error correction code byte 0 of the third 256 Bytes of datain this page</entry></row><row><entry>0x2F</entry><entry>ECC byte 7</entry><entry>Error correction code byte 1 of the third 256 Bytes of datain this page</entry></row><row><entry>0x30</entry><entry>ECC byte 8</entry><entry>Error correction code byte 2 of the third 256 Bytes of datain this page</entry></row><row><entry>0x31</entry><entry>ECC byte 9</entry><entry>Error correction code byte 0 of the fourth 256 Bytes of datain this page</entry></row><row><entry>0x32</entry><entry>ECC byte 10</entry><entry>Error correction code byte 1 of the fourth 256 Bytes of datain this page</entry></row><row><entry>0x33</entry><entry>ECC byte 11</entry><entry>Error correction code byte 2 of the fourth 256 Bytes of datain this page</entry></row><row><entry>0x34</entry><entry>ECC byte 12</entry><entry>Error correction code byte 0 of the fifth 256 Bytes of datain this page</entry></row><row><entry>0x35</entry><entry>ECC byte 13</entry><entry>Error correction code byte 1 of the fifth 256 Bytes of datain this page</entry></row><row><entry>0x36</entry><entry>ECC byte 14</entry><entry>Error correction code byte 2 of the fifth 256 Bytes of datain this page</entry></row><row><entry>0x37</entry><entry>ECC byte 15</entry><entry>Error correction code byte 0 of the sixt 256 Bytes of datain this page</entry></row><row><entry>0x38</entry><entry>ECC byte 16</entry><entry>Error correction code byte 1 of the sixt 256 Bytes of datain this page</entry></row><row><entry>0x39</entry><entry>ECC byte 17</entry><entry>Error correction code byte 2 of the sixt 256 Bytes of datain this page</entry></row><row><entry>0x3A</entry><entry>ECC byte 18</entry><entry>Error correction code byte 0 of the seventh 256 Bytes ofdata in this page</entry></row><row><entry>0x3B</entry><entry>ECC byte 19</entry><entry>Error correction code byte 1 of the seventh 256 Bytes ofdata in this page</entry></row><row><entry>0x3C</entry><entry>ECC byte 20</entry><entry>Error correction code byte 2 of the seventh 256 Bytes ofdata in this page</entry></row><row><entry>0x3D</entry><entry>ECC byte 21</entry><entry>Error correction code byte 0 of the eigth 256 Bytes of datain this page</entry></row><row><entry>0x3E</entry><entry>ECC byte 22</entry><entry>Error correction code byte 1 of the eigth 256 Bytes of datain this page</entry></row><row><entry>0x3F</entry><entry>ECC byte 23</entry><entry>Error correction code byte 2 of the eigth 256 Bytes of datain this page</entry></row></tbody></tgroup></informaltable> </sect2> </sect1> </chapter> <chapter id="filesystems"> <title>Filesystem support</title> <para> The NAND driver provides all neccecary functions for a filesystem via the MTD interface. </para> <para> Filesystems must be aware of the NAND pecularities and restrictions. One major restrictions of NAND Flash is, that you cannot write as often as you want to a page. The consecutive writes to a page, before erasing it again, are restricted to 1-3 writes, depending on the manufacturers specifications. This applies similar to the spare area. </para> <para> Therefor NAND aware filesystems must either write in page size chunks or hold a writebuffer to collect smaller writes until they sum up to pagesize. Available NAND aware filesystems: JFFS2, YAFFS. </para> <para> The spare area usage to store filesystem data is controlled by the spare area placement functionality which is described in one of the earlier chapters. </para> </chapter> <chapter id="tools"> <title>Tools</title> <para> The MTD project provides a couple of helpful tools to handle NAND Flash. <itemizedlist> <listitem><para>flasherase, flasheraseall: Erase and format FLASH partitions</para></listitem> <listitem><para>nandwrite: write filesystem images to NAND FLASH</para></listitem> <listitem><para>nanddump: dump the contents of a NAND FLASH partitions</para></listitem> </itemizedlist> </para> <para> These tools are aware of the NAND restrictions. Please use those tools instead of complaining about errors which are caused by non NAND aware access methods. </para> </chapter> <chapter id="defines"> <title>Constants</title> <para> This chapter describes the constants which might be relevant for a driver developer. </para> <sect1> <title>Chip option constants</title> <sect2> <title>Constants for chip id table</title> <para> These constants are defined in nand.h. They are ored together to describe the chip functionality. <programlisting>/* Chip can not auto increment pages */#define NAND_NO_AUTOINCR 0x00000001/* Buswitdh is 16 bit */#define NAND_BUSWIDTH_16 0x00000002/* Device supports partial programming without padding */#define NAND_NO_PADDING 0x00000004/* Chip has cache program function */#define NAND_CACHEPRG 0x00000008/* Chip has copy back function */#define NAND_COPYBACK 0x00000010/* AND Chip which has 4 banks and a confusing page / block * assignment. See Renesas datasheet for further information */#define NAND_IS_AND 0x00000020/* Chip has a array of 4 pages which can be read without * additional ready /busy waits */#define NAND_4PAGE_ARRAY 0x00000040 </programlisting> </para> </sect2> <sect2> <title>Constants for runtime options</title> <para> These constants are defined in nand.h. They are ored together to describe the functionality. <programlisting>/* Use a flash based bad block table. This option is parsed by the * default bad block table function (nand_default_bbt). */#define NAND_USE_FLASH_BBT 0x00010000/* The hw ecc generator provides a syndrome instead a ecc value on read * This can only work if we have the ecc bytes directly behind the * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */#define NAND_HWECC_SYNDROME 0x00020000 </programlisting> </para> </sect2> </sect1> <sect1> <title>ECC selection constants</title> <para> Use these constants to select the ECC algorithm. <programlisting>/* No ECC. Usage is not recommended ! */#define NAND_ECC_NONE 0/* Software ECC 3 byte ECC per 256 Byte data */#define NAND_ECC_SOFT 1/* Hardware ECC 3 byte ECC per 256 Byte data */#define NAND_ECC_HW3_256 2/* Hardware ECC 3 byte ECC per 512 Byte data */#define NAND_ECC_HW3_512 3/* Hardware ECC 6 byte ECC per 512 Byte data */#define NAND_ECC_HW6_512 4/* Hardware ECC 6 byte ECC per 512 Byte data */#define NAND_ECC_HW8_512 6 </programlisting> </para> </sect1> <sect1> <title>Hardware control related constants</title> <para> These constants describe the requested hardware access function when the boardspecific hardware control function is called <programlisting>/* Select the chip by setting nCE to low */#define NAND_CTL_SETNCE 1/* Deselect the chip by setting nCE to high */#define NAND_CTL_CLRNCE 2/* Select the command latch by setting CLE to high */#define NAND_CTL_SETCLE 3/* Deselect the command latch by setting CLE to low */#define NAND_CTL_CLRCLE 4/* Select the address latch by setting ALE to high */#define NAND_CTL_SETALE 5/* Deselect the address latch by setting ALE to low */#define NAND_CTL_CLRALE 6/* Set write protection by setting WP to high. Not used! */#define NAND_CTL_SETWP 7/* Clear write protection by setting WP to low. Not used! */#define NAND_CTL_CLRWP 8 </programlisting> </para> </sect1> <sect1> <title>Bad block table related constants</title> <para> These constants describe the options used for bad block table descriptors. <programlisting>/* Options for the bad block table descriptors *//* The number of bits used per block in the bbt on the device */#define NAND_BBT_NRBITS_MSK 0x0000000F#define NAND_BBT_1BIT 0x00000001#define NAND_BBT_2BIT 0x00000002#define NAND_BBT_4BIT 0x00000004#define NAND_BBT_8BIT 0x00000008/* The bad block table is in the last good block of the device */#define NAND_BBT_LASTBLOCK 0x00000010/* The bbt is at the given page, else we must scan for the bbt */#define NAND_BBT_ABSPAGE 0x00000020/* The bbt is at the given page, else we must scan for the bbt */#define NAND_BBT_SEARCH 0x00000040/* bbt is stored per chip on multichip devices */#define NAND_BBT_PERCHIP 0x00000080/* bbt has a version counter at offset veroffs */#define NAND_BBT_VERSION 0x00000100/* Create a bbt if none axists */#define NAND_BBT_CREATE 0x00000200/* Search good / bad pattern through all pages of a block */#define NAND_BBT_SCANALLPAGES 0x00000400/* Scan block empty during good / bad block scan */#define NAND_BBT_SCANEMPTY 0x00000800/* Write bbt if neccecary */#define NAND_BBT_WRITE 0x00001000/* Read and write back block contents when writing bbt */#define NAND_BBT_SAVECONTENT 0x00002000 </programlisting> </para> </sect1> </chapter> <chapter id="structs"> <title>Structures</title> <para> This chapter contains the autogenerated documentation of the structures which are used in the NAND driver and might be relevant for a driver developer. Each struct member has a short description which is marked with an [XXX] identifier. See the chapter "Documentation hints" for an explanation. </para>!Iinclude/linux/mtd/nand.h </chapter> <chapter id="pubfunctions"> <title>Public Functions Provided</title> <para> This chapter contains the autogenerated documentation of the NAND kernel API functions which are exported. Each function has a short description which is marked with an [XXX] identifier. See the chapter "Documentation hints" for an explanation. </para>!Edrivers/mtd/nand/nand_base.c!Edrivers/mtd/nand/nand_bbt.c!Edrivers/mtd/nand/nand_ecc.c </chapter> <chapter id="intfunctions"> <title>Internal Functions Provided</title> <para> This chapter contains the autogenerated documentation of the NAND driver internal functions. Each function has a short description which is marked with an [XXX] identifier. See the chapter "Documentation hints" for an explanation. The functions marked with [DEFAULT] might be relevant for a board driver developer. </para>!Idrivers/mtd/nand/nand_base.c!Idrivers/mtd/nand/nand_bbt.c<!-- No internal functions for kernel-doc:X!Idrivers/mtd/nand/nand_ecc.c--> </chapter> <chapter id="credits"> <title>Credits</title> <para> The following people have contributed to the NAND driver: <orderedlist> <listitem><para>Steven J. Hill<email>sjhill@realitydiluted.com</email></para></listitem> <listitem><para>David Woodhouse<email>dwmw2@infradead.org</email></para></listitem> <listitem><para>Thomas Gleixner<email>tglx@linutronix.de</email></para></listitem> </orderedlist> A lot of users have provided bugfixes, improvements and helping hands for testing. Thanks a lot. </para> <para> The following people have contributed to this document: <orderedlist> <listitem><para>Thomas Gleixner<email>tglx@linutronix.de</email></para></listitem> </orderedlist> </para> </chapter></book>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -