Sophie

Sophie

distrib > CentOS > 6 > i386 > by-pkgid > 2c51d8eb79f8810ada971ee8c30ce1e5 > files > 2782

kernel-doc-2.6.32-71.14.1.el6.noarch.rpm

<?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>Chapter&#160;5.&#160;Advanced board driver functions</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="up" href="index.html" title="MTD NAND Driver Programming Interface" /><link rel="prev" href="ch04s06.html" title="Exit function" /><link rel="next" href="ch05s02.html" title="Hardware ECC support" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&#160;5.&#160;Advanced board driver functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s06.html">Prev</a>&#160;</td><th width="60%" align="center">&#160;</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch05s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter&#160;5.&#160;Advanced board driver functions"><div class="titlepage"><div><div><h2 class="title"><a id="boarddriversadvanced"></a>Chapter&#160;5.&#160;Advanced board driver functions</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><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></div><p>
		This chapter describes the advanced functionality of the NAND
		driver. For a list of functions which can be overridden by the board
		driver see the documentation of the nand_chip structure.
	</p><div class="sect1" title="Multiple chip control"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Multiple_chip_control"></a>Multiple chip control</h2></div></div></div><p>
			The nand driver can control chip arrays. Therefor the
			board driver must provide an own select_chip function. This
			function must (de)select the requested chip.
			The function pointer in the nand_chip structure must
			be set before calling nand_scan(). The maxchip parameter
			of nand_scan() defines the maximum number of chips to
			scan for. Make sure that the select_chip function can
			handle the requested number of chips.
		</p><p>
			The nand driver concatenates the chips to one virtual
			chip and provides this virtual chip to the MTD layer.
		</p><p>
			<span class="emphasis"><em>Note: The driver can only handle linear chip arrays
			of equally sized chips. There is no support for
			parallel arrays which extend the buswidth.</em></span>
		</p><p>
			<span class="emphasis"><em>GPIO based example</em></span>
		</p><pre class="programlisting">
static void board_select_chip (struct mtd_info *mtd, int chip)
{
	/* Deselect all chips, set all nCE pins high */
	GPIO(BOARD_NAND_NCE) |= 0xff;	
	if (chip &gt;= 0)
		GPIO(BOARD_NAND_NCE) &amp;= ~ (1 &lt;&lt; chip);
}
		</pre><p>
			<span class="emphasis"><em>Address lines based example.</em></span>
			Its assumed that the nCE pins are connected to an
			address decoder.
		</p><pre class="programlisting">
static void board_select_chip (struct mtd_info *mtd, int chip)
{
	struct nand_chip *this = (struct nand_chip *) mtd-&gt;priv;
	
	/* Deselect all chips */
	this-&gt;IO_ADDR_R &amp;= ~BOARD_NAND_ADDR_MASK;
	this-&gt;IO_ADDR_W &amp;= ~BOARD_NAND_ADDR_MASK;
	switch (chip) {
	case 0:
		this-&gt;IO_ADDR_R |= BOARD_NAND_ADDR_CHIP0;
		this-&gt;IO_ADDR_W |= BOARD_NAND_ADDR_CHIP0;
		break;
	....	
	case n:
		this-&gt;IO_ADDR_R |= BOARD_NAND_ADDR_CHIPn;
		this-&gt;IO_ADDR_W |= BOARD_NAND_ADDR_CHIPn;
		break;
	}	
}
		</pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s06.html">Prev</a>&#160;</td><td width="20%" align="center">&#160;</td><td width="40%" align="right">&#160;<a accesskey="n" href="ch05s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Exit function&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Hardware ECC support</td></tr></table></div></body></html>