[B]HOWTO implement NAND support[/B]
[B]Where can you get the code ?[/B]
The latest changes to JFFS2 and the underlying NAND code are not in the kernel code at the moment. The latest code is available from [URL="http://www.linux-mtd.infradead.org"]CVS and daily snapshots[/URL]
There are four layers of software
[LIST=1]
[*]JFFS2: filesystem driver
[*]MTD: Memory Technology Devices driver
[*]NAND: generic NAND driver
[*]Hardware specific driver
[/LIST]
the MTD driver just provides a mount point for JFFS2. The generic NAND driver provides all functions, which are neccecary to identify,
read, write and erase NAND Flash. [COLOR=#ff0000]The hardware dependend functions are provided by the hardware driver. They provide mainly the hardware access informations and functions for the generic NAND driver. For YAFFS applies the same.[/COLOR]
[B]API Documentation[/B]
A complete API documentation is available as DocBook template in the Documentation/DocBook directory of the MTD source tree.
Read the API documentation [B]Link ist nicht mehr aktiv.[/B]
[B]Supported chips[/B]
Most NAND chips actually available should be supported by the current code. If you have a chip, which is not supported, you can easily add it by extending the chiplist in drivers/mtd/nand/nand_ids.c. The chip name does not longer contain cryptic part numbers, as the device ID is just an information about size, erase block size, pagesize and operating voltage. Add an entry, which contains following information:
{ name, id, pagesize, chipsize, erasesize, options }
[TABLE]
[TR]
[TD][B]ref[/B][/TD]
[TD][B]comment[/B][/TD]
[/TR]
[TR]
[TD]name[/TD]
[TD]string: "NAND 'size' 'voltage' 'bus-width'"[/TD]
[/TR]
[TR]
[TD]id[/TD]
[TD]chip device code. This code is read during nand_scan. Check datasheet for the code of your chip[/TD]
[/TR]
[TR]
[TD]pagesize[/TD]
[TD]Page size (0,256,512). 0 indicates that the pagesize can be read out from the chip in the [COLOR=#ff0000]extended ID[/COLOR][/TD]
[/TR]
[TR]
[TD]chipsize[/TD]
[TD]The total size of the chip in MiB[/TD]
[/TR]
[TR]
[TD]erasesize[/TD]
[TD]the erasesize of your chip in bytes. 0 for chips with [COLOR=#ff0000]extended ID[/COLOR][/TD]
[/TR]
[TR]
[TD]options[/TD]
[TD]Options. Bitfield to enable chip specific options. See nand.h[/TD]
[/TR]
[/TABLE]
Please contact NAND driver maintainer to include it in the public source tree.
Manufacturer codes are scanned during nand_scan too. If the code is one of the known codes in the manufacturer ID table, the name of the manufacturer is printed out, else "Unknown" is printed. This happens when your hardware driver is loaded and calls nand_scan. Add codes, which are new and contact NAND driver maintainer to include it
[B]Config settings[/B]
The following config switches have to be set. JFFS2 on NAND [B]does not[/B] work, if one of these settings is missing.
CONFIG_MTD=y
CONFIG_MTD_PARTITIONS=y
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_YOURBOARD=y
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_DEBUG=0
CONFIG_JFFS2_FS_NAND=y
Make sure that fs/Config.in contains the following lines:
dep_tristate 'Journalling Flash File System v2 (JFFS2) support' CONFIG_JFFS2_FS $CONFIG_MTD
if [ "$CONFIG_JFFS2_FS" = "y" -o "$CONFIG_JFFS2_FS" = "m" ] ; then
int 'JFFS2 debugging verbosity (0 = quiet, 2 = noisy)' CONFIG_JFFS2_FS_DEBUG 0
bool 'JFFS2 support for NAND chips' CONFIG_JFFS2_FS_NAND
fi