1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="MTD-NAND-Guide">
6 <bookinfo>
7  <title>MTD NAND Driver Programming Interface</title>
8  
9  <authorgroup>
10   <author>
11    <firstname>Thomas</firstname>
12    <surname>Gleixner</surname>
13    <affiliation>
14     <address>
15      <email>tglx@linutronix.de</email>
16     </address>
17    </affiliation>
18   </author>
19  </authorgroup>
20
21  <copyright>
22   <year>2004</year>
23   <holder>Thomas Gleixner</holder>
24  </copyright>
25
26  <legalnotice>
27   <para>
28     This documentation is free software; you can redistribute
29     it and/or modify it under the terms of the GNU General Public
30     License version 2 as published by the Free Software Foundation.
31   </para>
32      
33   <para>
34     This program is distributed in the hope that it will be
35     useful, but WITHOUT ANY WARRANTY; without even the implied
36     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
37     See the GNU General Public License for more details.
38   </para>
39      
40   <para>
41     You should have received a copy of the GNU General Public
42     License along with this program; if not, write to the Free
43     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
44     MA 02111-1307 USA
45   </para>
46      
47   <para>
48     For more details see the file COPYING in the source
49     distribution of Linux.
50   </para>
51  </legalnotice>
52 </bookinfo>
53
54<toc></toc>
55
56  <chapter id="intro">
57      <title>Introduction</title>
58  <para>
59  	The generic NAND driver supports almost all NAND and AG-AND based
60	chips and connects them to the Memory Technology Devices (MTD)
61	subsystem of the Linux Kernel.
62  </para>
63  <para>
64  	This documentation is provided for developers who want to implement
65	board drivers or filesystem drivers suitable for NAND devices.
66  </para>
67  </chapter>
68  
69  <chapter id="bugs">
70     <title>Known Bugs And Assumptions</title>
71  <para>
72	None.	
73  </para>
74  </chapter>
75
76  <chapter id="dochints">
77     <title>Documentation hints</title>
78     <para>
79     The function and structure docs are autogenerated. Each function and 
80     struct member has a short description which is marked with an [XXX] identifier.
81     The following chapters explain the meaning of those identifiers.
82     </para>
83     <sect1 id="Function_identifiers_XXX">
84	<title>Function identifiers [XXX]</title>
85     	<para>
86	The functions are marked with [XXX] identifiers in the short
87	comment. The identifiers explain the usage and scope of the
88	functions. Following identifiers are used:
89     	</para>
90	<itemizedlist>
91		<listitem><para>
92	  	[MTD Interface]</para><para>
93		These functions provide the interface to the MTD kernel API. 
94		They are not replaceable and provide functionality
95		which is complete hardware independent.
96		</para></listitem>
97		<listitem><para>
98	  	[NAND Interface]</para><para>
99		These functions are exported and provide the interface to the NAND kernel API. 
100		</para></listitem>
101		<listitem><para>
102	  	[GENERIC]</para><para>
103		Generic functions are not replaceable and provide functionality
104		which is complete hardware independent.
105		</para></listitem>
106		<listitem><para>
107	  	[DEFAULT]</para><para>
108		Default functions provide hardware related functionality which is suitable
109		for most of the implementations. These functions can be replaced by the
110		board driver if necessary. Those functions are called via pointers in the
111		NAND chip description structure. The board driver can set the functions which
112		should be replaced by board dependent functions before calling nand_scan().
113		If the function pointer is NULL on entry to nand_scan() then the pointer
114		is set to the default function which is suitable for the detected chip type.
115		</para></listitem>
116	</itemizedlist>
117     </sect1>
118     <sect1 id="Struct_member_identifiers_XXX">
119	<title>Struct member identifiers [XXX]</title>
120     	<para>
121	The struct members are marked with [XXX] identifiers in the 
122	comment. The identifiers explain the usage and scope of the
123	members. Following identifiers are used:
124     	</para>
125	<itemizedlist>
126		<listitem><para>
127	  	[INTERN]</para><para>
128		These members are for NAND driver internal use only and must not be
129		modified. Most of these values are calculated from the chip geometry
130		information which is evaluated during nand_scan().
131		</para></listitem>
132		<listitem><para>
133	  	[REPLACEABLE]</para><para>
134		Replaceable members hold hardware related functions which can be 
135		provided by the board driver. The board driver can set the functions which
136		should be replaced by board dependent functions before calling nand_scan().
137		If the function pointer is NULL on entry to nand_scan() then the pointer
138		is set to the default function which is suitable for the detected chip type.
139		</para></listitem>
140		<listitem><para>
141	  	[BOARDSPECIFIC]</para><para>
142		Board specific members hold hardware related information which must
143		be provided by the board driver. The board driver must set the function
144		pointers and datafields before calling nand_scan().
145		</para></listitem>
146		<listitem><para>
147	  	[OPTIONAL]</para><para>
148		Optional members can hold information relevant for the board driver. The
149		generic NAND driver code does not use this information.
150		</para></listitem>
151	</itemizedlist>
152     </sect1>
153  </chapter>   
154
155  <chapter id="basicboarddriver">
156     	<title>Basic board driver</title>
157	<para>
158		For most boards it will be sufficient to provide just the
159		basic functions and fill out some really board dependent
160		members in the nand chip description structure.
161	</para>
162	<sect1 id="Basic_defines">
163		<title>Basic defines</title>
164		<para>
165			At least you have to provide a mtd structure and
166			a storage for the ioremap'ed chip address.
167			You can allocate the mtd structure using kmalloc
168			or you can allocate it statically.
169			In case of static allocation you have to allocate
170			a nand_chip structure too.
171		</para>
172		<para>
173			Kmalloc based example
174		</para>
175		<programlisting>
176static struct mtd_info *board_mtd;
177static void __iomem *baseaddr;
178		</programlisting>
179		<para>
180			Static example
181		</para>
182		<programlisting>
183static struct mtd_info board_mtd;
184static struct nand_chip board_chip;
185static void __iomem *baseaddr;
186		</programlisting>
187	</sect1>
188	<sect1 id="Partition_defines">
189		<title>Partition defines</title>
190		<para>
191			If you want to divide your device into partitions, then
192			define a partitioning scheme suitable to your board.
193		</para>
194		<programlisting>
195#define NUM_PARTITIONS 2
196static struct mtd_partition partition_info[] = {
197	{ .name = "Flash partition 1",
198	  .offset =  0,
199	  .size =    8 * 1024 * 1024 },
200	{ .name = "Flash partition 2",
201	  .offset =  MTDPART_OFS_NEXT,
202	  .size =    MTDPART_SIZ_FULL },
203};
204		</programlisting>
205	</sect1>
206	<sect1 id="Hardware_control_functions">
207		<title>Hardware control function</title>
208		<para>
209			The hardware control function provides access to the 
210			control pins of the NAND chip(s). 
211			The access can be done by GPIO pins or by address lines.
212			If you use address lines, make sure that the timing
213			requirements are met.
214		</para>
215		<para>
216			<emphasis>GPIO based example</emphasis>
217		</para>
218		<programlisting>
219static void board_hwcontrol(struct mtd_info *mtd, int cmd)
220{
221	switch(cmd){
222		case NAND_CTL_SETCLE: /* Set CLE pin high */ break;
223		case NAND_CTL_CLRCLE: /* Set CLE pin low */ break;
224		case NAND_CTL_SETALE: /* Set ALE pin high */ break;
225		case NAND_CTL_CLRALE: /* Set ALE pin low */ break;
226		case NAND_CTL_SETNCE: /* Set nCE pin low */ break;
227		case NAND_CTL_CLRNCE: /* Set nCE pin high */ break;
228	}
229}
230		</programlisting>
231		<para>
232			<emphasis>Address lines based example.</emphasis> It's assumed that the
233			nCE pin is driven by a chip select decoder.
234		</para>
235		<programlisting>
236static void board_hwcontrol(struct mtd_info *mtd, int cmd)
237{
238	struct nand_chip *this = (struct nand_chip *) mtd->priv;
239	switch(cmd){
240		case NAND_CTL_SETCLE: this->IO_ADDR_W |= CLE_ADRR_BIT;  break;
241		case NAND_CTL_CLRCLE: this->IO_ADDR_W &amp;= ~CLE_ADRR_BIT; break;
242		case NAND_CTL_SETALE: this->IO_ADDR_W |= ALE_ADRR_BIT;  break;
243		case NAND_CTL_CLRALE: this->IO_ADDR_W &amp;= ~ALE_ADRR_BIT; break;
244	}
245}
246		</programlisting>
247	</sect1>
248	<sect1 id="Device_ready_function">
249		<title>Device ready function</title>
250		<para>
251			If the hardware interface has the ready busy pin of the NAND chip connected to a
252			GPIO or other accessible I/O pin, this function is used to read back the state of the
253			pin. The function has no arguments and should return 0, if the device is busy (R/B pin 
254			is low) and 1, if the device is ready (R/B pin is high).
255			If the hardware interface does not give access to the ready busy pin, then
256			the function must not be defined and the function pointer this->dev_ready is set to NULL.		
257		</para>
258	</sect1>
259	<sect1 id="Init_function">
260		<title>Init function</title>
261		<para>
262			The init function allocates memory and sets up all the board
263			specific parameters and function pointers. When everything
264			is set up nand_scan() is called. This function tries to
265			detect and identify then chip. If a chip is found all the
266			internal data fields are initialized accordingly.
267			The structure(s) have to be zeroed out first and then filled with the necessary
268			information about the device.
269		</para>
270		<programlisting>
271static int __init board_init (void)
272{
273	struct nand_chip *this;
274	int err = 0;
275
276	/* Allocate memory for MTD device structure and private data */
277	board_mtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
278	if (!board_mtd) {
279		printk ("Unable to allocate NAND MTD device structure.\n");
280		err = -ENOMEM;
281		goto out;
282	}
283
284	/* map physical address */
285	baseaddr = ioremap(CHIP_PHYSICAL_ADDRESS, 1024);
286	if (!baseaddr) {
287		printk("Ioremap to access NAND chip failed\n");
288		err = -EIO;
289		goto out_mtd;
290	}
291
292	/* Get pointer to private data */
293	this = (struct nand_chip *) ();
294	/* Link the private data with the MTD structure */
295	board_mtd->priv = this;
296
297	/* Set address of NAND IO lines */
298	this->IO_ADDR_R = baseaddr;
299	this->IO_ADDR_W = baseaddr;
300	/* Reference hardware control function */
301	this->hwcontrol = board_hwcontrol;
302	/* Set command delay time, see datasheet for correct value */
303	this->chip_delay = CHIP_DEPENDEND_COMMAND_DELAY;
304	/* Assign the device ready function, if available */
305	this->dev_ready = board_dev_ready;
306	this->eccmode = NAND_ECC_SOFT;
307
308	/* Scan to find existence of the device */
309	if (nand_scan (board_mtd, 1)) {
310		err = -ENXIO;
311		goto out_ior;
312	}
313	
314	add_mtd_partitions(board_mtd, partition_info, NUM_PARTITIONS);
315	goto out;
316
317out_ior:
318	iounmap(baseaddr);
319out_mtd:
320	kfree (board_mtd);
321out:
322	return err;
323}
324module_init(board_init);
325		</programlisting>
326	</sect1>
327	<sect1 id="Exit_function">
328		<title>Exit function</title>
329		<para>
330			The exit function is only necessary if the driver is
331			compiled as a module. It releases all resources which
332			are held by the chip driver and unregisters the partitions
333			in the MTD layer.
334		</para>
335		<programlisting>
336#ifdef MODULE
337static void __exit board_cleanup (void)
338{
339	/* Release resources, unregister device */
340	nand_release (board_mtd);
341
342	/* unmap physical address */
343	iounmap(baseaddr);
344	
345	/* Free the MTD device structure */
346	kfree (board_mtd);
347}
348module_exit(board_cleanup);
349#endif
350		</programlisting>
351	</sect1>
352  </chapter>
353
354  <chapter id="boarddriversadvanced">
355     	<title>Advanced board driver functions</title>
356	<para>
357		This chapter describes the advanced functionality of the NAND
358		driver. For a list of functions which can be overridden by the board
359		driver see the documentation of the nand_chip structure.
360	</para>
361	<sect1 id="Multiple_chip_control">
362		<title>Multiple chip control</title>
363		<para>
364			The nand driver can control chip arrays. Therefore the
365			board driver must provide an own select_chip function. This
366			function must (de)select the requested chip.
367			The function pointer in the nand_chip structure must
368			be set before calling nand_scan(). The maxchip parameter
369			of nand_scan() defines the maximum number of chips to
370			scan for. Make sure that the select_chip function can
371			handle the requested number of chips.
372		</para>
373		<para>
374			The nand driver concatenates the chips to one virtual
375			chip and provides this virtual chip to the MTD layer.
376		</para>
377		<para>
378			<emphasis>Note: The driver can only handle linear chip arrays
379			of equally sized chips. There is no support for
380			parallel arrays which extend the buswidth.</emphasis>
381		</para>
382		<para>
383			<emphasis>GPIO based example</emphasis>
384		</para>
385		<programlisting>
386static void board_select_chip (struct mtd_info *mtd, int chip)
387{
388	/* Deselect all chips, set all nCE pins high */
389	GPIO(BOARD_NAND_NCE) |= 0xff;	
390	if (chip >= 0)
391		GPIO(BOARD_NAND_NCE) &amp;= ~ (1 &lt;&lt; chip);
392}
393		</programlisting>
394		<para>
395			<emphasis>Address lines based example.</emphasis>
396			Its assumed that the nCE pins are connected to an
397			address decoder.
398		</para>
399		<programlisting>
400static void board_select_chip (struct mtd_info *mtd, int chip)
401{
402	struct nand_chip *this = (struct nand_chip *) mtd->priv;
403	
404	/* Deselect all chips */
405	this->IO_ADDR_R &amp;= ~BOARD_NAND_ADDR_MASK;
406	this->IO_ADDR_W &amp;= ~BOARD_NAND_ADDR_MASK;
407	switch (chip) {
408	case 0:
409		this->IO_ADDR_R |= BOARD_NAND_ADDR_CHIP0;
410		this->IO_ADDR_W |= BOARD_NAND_ADDR_CHIP0;
411		break;
412	....	
413	case n:
414		this->IO_ADDR_R |= BOARD_NAND_ADDR_CHIPn;
415		this->IO_ADDR_W |= BOARD_NAND_ADDR_CHIPn;
416		break;
417	}	
418}
419		</programlisting>
420	</sect1>
421	<sect1 id="Hardware_ECC_support">
422		<title>Hardware ECC support</title>
423		<sect2 id="Functions_and_constants">
424			<title>Functions and constants</title>
425			<para>
426				The nand driver supports three different types of
427				hardware ECC.
428				<itemizedlist>
429				<listitem><para>NAND_ECC_HW3_256</para><para>
430				Hardware ECC generator providing 3 bytes ECC per
431				256 byte.
432				</para>	</listitem>
433				<listitem><para>NAND_ECC_HW3_512</para><para>
434				Hardware ECC generator providing 3 bytes ECC per
435				512 byte.
436				</para>	</listitem>
437				<listitem><para>NAND_ECC_HW6_512</para><para>
438				Hardware ECC generator providing 6 bytes ECC per
439				512 byte.
440				</para>	</listitem>
441				<listitem><para>NAND_ECC_HW8_512</para><para>
442				Hardware ECC generator providing 6 bytes ECC per
443				512 byte.
444				</para>	</listitem>
445				</itemizedlist>
446				If your hardware generator has a different functionality
447				add it at the appropriate place in nand_base.c
448			</para>
449			<para>
450				The board driver must provide following functions:
451				<itemizedlist>
452				<listitem><para>enable_hwecc</para><para>
453				This function is called before reading / writing to
454				the chip. Reset or initialize the hardware generator
455				in this function. The function is called with an
456				argument which let you distinguish between read 
457				and write operations.
458				</para>	</listitem>
459				<listitem><para>calculate_ecc</para><para>
460				This function is called after read / write from / to
461				the chip. Transfer the ECC from the hardware to
462				the buffer. If the option NAND_HWECC_SYNDROME is set
463				then the function is only called on write. See below.
464				</para>	</listitem>
465				<listitem><para>correct_data</para><para>
466				In case of an ECC error this function is called for
467				error detection and correction. Return 1 respectively 2
468				in case the error can be corrected. If the error is
469				not correctable return -1. If your hardware generator
470				matches the default algorithm of the nand_ecc software
471				generator then use the correction function provided
472				by nand_ecc instead of implementing duplicated code.
473				</para>	</listitem>
474				</itemizedlist>
475			</para>
476		</sect2>
477		<sect2 id="Hardware_ECC_with_syndrome_calculation">
478		<title>Hardware ECC with syndrome calculation</title>
479			<para>
480				Many hardware ECC implementations provide Reed-Solomon
481				codes and calculate an error syndrome on read. The syndrome
482				must be converted to a standard Reed-Solomon syndrome
483				before calling the error correction code in the generic
484				Reed-Solomon library.
485			</para>
486			<para>
487				The ECC bytes must be placed immediately after the data
488				bytes in order to make the syndrome generator work. This
489				is contrary to the usual layout used by software ECC. The
490				separation of data and out of band area is not longer
491				possible. The nand driver code handles this layout and
492				the remaining free bytes in the oob area are managed by 
493				the autoplacement code. Provide a matching oob-layout
494				in this case. See rts_from4.c and diskonchip.c for 
495				implementation reference. In those cases we must also
496				use bad block tables on FLASH, because the ECC layout is
497				interfering with the bad block marker positions.
498				See bad block table support for details.
499			</para>
500		</sect2>
501	</sect1>
502	<sect1 id="Bad_Block_table_support">
503		<title>Bad block table support</title>
504		<para>
505			Most NAND chips mark the bad blocks at a defined
506			position in the spare area. Those blocks must 
507			not be erased under any circumstances as the bad 
508			block information would be lost.
509			It is possible to check the bad block mark each
510			time when the blocks are accessed by reading the
511			spare area of the first page in the block. This
512			is time consuming so a bad block table is used.
513		</para>
514		<para>
515			The nand driver supports various types of bad block
516			tables.
517			<itemizedlist>
518			<listitem><para>Per device</para><para>
519			The bad block table contains all bad block information
520			of the device which can consist of multiple chips.
521			</para>	</listitem>
522			<listitem><para>Per chip</para><para>
523			A bad block table is used per chip and contains the
524			bad block information for this particular chip.
525			</para>	</listitem>
526			<listitem><para>Fixed offset</para><para>
527			The bad block table is located at a fixed offset
528			in the chip (device). This applies to various
529			DiskOnChip devices.
530			</para>	</listitem>
531			<listitem><para>Automatic placed</para><para>
532			The bad block table is automatically placed and
533			detected either at the end or at the beginning
534			of a chip (device)
535			</para>	</listitem>
536			<listitem><para>Mirrored tables</para><para>
537			The bad block table is mirrored on the chip (device) to
538			allow updates of the bad block table without data loss.
539			</para>	</listitem>
540			</itemizedlist>
541		</para>
542		<para>	
543			nand_scan() calls the function nand_default_bbt(). 
544			nand_default_bbt() selects appropriate default
545			bad block table descriptors depending on the chip information
546			which was retrieved by nand_scan().
547		</para>
548		<para>
549			The standard policy is scanning the device for bad 
550			blocks and build a ram based bad block table which
551			allows faster access than always checking the
552			bad block information on the flash chip itself.
553		</para>
554		<sect2 id="Flash_based_tables">
555			<title>Flash based tables</title>
556			<para>
557				It may be desired or necessary to keep a bad block table in FLASH.
558				For AG-AND chips this is mandatory, as they have no factory marked
559				bad blocks. They have factory marked good blocks. The marker pattern
560				is erased when the block is erased to be reused. So in case of
561				powerloss before writing the pattern back to the chip this block 
562				would be lost and added to the bad blocks. Therefore we scan the 
563				chip(s) when we detect them the first time for good blocks and 
564				store this information in a bad block table before erasing any 
565				of the blocks.
566			</para>
567			<para>
568				The blocks in which the tables are stored are protected against
569				accidental access by marking them bad in the memory bad block
570				table. The bad block table management functions are allowed
571				to circumvent this protection.
572			</para>
573			<para>
574				The simplest way to activate the FLASH based bad block table support 
575				is to set the option NAND_BBT_USE_FLASH in the bbt_option field of
576				the nand chip structure before calling nand_scan(). For AG-AND
577				chips is this done by default.
578				This activates the default FLASH based bad block table functionality 
579				of the NAND driver. The default bad block table options are
580				<itemizedlist>
581				<listitem><para>Store bad block table per chip</para></listitem>
582				<listitem><para>Use 2 bits per block</para></listitem>
583				<listitem><para>Automatic placement at the end of the chip</para></listitem>
584				<listitem><para>Use mirrored tables with version numbers</para></listitem>
585				<listitem><para>Reserve 4 blocks at the end of the chip</para></listitem>
586				</itemizedlist>
587			</para>
588		</sect2>
589		<sect2 id="User_defined_tables">
590			<title>User defined tables</title>
591			<para>
592				User defined tables are created by filling out a 
593				nand_bbt_descr structure and storing the pointer in the
594				nand_chip structure member bbt_td before calling nand_scan(). 
595				If a mirror table is necessary a second structure must be
596				created and a pointer to this structure must be stored
597				in bbt_md inside the nand_chip structure. If the bbt_md 
598				member is set to NULL then only the main table is used
599				and no scan for the mirrored table is performed.
600			</para>
601			<para>
602				The most important field in the nand_bbt_descr structure
603				is the options field. The options define most of the 
604				table properties. Use the predefined constants from
605				nand.h to define the options.
606				<itemizedlist>
607				<listitem><para>Number of bits per block</para>
608				<para>The supported number of bits is 1, 2, 4, 8.</para></listitem>
609				<listitem><para>Table per chip</para>
610				<para>Setting the constant NAND_BBT_PERCHIP selects that
611				a bad block table is managed for each chip in a chip array.
612				If this option is not set then a per device bad block table
613				is used.</para></listitem>
614				<listitem><para>Table location is absolute</para>
615				<para>Use the option constant NAND_BBT_ABSPAGE and
616				define the absolute page number where the bad block
617				table starts in the field pages. If you have selected bad block
618				tables per chip and you have a multi chip array then the start page
619				must be given for each chip in the chip array. Note: there is no scan
620				for a table ident pattern performed, so the fields 
621				pattern, veroffs, offs, len can be left uninitialized</para></listitem>
622				<listitem><para>Table location is automatically detected</para>
623				<para>The table can either be located in the first or the last good
624				blocks of the chip (device). Set NAND_BBT_LASTBLOCK to place
625				the bad block table at the end of the chip (device). The
626				bad block tables are marked and identified by a pattern which
627				is stored in the spare area of the first page in the block which
628				holds the bad block table. Store a pointer to the pattern  
629				in the pattern field. Further the length of the pattern has to be 
630				stored in len and the offset in the spare area must be given
631				in the offs member of the nand_bbt_descr structure. For mirrored
632				bad block tables different patterns are mandatory.</para></listitem>
633				<listitem><para>Table creation</para>
634				<para>Set the option NAND_BBT_CREATE to enable the table creation
635				if no table can be found during the scan. Usually this is done only 
636				once if a new chip is found. </para></listitem>
637				<listitem><para>Table write support</para>
638				<para>Set the option NAND_BBT_WRITE to enable the table write support.
639				This allows the update of the bad block table(s) in case a block has
640				to be marked bad due to wear. The MTD interface function block_markbad
641				is calling the update function of the bad block table. If the write
642				support is enabled then the table is updated on FLASH.</para>
643				<para>
644				Note: Write support should only be enabled for mirrored tables with
645				version control.
646				</para></listitem>
647				<listitem><para>Table version control</para>
648				<para>Set the option NAND_BBT_VERSION to enable the table version control.
649				It's highly recommended to enable this for mirrored tables with write
650				support. It makes sure that the risk of losing the bad block
651				table information is reduced to the loss of the information about the
652				one worn out block which should be marked bad. The version is stored in
653				4 consecutive bytes in the spare area of the device. The position of
654				the version number is defined by the member veroffs in the bad block table
655				descriptor.</para></listitem>
656				<listitem><para>Save block contents on write</para>
657				<para>
658				In case that the block which holds the bad block table does contain
659				other useful information, set the option NAND_BBT_SAVECONTENT. When
660				the bad block table is written then the whole block is read the bad
661				block table is updated and the block is erased and everything is 
662				written back. If this option is not set only the bad block table
663				is written and everything else in the block is ignored and erased.
664				</para></listitem>
665				<listitem><para>Number of reserved blocks</para>
666				<para>
667				For automatic placement some blocks must be reserved for
668				bad block table storage. The number of reserved blocks is defined 
669				in the maxblocks member of the bad block table description structure.
670				Reserving 4 blocks for mirrored tables should be a reasonable number. 
671				This also limits the number of blocks which are scanned for the bad
672				block table ident pattern.
673				</para></listitem>
674				</itemizedlist>
675			</para>
676		</sect2>
677	</sect1>
678	<sect1 id="Spare_area_placement">
679		<title>Spare area (auto)placement</title>
680		<para>
681			The nand driver implements different possibilities for
682			placement of filesystem data in the spare area, 
683			<itemizedlist>
684			<listitem><para>Placement defined by fs driver</para></listitem>
685			<listitem><para>Automatic placement</para></listitem>
686			</itemizedlist>
687			The default placement function is automatic placement. The
688			nand driver has built in default placement schemes for the
689			various chiptypes. If due to hardware ECC functionality the
690			default placement does not fit then the board driver can
691			provide a own placement scheme.
692		</para>
693		<para>
694			File system drivers can provide a own placement scheme which
695			is used instead of the default placement scheme.
696		</para>
697		<para>
698			Placement schemes are defined by a nand_oobinfo structure
699	     		<programlisting>
700struct nand_oobinfo {
701	int	useecc;
702	int	eccbytes;
703	int	eccpos[24];
704	int	oobfree[8][2];
705};
706	     		</programlisting>
707			<itemizedlist>
708			<listitem><para>useecc</para><para>
709				The useecc member controls the ecc and placement function. The header
710				file include/mtd/mtd-abi.h contains constants to select ecc and
711				placement. MTD_NANDECC_OFF switches off the ecc complete. This is
712				not recommended and available for testing and diagnosis only.
713				MTD_NANDECC_PLACE selects caller defined placement, MTD_NANDECC_AUTOPLACE
714				selects automatic placement.
715			</para></listitem>
716			<listitem><para>eccbytes</para><para>
717				The eccbytes member defines the number of ecc bytes per page.
718			</para></listitem>
719			<listitem><para>eccpos</para><para>
720				The eccpos array holds the byte offsets in the spare area where
721				the ecc codes are placed.
722			</para></listitem>
723			<listitem><para>oobfree</para><para>
724				The oobfree array defines the areas in the spare area which can be
725				used for automatic placement. The information is given in the format
726				{offset, size}. offset defines the start of the usable area, size the
727				length in bytes. More than one area can be defined. The list is terminated
728				by an {0, 0} entry.
729			</para></listitem>
730			</itemizedlist>
731		</para>
732		<sect2 id="Placement_defined_by_fs_driver">
733			<title>Placement defined by fs driver</title>
734			<para>
735				The calling function provides a pointer to a nand_oobinfo
736				structure which defines the ecc placement. For writes the
737				caller must provide a spare area buffer along with the
738				data buffer. The spare area buffer size is (number of pages) *
739				(size of spare area). For reads the buffer size is
740				(number of pages) * ((size of spare area) + (number of ecc
741				steps per page) * sizeof (int)). The driver stores the
742				result of the ecc check for each tuple in the spare buffer.
743				The storage sequence is 
744			</para>
745			<para>
746				&lt;spare data page 0&gt;&lt;ecc result 0&gt;...&lt;ecc result n&gt;
747			</para>
748			<para>
749				...
750			</para>
751			<para>
752				&lt;spare data page n&gt;&lt;ecc result 0&gt;...&lt;ecc result n&gt;
753			</para>
754			<para>
755				This is a legacy mode used by YAFFS1.
756			</para>
757			<para>
758				If the spare area buffer is NULL then only the ECC placement is
759				done according to the given scheme in the nand_oobinfo structure.
760			</para>
761		</sect2>
762		<sect2 id="Automatic_placement">
763			<title>Automatic placement</title>
764			<para>
765				Automatic placement uses the built in defaults to place the
766				ecc bytes in the spare area. If filesystem data have to be stored /
767				read into the spare area then the calling function must provide a
768				buffer. The buffer size per page is determined by the oobfree array in
769				the nand_oobinfo structure.
770			</para>
771			<para>
772				If the spare area buffer is NULL then only the ECC placement is
773				done according to the default builtin scheme.
774			</para>
775		</sect2>
776	</sect1>	
777	<sect1 id="Spare_area_autoplacement_default">
778		<title>Spare area autoplacement default schemes</title>
779		<sect2 id="pagesize_256">
780			<title>256 byte pagesize</title>
781<informaltable><tgroup cols="3"><tbody>
782<row>
783<entry>Offset</entry>
784<entry>Content</entry>
785<entry>Comment</entry>
786</row>
787<row>
788<entry>0x00</entry>
789<entry>ECC byte 0</entry>
790<entry>Error correction code byte 0</entry>
791</row>
792<row>
793<entry>0x01</entry>
794<entry>ECC byte 1</entry>
795<entry>Error correction code byte 1</entry>
796</row>
797<row>
798<entry>0x02</entry>
799<entry>ECC byte 2</entry>
800<entry>Error correction code byte 2</entry>
801</row>
802<row>
803<entry>0x03</entry>
804<entry>Autoplace 0</entry>
805<entry></entry>
806</row>
807<row>
808<entry>0x04</entry>
809<entry>Autoplace 1</entry>
810<entry></entry>
811</row>
812<row>
813<entry>0x05</entry>
814<entry>Bad block marker</entry>
815<entry>If any bit in this byte is zero, then this block is bad.
816This applies only to the first page in a block. In the remaining
817pages this byte is reserved</entry>
818</row>
819<row>
820<entry>0x06</entry>
821<entry>Autoplace 2</entry>
822<entry></entry>
823</row>
824<row>
825<entry>0x07</entry>
826<entry>Autoplace 3</entry>
827<entry></entry>
828</row>
829</tbody></tgroup></informaltable>
830		</sect2>
831		<sect2 id="pagesize_512">
832			<title>512 byte pagesize</title>
833<informaltable><tgroup cols="3"><tbody>
834<row>
835<entry>Offset</entry>
836<entry>Content</entry>
837<entry>Comment</entry>
838</row>
839<row>
840<entry>0x00</entry>
841<entry>ECC byte 0</entry>
842<entry>Error correction code byte 0 of the lower 256 Byte data in
843this page</entry>
844</row>
845<row>
846<entry>0x01</entry>
847<entry>ECC byte 1</entry>
848<entry>Error correction code byte 1 of the lower 256 Bytes of data
849in this page</entry>
850</row>
851<row>
852<entry>0x02</entry>
853<entry>ECC byte 2</entry>
854<entry>Error correction code byte 2 of the lower 256 Bytes of data
855in this page</entry>
856</row>
857<row>
858<entry>0x03</entry>
859<entry>ECC byte 3</entry>
860<entry>Error correction code byte 0 of the upper 256 Bytes of data
861in this page</entry>
862</row>
863<row>
864<entry>0x04</entry>
865<entry>reserved</entry>
866<entry>reserved</entry>
867</row>
868<row>
869<entry>0x05</entry>
870<entry>Bad block marker</entry>
871<entry>If any bit in this byte is zero, then this block is bad.
872This applies only to the first page in a block. In the remaining
873pages this byte is reserved</entry>
874</row>
875<row>
876<entry>0x06</entry>
877<entry>ECC byte 4</entry>
878<entry>Error correction code byte 1 of the upper 256 Bytes of data
879in this page</entry>
880</row>
881<row>
882<entry>0x07</entry>
883<entry>ECC byte 5</entry>
884<entry>Error correction code byte 2 of the upper 256 Bytes of data
885in this page</entry>
886</row>
887<row>
888<entry>0x08 - 0x0F</entry>
889<entry>Autoplace 0 - 7</entry>
890<entry></entry>
891</row>
892</tbody></tgroup></informaltable>
893		</sect2>
894		<sect2 id="pagesize_2048">
895			<title>2048 byte pagesize</title>
896<informaltable><tgroup cols="3"><tbody>
897<row>
898<entry>Offset</entry>
899<entry>Content</entry>
900<entry>Comment</entry>
901</row>
902<row>
903<entry>0x00</entry>
904<entry>Bad block marker</entry>
905<entry>If any bit in this byte is zero, then this block is bad.
906This applies only to the first page in a block. In the remaining
907pages this byte is reserved</entry>
908</row>
909<row>
910<entry>0x01</entry>
911<entry>Reserved</entry>
912<entry>Reserved</entry>
913</row>
914<row>
915<entry>0x02-0x27</entry>
916<entry>Autoplace 0 - 37</entry>
917<entry></entry>
918</row>
919<row>
920<entry>0x28</entry>
921<entry>ECC byte 0</entry>
922<entry>Error correction code byte 0 of the first 256 Byte data in
923this page</entry>
924</row>
925<row>
926<entry>0x29</entry>
927<entry>ECC byte 1</entry>
928<entry>Error correction code byte 1 of the first 256 Bytes of data
929in this page</entry>
930</row>
931<row>
932<entry>0x2A</entry>
933<entry>ECC byte 2</entry>
934<entry>Error correction code byte 2 of the first 256 Bytes data in
935this page</entry>
936</row>
937<row>
938<entry>0x2B</entry>
939<entry>ECC byte 3</entry>
940<entry>Error correction code byte 0 of the second 256 Bytes of data
941in this page</entry>
942</row>
943<row>
944<entry>0x2C</entry>
945<entry>ECC byte 4</entry>
946<entry>Error correction code byte 1 of the second 256 Bytes of data
947in this page</entry>
948</row>
949<row>
950<entry>0x2D</entry>
951<entry>ECC byte 5</entry>
952<entry>Error correction code byte 2 of the second 256 Bytes of data
953in this page</entry>
954</row>
955<row>
956<entry>0x2E</entry>
957<entry>ECC byte 6</entry>
958<entry>Error correction code byte 0 of the third 256 Bytes of data
959in this page</entry>
960</row>
961<row>
962<entry>0x2F</entry>
963<entry>ECC byte 7</entry>
964<entry>Error correction code byte 1 of the third 256 Bytes of data
965in this page</entry>
966</row>
967<row>
968<entry>0x30</entry>
969<entry>ECC byte 8</entry>
970<entry>Error correction code byte 2 of the third 256 Bytes of data
971in this page</entry>
972</row>
973<row>
974<entry>0x31</entry>
975<entry>ECC byte 9</entry>
976<entry>Error correction code byte 0 of the fourth 256 Bytes of data
977in this page</entry>
978</row>
979<row>
980<entry>0x32</entry>
981<entry>ECC byte 10</entry>
982<entry>Error correction code byte 1 of the fourth 256 Bytes of data
983in this page</entry>
984</row>
985<row>
986<entry>0x33</entry>
987<entry>ECC byte 11</entry>
988<entry>Error correction code byte 2 of the fourth 256 Bytes of data
989in this page</entry>
990</row>
991<row>
992<entry>0x34</entry>
993<entry>ECC byte 12</entry>
994<entry>Error correction code byte 0 of the fifth 256 Bytes of data
995in this page</entry>
996</row>
997<row>
998<entry>0x35</entry>
999<entry>ECC byte 13</entry>
1000<entry>Error correction code byte 1 of the fifth 256 Bytes of data
1001in this page</entry>
1002</row>
1003<row>
1004<entry>0x36</entry>
1005<entry>ECC byte 14</entry>
1006<entry>Error correction code byte 2 of the fifth 256 Bytes of data
1007in this page</entry>
1008</row>
1009<row>
1010<entry>0x37</entry>
1011<entry>ECC byte 15</entry>
1012<entry>Error correction code byte 0 of the sixt 256 Bytes of data
1013in this page</entry>
1014</row>
1015<row>
1016<entry>0x38</entry>
1017<entry>ECC byte 16</entry>
1018<entry>Error correction code byte 1 of the sixt 256 Bytes of data
1019in this page</entry>
1020</row>
1021<row>
1022<entry>0x39</entry>
1023<entry>ECC byte 17</entry>
1024<entry>Error correction code byte 2 of the sixt 256 Bytes of data
1025in this page</entry>
1026</row>
1027<row>
1028<entry>0x3A</entry>
1029<entry>ECC byte 18</entry>
1030<entry>Error correction code byte 0 of the seventh 256 Bytes of
1031data in this page</entry>
1032</row>
1033<row>
1034<entry>0x3B</entry>
1035<entry>ECC byte 19</entry>
1036<entry>Error correction code byte 1 of the seventh 256 Bytes of
1037data in this page</entry>
1038</row>
1039<row>
1040<entry>0x3C</entry>
1041<entry>ECC byte 20</entry>
1042<entry>Error correction code byte 2 of the seventh 256 Bytes of
1043data in this page</entry>
1044</row>
1045<row>
1046<entry>0x3D</entry>
1047<entry>ECC byte 21</entry>
1048<entry>Error correction code byte 0 of the eighth 256 Bytes of data
1049in this page</entry>
1050</row>
1051<row>
1052<entry>0x3E</entry>
1053<entry>ECC byte 22</entry>
1054<entry>Error correction code byte 1 of the eighth 256 Bytes of data
1055in this page</entry>
1056</row>
1057<row>
1058<entry>0x3F</entry>
1059<entry>ECC byte 23</entry>
1060<entry>Error correction code byte 2 of the eighth 256 Bytes of data
1061in this page</entry>
1062</row>
1063</tbody></tgroup></informaltable>
1064		</sect2>
1065     	</sect1>
1066  </chapter>
1067
1068  <chapter id="filesystems">
1069     	<title>Filesystem support</title>
1070	<para>
1071		The NAND driver provides all necessary functions for a
1072		filesystem via the MTD interface.
1073	</para>
1074	<para>
1075		Filesystems must be aware of the NAND peculiarities and
1076		restrictions. One major restrictions of NAND Flash is, that you cannot 
1077		write as often as you want to a page. The consecutive writes to a page, 
1078		before erasing it again, are restricted to 1-3 writes, depending on the 
1079		manufacturers specifications. This applies similar to the spare area. 
1080	</para>
1081	<para>
1082		Therefore NAND aware filesystems must either write in page size chunks
1083		or hold a writebuffer to collect smaller writes until they sum up to 
1084		pagesize. Available NAND aware filesystems: JFFS2, YAFFS. 		
1085	</para>
1086	<para>
1087		The spare area usage to store filesystem data is controlled by
1088		the spare area placement functionality which is described in one
1089		of the earlier chapters.
1090	</para>
1091  </chapter>	
1092  <chapter id="tools">
1093     	<title>Tools</title>
1094	<para>
1095		The MTD project provides a couple of helpful tools to handle NAND Flash.
1096		<itemizedlist>
1097		<listitem><para>flasherase, flasheraseall: Erase and format FLASH partitions</para></listitem>
1098		<listitem><para>nandwrite: write filesystem images to NAND FLASH</para></listitem>
1099		<listitem><para>nanddump: dump the contents of a NAND FLASH partitions</para></listitem>
1100		</itemizedlist>
1101	</para>
1102	<para>
1103		These tools are aware of the NAND restrictions. Please use those tools
1104		instead of complaining about errors which are caused by non NAND aware
1105		access methods.
1106	</para>
1107  </chapter>	
1108
1109  <chapter id="defines">
1110     <title>Constants</title>
1111     <para>
1112     This chapter describes the constants which might be relevant for a driver developer.
1113     </para>
1114     <sect1 id="Chip_option_constants">
1115	<title>Chip option constants</title>
1116     	<sect2 id="Constants_for_chip_id_table">
1117		<title>Constants for chip id table</title>
1118     		<para>
1119		These constants are defined in nand.h. They are ored together to describe
1120		the chip functionality.
1121     		<programlisting>
1122/* Buswitdh is 16 bit */
1123#define NAND_BUSWIDTH_16	0x00000002
1124/* Device supports partial programming without padding */
1125#define NAND_NO_PADDING		0x00000004
1126/* Chip has cache program function */
1127#define NAND_CACHEPRG		0x00000008
1128/* Chip has copy back function */
1129#define NAND_COPYBACK		0x00000010
1130/* AND Chip which has 4 banks and a confusing page / block 
1131 * assignment. See Renesas datasheet for further information */
1132#define NAND_IS_AND		0x00000020
1133/* Chip has a array of 4 pages which can be read without
1134 * additional ready /busy waits */
1135#define NAND_4PAGE_ARRAY	0x00000040 
1136		</programlisting>
1137     		</para>
1138     	</sect2>
1139     	<sect2 id="Constants_for_runtime_options">
1140		<title>Constants for runtime options</title>
1141     		<para>
1142		These constants are defined in nand.h. They are ored together to describe
1143		the functionality.
1144     		<programlisting>
1145/* The hw ecc generator provides a syndrome instead a ecc value on read 
1146 * This can only work if we have the ecc bytes directly behind the 
1147 * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */
1148#define NAND_HWECC_SYNDROME	0x00020000
1149		</programlisting>
1150     		</para>
1151     	</sect2>
1152     </sect1>	
1153
1154     <sect1 id="EEC_selection_constants">
1155	<title>ECC selection constants</title>
1156	<para>
1157	Use these constants to select the ECC algorithm.
1158  	<programlisting>
1159/* No ECC. Usage is not recommended ! */
1160#define NAND_ECC_NONE		0
1161/* Software ECC 3 byte ECC per 256 Byte data */
1162#define NAND_ECC_SOFT		1
1163/* Hardware ECC 3 byte ECC per 256 Byte data */
1164#define NAND_ECC_HW3_256	2
1165/* Hardware ECC 3 byte ECC per 512 Byte data */
1166#define NAND_ECC_HW3_512	3
1167/* Hardware ECC 6 byte ECC per 512 Byte data */
1168#define NAND_ECC_HW6_512	4
1169/* Hardware ECC 6 byte ECC per 512 Byte data */
1170#define NAND_ECC_HW8_512	6
1171	</programlisting>
1172	</para>
1173     </sect1>	
1174
1175     <sect1 id="Hardware_control_related_constants">
1176	<title>Hardware control related constants</title>
1177	<para>
1178	These constants describe the requested hardware access function when
1179	the boardspecific hardware control function is called
1180  	<programlisting>
1181/* Select the chip by setting nCE to low */
1182#define NAND_CTL_SETNCE 	1
1183/* Deselect the chip by setting nCE to high */
1184#define NAND_CTL_CLRNCE		2
1185/* Select the command latch by setting CLE to high */
1186#define NAND_CTL_SETCLE		3
1187/* Deselect the command latch by setting CLE to low */
1188#define NAND_CTL_CLRCLE		4
1189/* Select the address latch by setting ALE to high */
1190#define NAND_CTL_SETALE		5
1191/* Deselect the address latch by setting ALE to low */
1192#define NAND_CTL_CLRALE		6
1193/* Set write protection by setting WP to high. Not used! */
1194#define NAND_CTL_SETWP		7
1195/* Clear write protection by setting WP to low. Not used! */
1196#define NAND_CTL_CLRWP		8
1197	</programlisting>
1198	</para>
1199     </sect1>	
1200
1201     <sect1 id="Bad_block_table_constants">
1202	<title>Bad block table related constants</title>
1203	<para>
1204	These constants describe the options used for bad block
1205	table descriptors.
1206  	<programlisting>
1207/* Options for the bad block table descriptors */
1208
1209/* The number of bits used per block in the bbt on the device */
1210#define NAND_BBT_NRBITS_MSK	0x0000000F
1211#define NAND_BBT_1BIT		0x00000001
1212#define NAND_BBT_2BIT		0x00000002
1213#define NAND_BBT_4BIT		0x00000004
1214#define NAND_BBT_8BIT		0x00000008
1215/* The bad block table is in the last good block of the device */
1216#define	NAND_BBT_LASTBLOCK	0x00000010
1217/* The bbt is at the given page, else we must scan for the bbt */
1218#define NAND_BBT_ABSPAGE	0x00000020
1219/* bbt is stored per chip on multichip devices */
1220#define NAND_BBT_PERCHIP	0x00000080
1221/* bbt has a version counter at offset veroffs */
1222#define NAND_BBT_VERSION	0x00000100
1223/* Create a bbt if none axists */
1224#define NAND_BBT_CREATE		0x00000200
1225/* Write bbt if necessary */
1226#define NAND_BBT_WRITE		0x00001000
1227/* Read and write back block contents when writing bbt */
1228#define NAND_BBT_SAVECONTENT	0x00002000
1229	</programlisting>
1230	</para>
1231     </sect1>	
1232
1233  </chapter>
1234  	
1235  <chapter id="structs">
1236     <title>Structures</title>
1237     <para>
1238     This chapter contains the autogenerated documentation of the structures which are
1239     used in the NAND driver and might be relevant for a driver developer. Each  
1240     struct member has a short description which is marked with an [XXX] identifier.
1241     See the chapter "Documentation hints" for an explanation.
1242     </para>
1243<!-- include/linux/mtd/nand.h -->
1244<refentry id="API-struct-nand-hw-control">
1245<refentryinfo>
1246 <title>LINUX</title>
1247 <productname>Kernel Hackers Manual</productname>
1248 <date>July 2017</date>
1249</refentryinfo>
1250<refmeta>
1251 <refentrytitle><phrase>struct nand_hw_control</phrase></refentrytitle>
1252 <manvolnum>9</manvolnum>
1253 <refmiscinfo class="version">4.1.27</refmiscinfo>
1254</refmeta>
1255<refnamediv>
1256 <refname>struct nand_hw_control</refname>
1257 <refpurpose>
1258  Control structure for hardware controller (e.g ECC generator) shared among independent devices
1259 </refpurpose>
1260</refnamediv>
1261<refsynopsisdiv>
1262 <title>Synopsis</title>
1263  <programlisting>
1264struct nand_hw_control {
1265  spinlock_t lock;
1266  struct nand_chip * active;
1267  wait_queue_head_t wq;
1268};  </programlisting>
1269</refsynopsisdiv>
1270 <refsect1>
1271  <title>Members</title>
1272  <variablelist>
1273    <varlistentry>      <term>lock</term>
1274      <listitem><para>
1275protection lock
1276      </para></listitem>
1277    </varlistentry>
1278    <varlistentry>      <term>active</term>
1279      <listitem><para>
1280the mtd device which holds the controller currently
1281      </para></listitem>
1282    </varlistentry>
1283    <varlistentry>      <term>wq</term>
1284      <listitem><para>
1285wait queue to sleep on if a NAND operation is in
1286progress used instead of the per chip wait queue
1287when a hw controller is available.
1288      </para></listitem>
1289    </varlistentry>
1290  </variablelist>
1291 </refsect1>
1292</refentry>
1293
1294<refentry id="API-struct-nand-ecc-ctrl">
1295<refentryinfo>
1296 <title>LINUX</title>
1297 <productname>Kernel Hackers Manual</productname>
1298 <date>July 2017</date>
1299</refentryinfo>
1300<refmeta>
1301 <refentrytitle><phrase>struct nand_ecc_ctrl</phrase></refentrytitle>
1302 <manvolnum>9</manvolnum>
1303 <refmiscinfo class="version">4.1.27</refmiscinfo>
1304</refmeta>
1305<refnamediv>
1306 <refname>struct nand_ecc_ctrl</refname>
1307 <refpurpose>
1308     Control structure for ECC
1309 </refpurpose>
1310</refnamediv>
1311<refsynopsisdiv>
1312 <title>Synopsis</title>
1313  <programlisting>
1314struct nand_ecc_ctrl {
1315  nand_ecc_modes_t mode;
1316  int steps;
1317  int size;
1318  int bytes;
1319  int total;
1320  int strength;
1321  int prepad;
1322  int postpad;
1323  struct nand_ecclayout * layout;
1324  void * priv;
1325  void (* hwctl) (struct mtd_info *mtd, int mode);
1326  int (* calculate) (struct mtd_info *mtd, const uint8_t *dat,uint8_t *ecc_code);
1327  int (* correct) (struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc,uint8_t *calc_ecc);
1328  int (* read_page_raw) (struct mtd_info *mtd, struct nand_chip *chip,uint8_t *buf, int oob_required, int page);
1329  int (* write_page_raw) (struct mtd_info *mtd, struct nand_chip *chip,const uint8_t *buf, int oob_required);
1330  int (* read_page) (struct mtd_info *mtd, struct nand_chip *chip,uint8_t *buf, int oob_required, int page);
1331  int (* read_subpage) (struct mtd_info *mtd, struct nand_chip *chip,uint32_t offs, uint32_t len, uint8_t *buf, int page);
1332  int (* write_subpage) (struct mtd_info *mtd, struct nand_chip *chip,uint32_t offset, uint32_t data_len,const uint8_t *data_buf, int oob_required);
1333  int (* write_page) (struct mtd_info *mtd, struct nand_chip *chip,const uint8_t *buf, int oob_required);
1334  int (* write_oob_raw) (struct mtd_info *mtd, struct nand_chip *chip,int page);
1335  int (* read_oob_raw) (struct mtd_info *mtd, struct nand_chip *chip,int page);
1336  int (* read_oob) (struct mtd_info *mtd, struct nand_chip *chip, int page);
1337  int (* write_oob) (struct mtd_info *mtd, struct nand_chip *chip,int page);
1338};  </programlisting>
1339</refsynopsisdiv>
1340 <refsect1>
1341  <title>Members</title>
1342  <variablelist>
1343    <varlistentry>      <term>mode</term>
1344      <listitem><para>
1345   ECC mode
1346      </para></listitem>
1347    </varlistentry>
1348    <varlistentry>      <term>steps</term>
1349      <listitem><para>
1350   number of ECC steps per page
1351      </para></listitem>
1352    </varlistentry>
1353    <varlistentry>      <term>size</term>
1354      <listitem><para>
1355   data bytes per ECC step
1356      </para></listitem>
1357    </varlistentry>
1358    <varlistentry>      <term>bytes</term>
1359      <listitem><para>
1360   ECC bytes per step
1361      </para></listitem>
1362    </varlistentry>
1363    <varlistentry>      <term>total</term>
1364      <listitem><para>
1365   total number of ECC bytes per page
1366      </para></listitem>
1367    </varlistentry>
1368    <varlistentry>      <term>strength</term>
1369      <listitem><para>
1370   max number of correctible bits per ECC step
1371      </para></listitem>
1372    </varlistentry>
1373    <varlistentry>      <term>prepad</term>
1374      <listitem><para>
1375   padding information for syndrome based ECC generators
1376      </para></listitem>
1377    </varlistentry>
1378    <varlistentry>      <term>postpad</term>
1379      <listitem><para>
1380   padding information for syndrome based ECC generators
1381      </para></listitem>
1382    </varlistentry>
1383    <varlistentry>      <term>layout</term>
1384      <listitem><para>
1385   ECC layout control struct pointer
1386      </para></listitem>
1387    </varlistentry>
1388    <varlistentry>      <term>priv</term>
1389      <listitem><para>
1390   pointer to private ECC control data
1391      </para></listitem>
1392    </varlistentry>
1393    <varlistentry>      <term>hwctl</term>
1394      <listitem><para>
1395   function to control hardware ECC generator. Must only
1396   be provided if an hardware ECC is available
1397      </para></listitem>
1398    </varlistentry>
1399    <varlistentry>      <term>calculate</term>
1400      <listitem><para>
1401   function for ECC calculation or readback from ECC hardware
1402      </para></listitem>
1403    </varlistentry>
1404    <varlistentry>      <term>correct</term>
1405      <listitem><para>
1406   function for ECC correction, matching to ECC generator (sw/hw)
1407      </para></listitem>
1408    </varlistentry>
1409    <varlistentry>      <term>read_page_raw</term>
1410      <listitem><para>
1411   function to read a raw page without ECC. This function
1412   should hide the specific layout used by the ECC
1413   controller and always return contiguous in-band and
1414   out-of-band data even if they're not stored
1415   contiguously on the NAND chip (e.g.
1416   NAND_ECC_HW_SYNDROME interleaves in-band and
1417   out-of-band data).
1418      </para></listitem>
1419    </varlistentry>
1420    <varlistentry>      <term>write_page_raw</term>
1421      <listitem><para>
1422   function to write a raw page without ECC. This function
1423   should hide the specific layout used by the ECC
1424   controller and consider the passed data as contiguous
1425   in-band and out-of-band data. ECC controller is
1426   responsible for doing the appropriate transformations
1427   to adapt to its specific layout (e.g.
1428   NAND_ECC_HW_SYNDROME interleaves in-band and
1429   out-of-band data).
1430      </para></listitem>
1431    </varlistentry>
1432    <varlistentry>      <term>read_page</term>
1433      <listitem><para>
1434   function to read a page according to the ECC generator
1435   requirements; returns maximum number of bitflips corrected in
1436   any single ECC step, 0 if bitflips uncorrectable, -EIO hw error
1437      </para></listitem>
1438    </varlistentry>
1439    <varlistentry>      <term>read_subpage</term>
1440      <listitem><para>
1441   function to read parts of the page covered by ECC;
1442   returns same as <function>read_page</function>
1443      </para></listitem>
1444    </varlistentry>
1445    <varlistentry>      <term>write_subpage</term>
1446      <listitem><para>
1447   function to write parts of the page covered by ECC.
1448      </para></listitem>
1449    </varlistentry>
1450    <varlistentry>      <term>write_page</term>
1451      <listitem><para>
1452   function to write a page according to the ECC generator
1453   requirements.
1454      </para></listitem>
1455    </varlistentry>
1456    <varlistentry>      <term>write_oob_raw</term>
1457      <listitem><para>
1458   function to write chip OOB data without ECC
1459      </para></listitem>
1460    </varlistentry>
1461    <varlistentry>      <term>read_oob_raw</term>
1462      <listitem><para>
1463   function to read chip OOB data without ECC
1464      </para></listitem>
1465    </varlistentry>
1466    <varlistentry>      <term>read_oob</term>
1467      <listitem><para>
1468   function to read chip OOB data
1469      </para></listitem>
1470    </varlistentry>
1471    <varlistentry>      <term>write_oob</term>
1472      <listitem><para>
1473   function to write chip OOB data
1474      </para></listitem>
1475    </varlistentry>
1476  </variablelist>
1477 </refsect1>
1478</refentry>
1479
1480<refentry id="API-struct-nand-buffers">
1481<refentryinfo>
1482 <title>LINUX</title>
1483 <productname>Kernel Hackers Manual</productname>
1484 <date>July 2017</date>
1485</refentryinfo>
1486<refmeta>
1487 <refentrytitle><phrase>struct nand_buffers</phrase></refentrytitle>
1488 <manvolnum>9</manvolnum>
1489 <refmiscinfo class="version">4.1.27</refmiscinfo>
1490</refmeta>
1491<refnamediv>
1492 <refname>struct nand_buffers</refname>
1493 <refpurpose>
1494     buffer structure for read/write
1495 </refpurpose>
1496</refnamediv>
1497<refsynopsisdiv>
1498 <title>Synopsis</title>
1499  <programlisting>
1500struct nand_buffers {
1501  uint8_t * ecccalc;
1502  uint8_t * ecccode;
1503  uint8_t * databuf;
1504};  </programlisting>
1505</refsynopsisdiv>
1506 <refsect1>
1507  <title>Members</title>
1508  <variablelist>
1509    <varlistentry>      <term>ecccalc</term>
1510      <listitem><para>
1511   buffer pointer for calculated ECC, size is oobsize.
1512      </para></listitem>
1513    </varlistentry>
1514    <varlistentry>      <term>ecccode</term>
1515      <listitem><para>
1516   buffer pointer for ECC read from flash, size is oobsize.
1517      </para></listitem>
1518    </varlistentry>
1519    <varlistentry>      <term>databuf</term>
1520      <listitem><para>
1521   buffer pointer for data, size is (page size + oobsize).
1522      </para></listitem>
1523    </varlistentry>
1524  </variablelist>
1525 </refsect1>
1526<refsect1>
1527<title>Description</title>
1528<para>
1529   Do not change the order of buffers. databuf and oobrbuf must be in
1530   consecutive order.
1531</para>
1532</refsect1>
1533</refentry>
1534
1535<refentry id="API-struct-nand-chip">
1536<refentryinfo>
1537 <title>LINUX</title>
1538 <productname>Kernel Hackers Manual</productname>
1539 <date>July 2017</date>
1540</refentryinfo>
1541<refmeta>
1542 <refentrytitle><phrase>struct nand_chip</phrase></refentrytitle>
1543 <manvolnum>9</manvolnum>
1544 <refmiscinfo class="version">4.1.27</refmiscinfo>
1545</refmeta>
1546<refnamediv>
1547 <refname>struct nand_chip</refname>
1548 <refpurpose>
1549     NAND Private Flash Chip Data
1550 </refpurpose>
1551</refnamediv>
1552<refsynopsisdiv>
1553 <title>Synopsis</title>
1554  <programlisting>
1555struct nand_chip {
1556  void __iomem * IO_ADDR_R;
1557  void __iomem * IO_ADDR_W;
1558  uint8_t (* read_byte) (struct mtd_info *mtd);
1559  u16 (* read_word) (struct mtd_info *mtd);
1560  void (* write_byte) (struct mtd_info *mtd, uint8_t byte);
1561  void (* write_buf) (struct mtd_info *mtd, const uint8_t *buf, int len);
1562  void (* read_buf) (struct mtd_info *mtd, uint8_t *buf, int len);
1563  void (* select_chip) (struct mtd_info *mtd, int chip);
1564  int (* block_bad) (struct mtd_info *mtd, loff_t ofs, int getchip);
1565  int (* block_markbad) (struct mtd_info *mtd, loff_t ofs);
1566  void (* cmd_ctrl) (struct mtd_info *mtd, int dat, unsigned int ctrl);
1567  int (* init_size) (struct mtd_info *mtd, struct nand_chip *this,u8 *id_data);
1568  int (* dev_ready) (struct mtd_info *mtd);
1569  void (* cmdfunc) (struct mtd_info *mtd, unsigned command, int column,int page_addr);
1570  int(* waitfunc) (struct mtd_info *mtd, struct nand_chip *this);
1571  int (* erase) (struct mtd_info *mtd, int page);
1572  int (* scan_bbt) (struct mtd_info *mtd);
1573  int (* errstat) (struct mtd_info *mtd, struct nand_chip *this, int state,int status, int page);
1574  int (* write_page) (struct mtd_info *mtd, struct nand_chip *chip,uint32_t offset, int data_len, const uint8_t *buf,int oob_required, int page, int cached, int raw);
1575  int (* onfi_set_features) (struct mtd_info *mtd, struct nand_chip *chip,int feature_addr, uint8_t *subfeature_para);
1576  int (* onfi_get_features) (struct mtd_info *mtd, struct nand_chip *chip,int feature_addr, uint8_t *subfeature_para);
1577  int (* setup_read_retry) (struct mtd_info *mtd, int retry_mode);
1578  int chip_delay;
1579  unsigned int options;
1580  unsigned int bbt_options;
1581  int page_shift;
1582  int phys_erase_shift;
1583  int bbt_erase_shift;
1584  int chip_shift;
1585  int numchips;
1586  uint64_t chipsize;
1587  int pagemask;
1588  int pagebuf;
1589  unsigned int pagebuf_bitflips;
1590  int subpagesize;
1591  uint8_t bits_per_cell;
1592  uint16_t ecc_strength_ds;
1593  uint16_t ecc_step_ds;
1594  int onfi_timing_mode_default;
1595  int badblockpos;
1596  int badblockbits;
1597  int onfi_version;
1598  int jedec_version;
1599  union {unnamed_union};
1600  int read_retries;
1601  flstate_t state;
1602  uint8_t * oob_poi;
1603  struct nand_hw_control * controller;
1604  struct nand_ecc_ctrl ecc;
1605  struct nand_buffers * buffers;
1606  struct nand_hw_control hwcontrol;
1607  uint8_t * bbt;
1608  struct nand_bbt_descr * bbt_td;
1609  struct nand_bbt_descr * bbt_md;
1610  struct nand_bbt_descr * badblock_pattern;
1611  void * priv;
1612};  </programlisting>
1613</refsynopsisdiv>
1614 <refsect1>
1615  <title>Members</title>
1616  <variablelist>
1617    <varlistentry>      <term>IO_ADDR_R</term>
1618      <listitem><para>
1619   [BOARDSPECIFIC] address to read the 8 I/O lines of the
1620   flash device
1621      </para></listitem>
1622    </varlistentry>
1623    <varlistentry>      <term>IO_ADDR_W</term>
1624      <listitem><para>
1625   [BOARDSPECIFIC] address to write the 8 I/O lines of the
1626   flash device.
1627      </para></listitem>
1628    </varlistentry>
1629    <varlistentry>      <term>read_byte</term>
1630      <listitem><para>
1631   [REPLACEABLE] read one byte from the chip
1632      </para></listitem>
1633    </varlistentry>
1634    <varlistentry>      <term>read_word</term>
1635      <listitem><para>
1636   [REPLACEABLE] read one word from the chip
1637      </para></listitem>
1638    </varlistentry>
1639    <varlistentry>      <term>write_byte</term>
1640      <listitem><para>
1641   [REPLACEABLE] write a single byte to the chip on the
1642   low 8 I/O lines
1643      </para></listitem>
1644    </varlistentry>
1645    <varlistentry>      <term>write_buf</term>
1646      <listitem><para>
1647   [REPLACEABLE] write data from the buffer to the chip
1648      </para></listitem>
1649    </varlistentry>
1650    <varlistentry>      <term>read_buf</term>
1651      <listitem><para>
1652   [REPLACEABLE] read data from the chip into the buffer
1653      </para></listitem>
1654    </varlistentry>
1655    <varlistentry>      <term>select_chip</term>
1656      <listitem><para>
1657   [REPLACEABLE] select chip nr
1658      </para></listitem>
1659    </varlistentry>
1660    <varlistentry>      <term>block_bad</term>
1661      <listitem><para>
1662   [REPLACEABLE] check if a block is bad, using OOB markers
1663      </para></listitem>
1664    </varlistentry>
1665    <varlistentry>      <term>block_markbad</term>
1666      <listitem><para>
1667   [REPLACEABLE] mark a block bad
1668      </para></listitem>
1669    </varlistentry>
1670    <varlistentry>      <term>cmd_ctrl</term>
1671      <listitem><para>
1672   [BOARDSPECIFIC] hardwarespecific function for controlling
1673   ALE/CLE/nCE. Also used to write command and address
1674      </para></listitem>
1675    </varlistentry>
1676    <varlistentry>      <term>init_size</term>
1677      <listitem><para>
1678   [BOARDSPECIFIC] hardwarespecific function for setting
1679   mtd-&gt;oobsize, mtd-&gt;writesize and so on.
1680   <parameter>id_data</parameter> contains the 8 bytes values of NAND_CMD_READID.
1681   Return with the bus width.
1682      </para></listitem>
1683    </varlistentry>
1684    <varlistentry>      <term>dev_ready</term>
1685      <listitem><para>
1686   [BOARDSPECIFIC] hardwarespecific function for accessing
1687   device ready/busy line. If set to NULL no access to
1688   ready/busy is available and the ready/busy information
1689   is read from the chip status register.
1690      </para></listitem>
1691    </varlistentry>
1692    <varlistentry>      <term>cmdfunc</term>
1693      <listitem><para>
1694   [REPLACEABLE] hardwarespecific function for writing
1695   commands to the chip.
1696      </para></listitem>
1697    </varlistentry>
1698    <varlistentry>      <term>waitfunc</term>
1699      <listitem><para>
1700   [REPLACEABLE] hardwarespecific function for wait on
1701   ready.
1702      </para></listitem>
1703    </varlistentry>
1704    <varlistentry>      <term>erase</term>
1705      <listitem><para>
1706   [REPLACEABLE] erase function
1707      </para></listitem>
1708    </varlistentry>
1709    <varlistentry>      <term>scan_bbt</term>
1710      <listitem><para>
1711   [REPLACEABLE] function to scan bad block table
1712      </para></listitem>
1713    </varlistentry>
1714    <varlistentry>      <term>errstat</term>
1715      <listitem><para>
1716   [OPTIONAL] hardware specific function to perform
1717   additional error status checks (determine if errors are
1718   correctable).
1719      </para></listitem>
1720    </varlistentry>
1721    <varlistentry>      <term>write_page</term>
1722      <listitem><para>
1723   [REPLACEABLE] High-level page write function
1724      </para></listitem>
1725    </varlistentry>
1726    <varlistentry>      <term>onfi_set_features</term>
1727      <listitem><para>
1728   [REPLACEABLE] set the features for ONFI nand
1729      </para></listitem>
1730    </varlistentry>
1731    <varlistentry>      <term>onfi_get_features</term>
1732      <listitem><para>
1733   [REPLACEABLE] get the features for ONFI nand
1734      </para></listitem>
1735    </varlistentry>
1736    <varlistentry>      <term>setup_read_retry</term>
1737      <listitem><para>
1738   [FLASHSPECIFIC] flash (vendor) specific function for
1739   setting the read-retry mode. Mostly needed for MLC NAND.
1740      </para></listitem>
1741    </varlistentry>
1742    <varlistentry>      <term>chip_delay</term>
1743      <listitem><para>
1744   [BOARDSPECIFIC] chip dependent delay for transferring
1745   data from array to read regs (tR).
1746      </para></listitem>
1747    </varlistentry>
1748    <varlistentry>      <term>options</term>
1749      <listitem><para>
1750   [BOARDSPECIFIC] various chip options. They can partly
1751   be set to inform nand_scan about special functionality.
1752   See the defines for further explanation.
1753      </para></listitem>
1754    </varlistentry>
1755    <varlistentry>      <term>bbt_options</term>
1756      <listitem><para>
1757   [INTERN] bad block specific options. All options used
1758   here must come from bbm.h. By default, these options
1759   will be copied to the appropriate nand_bbt_descr's.
1760      </para></listitem>
1761    </varlistentry>
1762    <varlistentry>      <term>page_shift</term>
1763      <listitem><para>
1764   [INTERN] number of address bits in a page (column
1765   address bits).
1766      </para></listitem>
1767    </varlistentry>
1768    <varlistentry>      <term>phys_erase_shift</term>
1769      <listitem><para>
1770   [INTERN] number of address bits in a physical eraseblock
1771      </para></listitem>
1772    </varlistentry>
1773    <varlistentry>      <term>bbt_erase_shift</term>
1774      <listitem><para>
1775   [INTERN] number of address bits in a bbt entry
1776      </para></listitem>
1777    </varlistentry>
1778    <varlistentry>      <term>chip_shift</term>
1779      <listitem><para>
1780   [INTERN] number of address bits in one chip
1781      </para></listitem>
1782    </varlistentry>
1783    <varlistentry>      <term>numchips</term>
1784      <listitem><para>
1785   [INTERN] number of physical chips
1786      </para></listitem>
1787    </varlistentry>
1788    <varlistentry>      <term>chipsize</term>
1789      <listitem><para>
1790   [INTERN] the size of one chip for multichip arrays
1791      </para></listitem>
1792    </varlistentry>
1793    <varlistentry>      <term>pagemask</term>
1794      <listitem><para>
1795   [INTERN] page number mask = number of (pages / chip) - 1
1796      </para></listitem>
1797    </varlistentry>
1798    <varlistentry>      <term>pagebuf</term>
1799      <listitem><para>
1800   [INTERN] holds the pagenumber which is currently in
1801   data_buf.
1802      </para></listitem>
1803    </varlistentry>
1804    <varlistentry>      <term>pagebuf_bitflips</term>
1805      <listitem><para>
1806   [INTERN] holds the bitflip count for the page which is
1807   currently in data_buf.
1808      </para></listitem>
1809    </varlistentry>
1810    <varlistentry>      <term>subpagesize</term>
1811      <listitem><para>
1812   [INTERN] holds the subpagesize
1813      </para></listitem>
1814    </varlistentry>
1815    <varlistentry>      <term>bits_per_cell</term>
1816      <listitem><para>
1817   [INTERN] number of bits per cell. i.e., 1 means SLC.
1818      </para></listitem>
1819    </varlistentry>
1820    <varlistentry>      <term>ecc_strength_ds</term>
1821      <listitem><para>
1822   [INTERN] ECC correctability from the datasheet.
1823   Minimum amount of bit errors per <parameter>ecc_step_ds</parameter> guaranteed
1824   to be correctable. If unknown, set to zero.
1825      </para></listitem>
1826    </varlistentry>
1827    <varlistentry>      <term>ecc_step_ds</term>
1828      <listitem><para>
1829   [INTERN] ECC step required by the <parameter>ecc_strength_ds</parameter>,
1830   also from the datasheet. It is the recommended ECC step
1831   size, if known; if unknown, set to zero.
1832      </para></listitem>
1833    </varlistentry>
1834    <varlistentry>      <term>onfi_timing_mode_default</term>
1835      <listitem><para>
1836   [INTERN] default ONFI timing mode. This field is
1837   either deduced from the datasheet if the NAND
1838   chip is not ONFI compliant or set to 0 if it is
1839   (an ONFI chip is always configured in mode 0
1840   after a NAND reset)
1841      </para></listitem>
1842    </varlistentry>
1843    <varlistentry>      <term>badblockpos</term>
1844      <listitem><para>
1845   [INTERN] position of the bad block marker in the oob
1846   area.
1847      </para></listitem>
1848    </varlistentry>
1849    <varlistentry>      <term>badblockbits</term>
1850      <listitem><para>
1851   [INTERN] minimum number of set bits in a good block's
1852   bad block marker position; i.e., BBM == 11110111b is
1853   not bad when badblockbits == 7
1854      </para></listitem>
1855    </varlistentry>
1856    <varlistentry>      <term>onfi_version</term>
1857      <listitem><para>
1858   [INTERN] holds the chip ONFI version (BCD encoded),
1859   non 0 if ONFI supported.
1860      </para></listitem>
1861    </varlistentry>
1862    <varlistentry>      <term>jedec_version</term>
1863      <listitem><para>
1864   [INTERN] holds the chip JEDEC version (BCD encoded),
1865   non 0 if JEDEC supported.
1866      </para></listitem>
1867    </varlistentry>
1868    <varlistentry>      <term>{unnamed_union}</term>
1869      <listitem><para>
1870   anonymous
1871      </para></listitem>
1872    </varlistentry>
1873    <varlistentry>      <term>read_retries</term>
1874      <listitem><para>
1875   [INTERN] the number of read retry modes supported
1876      </para></listitem>
1877    </varlistentry>
1878    <varlistentry>      <term>state</term>
1879      <listitem><para>
1880   [INTERN] the current state of the NAND device
1881      </para></listitem>
1882    </varlistentry>
1883    <varlistentry>      <term>oob_poi</term>
1884      <listitem><para>
1885   "poison value buffer," used for laying out OOB data
1886   before writing
1887      </para></listitem>
1888    </varlistentry>
1889    <varlistentry>      <term>controller</term>
1890      <listitem><para>
1891   [REPLACEABLE] a pointer to a hardware controller
1892   structure which is shared among multiple independent
1893   devices.
1894      </para></listitem>
1895    </varlistentry>
1896    <varlistentry>      <term>ecc</term>
1897      <listitem><para>
1898   [BOARDSPECIFIC] ECC control structure
1899      </para></listitem>
1900    </varlistentry>
1901    <varlistentry>      <term>buffers</term>
1902      <listitem><para>
1903   buffer structure for read/write
1904      </para></listitem>
1905    </varlistentry>
1906    <varlistentry>      <term>hwcontrol</term>
1907      <listitem><para>
1908   platform-specific hardware control structure
1909      </para></listitem>
1910    </varlistentry>
1911    <varlistentry>      <term>bbt</term>
1912      <listitem><para>
1913   [INTERN] bad block table pointer
1914      </para></listitem>
1915    </varlistentry>
1916    <varlistentry>      <term>bbt_td</term>
1917      <listitem><para>
1918   [REPLACEABLE] bad block table descriptor for flash
1919   lookup.
1920      </para></listitem>
1921    </varlistentry>
1922    <varlistentry>      <term>bbt_md</term>
1923      <listitem><para>
1924   [REPLACEABLE] bad block table mirror descriptor
1925      </para></listitem>
1926    </varlistentry>
1927    <varlistentry>      <term>badblock_pattern</term>
1928      <listitem><para>
1929   [REPLACEABLE] bad block scan pattern used for initial
1930   bad block scan.
1931      </para></listitem>
1932    </varlistentry>
1933    <varlistentry>      <term>priv</term>
1934      <listitem><para>
1935   [OPTIONAL] pointer to private chip data
1936      </para></listitem>
1937    </varlistentry>
1938  </variablelist>
1939 </refsect1>
1940</refentry>
1941
1942<refentry id="API-struct-nand-flash-dev">
1943<refentryinfo>
1944 <title>LINUX</title>
1945 <productname>Kernel Hackers Manual</productname>
1946 <date>July 2017</date>
1947</refentryinfo>
1948<refmeta>
1949 <refentrytitle><phrase>struct nand_flash_dev</phrase></refentrytitle>
1950 <manvolnum>9</manvolnum>
1951 <refmiscinfo class="version">4.1.27</refmiscinfo>
1952</refmeta>
1953<refnamediv>
1954 <refname>struct nand_flash_dev</refname>
1955 <refpurpose>
1956     NAND Flash Device ID Structure
1957 </refpurpose>
1958</refnamediv>
1959<refsynopsisdiv>
1960 <title>Synopsis</title>
1961  <programlisting>
1962struct nand_flash_dev {
1963  char * name;
1964  union ecc;
1965  int onfi_timing_mode_default;
1966};  </programlisting>
1967</refsynopsisdiv>
1968 <refsect1>
1969  <title>Members</title>
1970  <variablelist>
1971    <varlistentry>      <term>name</term>
1972      <listitem><para>
1973   a human-readable name of the NAND chip
1974      </para></listitem>
1975    </varlistentry>
1976    <varlistentry>      <term>ecc</term>
1977      <listitem><para>
1978   ECC correctability and step information from the datasheet.
1979   <parameter>ecc</parameter>.strength_ds: The ECC correctability from the datasheet, same as the
1980   <parameter>ecc_strength_ds</parameter> in nand_chip{}.
1981   <parameter>ecc</parameter>.step_ds: The ECC step required by the <parameter>ecc</parameter>.strength_ds, same as the
1982   <parameter>ecc_step_ds</parameter> in nand_chip{}, also from the datasheet.
1983   For example, the <quote>4bit ECC for each 512Byte</quote> can be set with
1984   NAND_ECC_INFO(4, 512).
1985      </para></listitem>
1986    </varlistentry>
1987    <varlistentry>      <term>onfi_timing_mode_default</term>
1988      <listitem><para>
1989   the default ONFI timing mode entered after a NAND
1990   reset. Should be deduced from timings described
1991   in the datasheet.
1992      </para></listitem>
1993    </varlistentry>
1994  </variablelist>
1995 </refsect1>
1996</refentry>
1997
1998<refentry id="API-struct-nand-manufacturers">
1999<refentryinfo>
2000 <title>LINUX</title>
2001 <productname>Kernel Hackers Manual</productname>
2002 <date>July 2017</date>
2003</refentryinfo>
2004<refmeta>
2005 <refentrytitle><phrase>struct nand_manufacturers</phrase></refentrytitle>
2006 <manvolnum>9</manvolnum>
2007 <refmiscinfo class="version">4.1.27</refmiscinfo>
2008</refmeta>
2009<refnamediv>
2010 <refname>struct nand_manufacturers</refname>
2011 <refpurpose>
2012     NAND Flash Manufacturer ID Structure
2013 </refpurpose>
2014</refnamediv>
2015<refsynopsisdiv>
2016 <title>Synopsis</title>
2017  <programlisting>
2018struct nand_manufacturers {
2019  int id;
2020  char * name;
2021};  </programlisting>
2022</refsynopsisdiv>
2023 <refsect1>
2024  <title>Members</title>
2025  <variablelist>
2026    <varlistentry>      <term>id</term>
2027      <listitem><para>
2028   manufacturer ID code of device.
2029      </para></listitem>
2030    </varlistentry>
2031    <varlistentry>      <term>name</term>
2032      <listitem><para>
2033   Manufacturer name
2034      </para></listitem>
2035    </varlistentry>
2036  </variablelist>
2037 </refsect1>
2038</refentry>
2039
2040<refentry id="API-struct-platform-nand-chip">
2041<refentryinfo>
2042 <title>LINUX</title>
2043 <productname>Kernel Hackers Manual</productname>
2044 <date>July 2017</date>
2045</refentryinfo>
2046<refmeta>
2047 <refentrytitle><phrase>struct platform_nand_chip</phrase></refentrytitle>
2048 <manvolnum>9</manvolnum>
2049 <refmiscinfo class="version">4.1.27</refmiscinfo>
2050</refmeta>
2051<refnamediv>
2052 <refname>struct platform_nand_chip</refname>
2053 <refpurpose>
2054     chip level device structure
2055 </refpurpose>
2056</refnamediv>
2057<refsynopsisdiv>
2058 <title>Synopsis</title>
2059  <programlisting>
2060struct platform_nand_chip {
2061  int nr_chips;
2062  int chip_offset;
2063  int nr_partitions;
2064  struct mtd_partition * partitions;
2065  struct nand_ecclayout * ecclayout;
2066  int chip_delay;
2067  unsigned int options;
2068  unsigned int bbt_options;
2069  const char ** part_probe_types;
2070};  </programlisting>
2071</refsynopsisdiv>
2072 <refsect1>
2073  <title>Members</title>
2074  <variablelist>
2075    <varlistentry>      <term>nr_chips</term>
2076      <listitem><para>
2077   max. number of chips to scan for
2078      </para></listitem>
2079    </varlistentry>
2080    <varlistentry>      <term>chip_offset</term>
2081      <listitem><para>
2082   chip number offset
2083      </para></listitem>
2084    </varlistentry>
2085    <varlistentry>      <term>nr_partitions</term>
2086      <listitem><para>
2087   number of partitions pointed to by partitions (or zero)
2088      </para></listitem>
2089    </varlistentry>
2090    <varlistentry>      <term>partitions</term>
2091      <listitem><para>
2092   mtd partition list
2093      </para></listitem>
2094    </varlistentry>
2095    <varlistentry>      <term>ecclayout</term>
2096      <listitem><para>
2097   ECC layout info structure
2098      </para></listitem>
2099    </varlistentry>
2100    <varlistentry>      <term>chip_delay</term>
2101      <listitem><para>
2102   R/B delay value in us
2103      </para></listitem>
2104    </varlistentry>
2105    <varlistentry>      <term>options</term>
2106      <listitem><para>
2107   Option flags, e.g. 16bit buswidth
2108      </para></listitem>
2109    </varlistentry>
2110    <varlistentry>      <term>bbt_options</term>
2111      <listitem><para>
2112   BBT option flags, e.g. NAND_BBT_USE_FLASH
2113      </para></listitem>
2114    </varlistentry>
2115    <varlistentry>      <term>part_probe_types</term>
2116      <listitem><para>
2117   NULL-terminated array of probe types
2118      </para></listitem>
2119    </varlistentry>
2120  </variablelist>
2121 </refsect1>
2122</refentry>
2123
2124<refentry id="API-struct-platform-nand-ctrl">
2125<refentryinfo>
2126 <title>LINUX</title>
2127 <productname>Kernel Hackers Manual</productname>
2128 <date>July 2017</date>
2129</refentryinfo>
2130<refmeta>
2131 <refentrytitle><phrase>struct platform_nand_ctrl</phrase></refentrytitle>
2132 <manvolnum>9</manvolnum>
2133 <refmiscinfo class="version">4.1.27</refmiscinfo>
2134</refmeta>
2135<refnamediv>
2136 <refname>struct platform_nand_ctrl</refname>
2137 <refpurpose>
2138     controller level device structure
2139 </refpurpose>
2140</refnamediv>
2141<refsynopsisdiv>
2142 <title>Synopsis</title>
2143  <programlisting>
2144struct platform_nand_ctrl {
2145  int (* probe) (struct platform_device *pdev);
2146  void (* remove) (struct platform_device *pdev);
2147  void (* hwcontrol) (struct mtd_info *mtd, int cmd);
2148  int (* dev_ready) (struct mtd_info *mtd);
2149  void (* select_chip) (struct mtd_info *mtd, int chip);
2150  void (* cmd_ctrl) (struct mtd_info *mtd, int dat, unsigned int ctrl);
2151  void (* write_buf) (struct mtd_info *mtd, const uint8_t *buf, int len);
2152  void (* read_buf) (struct mtd_info *mtd, uint8_t *buf, int len);
2153  unsigned char (* read_byte) (struct mtd_info *mtd);
2154  void * priv;
2155};  </programlisting>
2156</refsynopsisdiv>
2157 <refsect1>
2158  <title>Members</title>
2159  <variablelist>
2160    <varlistentry>      <term>probe</term>
2161      <listitem><para>
2162   platform specific function to probe/setup hardware
2163      </para></listitem>
2164    </varlistentry>
2165    <varlistentry>      <term>remove</term>
2166      <listitem><para>
2167   platform specific function to remove/teardown hardware
2168      </para></listitem>
2169    </varlistentry>
2170    <varlistentry>      <term>hwcontrol</term>
2171      <listitem><para>
2172   platform specific hardware control structure
2173      </para></listitem>
2174    </varlistentry>
2175    <varlistentry>      <term>dev_ready</term>
2176      <listitem><para>
2177   platform specific function to read ready/busy pin
2178      </para></listitem>
2179    </varlistentry>
2180    <varlistentry>      <term>select_chip</term>
2181      <listitem><para>
2182   platform specific chip select function
2183      </para></listitem>
2184    </varlistentry>
2185    <varlistentry>      <term>cmd_ctrl</term>
2186      <listitem><para>
2187   platform specific function for controlling
2188   ALE/CLE/nCE. Also used to write command and address
2189      </para></listitem>
2190    </varlistentry>
2191    <varlistentry>      <term>write_buf</term>
2192      <listitem><para>
2193   platform specific function for write buffer
2194      </para></listitem>
2195    </varlistentry>
2196    <varlistentry>      <term>read_buf</term>
2197      <listitem><para>
2198   platform specific function for read buffer
2199      </para></listitem>
2200    </varlistentry>
2201    <varlistentry>      <term>read_byte</term>
2202      <listitem><para>
2203   platform specific function to read one byte from chip
2204      </para></listitem>
2205    </varlistentry>
2206    <varlistentry>      <term>priv</term>
2207      <listitem><para>
2208   private data to transport driver specific settings
2209      </para></listitem>
2210    </varlistentry>
2211  </variablelist>
2212 </refsect1>
2213<refsect1>
2214<title>Description</title>
2215<para>
2216   All fields are optional and depend on the hardware driver requirements
2217</para>
2218</refsect1>
2219</refentry>
2220
2221<refentry id="API-struct-platform-nand-data">
2222<refentryinfo>
2223 <title>LINUX</title>
2224 <productname>Kernel Hackers Manual</productname>
2225 <date>July 2017</date>
2226</refentryinfo>
2227<refmeta>
2228 <refentrytitle><phrase>struct platform_nand_data</phrase></refentrytitle>
2229 <manvolnum>9</manvolnum>
2230 <refmiscinfo class="version">4.1.27</refmiscinfo>
2231</refmeta>
2232<refnamediv>
2233 <refname>struct platform_nand_data</refname>
2234 <refpurpose>
2235     container structure for platform-specific data
2236 </refpurpose>
2237</refnamediv>
2238<refsynopsisdiv>
2239 <title>Synopsis</title>
2240  <programlisting>
2241struct platform_nand_data {
2242  struct platform_nand_chip chip;
2243  struct platform_nand_ctrl ctrl;
2244};  </programlisting>
2245</refsynopsisdiv>
2246 <refsect1>
2247  <title>Members</title>
2248  <variablelist>
2249    <varlistentry>      <term>chip</term>
2250      <listitem><para>
2251   chip level chip structure
2252      </para></listitem>
2253    </varlistentry>
2254    <varlistentry>      <term>ctrl</term>
2255      <listitem><para>
2256   controller level device structure
2257      </para></listitem>
2258    </varlistentry>
2259  </variablelist>
2260 </refsect1>
2261</refentry>
2262
2263<refentry id="API-nand-opcode-8bits">
2264<refentryinfo>
2265 <title>LINUX</title>
2266 <productname>Kernel Hackers Manual</productname>
2267 <date>July 2017</date>
2268</refentryinfo>
2269<refmeta>
2270 <refentrytitle><phrase>nand_opcode_8bits</phrase></refentrytitle>
2271 <manvolnum>9</manvolnum>
2272 <refmiscinfo class="version">4.1.27</refmiscinfo>
2273</refmeta>
2274<refnamediv>
2275 <refname>nand_opcode_8bits</refname>
2276 <refpurpose>
2277   </refpurpose>
2278</refnamediv>
2279<refsynopsisdiv>
2280 <title>Synopsis</title>
2281  <funcsynopsis><funcprototype>
2282   <funcdef>int <function>nand_opcode_8bits </function></funcdef>
2283   <paramdef>unsigned int <parameter>command</parameter></paramdef>
2284  </funcprototype></funcsynopsis>
2285</refsynopsisdiv>
2286<refsect1>
2287 <title>Arguments</title>
2288 <variablelist>
2289  <varlistentry>
2290   <term><parameter>command</parameter></term>
2291   <listitem>
2292    <para>
2293     opcode to check
2294    </para>
2295   </listitem>
2296  </varlistentry>
2297 </variablelist>
2298</refsect1>
2299</refentry>
2300
2301  </chapter>
2302
2303  <chapter id="pubfunctions">
2304     <title>Public Functions Provided</title>
2305     <para>
2306     This chapter contains the autogenerated documentation of the NAND kernel API functions
2307      which are exported. Each function has a short description which is marked with an [XXX] identifier.
2308     See the chapter "Documentation hints" for an explanation.
2309     </para>
2310<!-- drivers/mtd/nand/nand_base.c -->
2311<refentry id="API-nand-unlock">
2312<refentryinfo>
2313 <title>LINUX</title>
2314 <productname>Kernel Hackers Manual</productname>
2315 <date>July 2017</date>
2316</refentryinfo>
2317<refmeta>
2318 <refentrytitle><phrase>nand_unlock</phrase></refentrytitle>
2319 <manvolnum>9</manvolnum>
2320 <refmiscinfo class="version">4.1.27</refmiscinfo>
2321</refmeta>
2322<refnamediv>
2323 <refname>nand_unlock</refname>
2324 <refpurpose>
2325  [REPLACEABLE] unlocks specified locked blocks
2326 </refpurpose>
2327</refnamediv>
2328<refsynopsisdiv>
2329 <title>Synopsis</title>
2330  <funcsynopsis><funcprototype>
2331   <funcdef>int <function>nand_unlock </function></funcdef>
2332   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
2333   <paramdef>loff_t <parameter>ofs</parameter></paramdef>
2334   <paramdef>uint64_t <parameter>len</parameter></paramdef>
2335  </funcprototype></funcsynopsis>
2336</refsynopsisdiv>
2337<refsect1>
2338 <title>Arguments</title>
2339 <variablelist>
2340  <varlistentry>
2341   <term><parameter>mtd</parameter></term>
2342   <listitem>
2343    <para>
2344     mtd info
2345    </para>
2346   </listitem>
2347  </varlistentry>
2348  <varlistentry>
2349   <term><parameter>ofs</parameter></term>
2350   <listitem>
2351    <para>
2352     offset to start unlock from
2353    </para>
2354   </listitem>
2355  </varlistentry>
2356  <varlistentry>
2357   <term><parameter>len</parameter></term>
2358   <listitem>
2359    <para>
2360     length to unlock
2361    </para>
2362   </listitem>
2363  </varlistentry>
2364 </variablelist>
2365</refsect1>
2366<refsect1>
2367<title>Description</title>
2368<para>
2369   Returns unlock status.
2370</para>
2371</refsect1>
2372</refentry>
2373
2374<refentry id="API-nand-lock">
2375<refentryinfo>
2376 <title>LINUX</title>
2377 <productname>Kernel Hackers Manual</productname>
2378 <date>July 2017</date>
2379</refentryinfo>
2380<refmeta>
2381 <refentrytitle><phrase>nand_lock</phrase></refentrytitle>
2382 <manvolnum>9</manvolnum>
2383 <refmiscinfo class="version">4.1.27</refmiscinfo>
2384</refmeta>
2385<refnamediv>
2386 <refname>nand_lock</refname>
2387 <refpurpose>
2388     [REPLACEABLE] locks all blocks present in the device
2389 </refpurpose>
2390</refnamediv>
2391<refsynopsisdiv>
2392 <title>Synopsis</title>
2393  <funcsynopsis><funcprototype>
2394   <funcdef>int <function>nand_lock </function></funcdef>
2395   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
2396   <paramdef>loff_t <parameter>ofs</parameter></paramdef>
2397   <paramdef>uint64_t <parameter>len</parameter></paramdef>
2398  </funcprototype></funcsynopsis>
2399</refsynopsisdiv>
2400<refsect1>
2401 <title>Arguments</title>
2402 <variablelist>
2403  <varlistentry>
2404   <term><parameter>mtd</parameter></term>
2405   <listitem>
2406    <para>
2407     mtd info
2408    </para>
2409   </listitem>
2410  </varlistentry>
2411  <varlistentry>
2412   <term><parameter>ofs</parameter></term>
2413   <listitem>
2414    <para>
2415     offset to start unlock from
2416    </para>
2417   </listitem>
2418  </varlistentry>
2419  <varlistentry>
2420   <term><parameter>len</parameter></term>
2421   <listitem>
2422    <para>
2423     length to unlock
2424    </para>
2425   </listitem>
2426  </varlistentry>
2427 </variablelist>
2428</refsect1>
2429<refsect1>
2430<title>Description</title>
2431<para>
2432   This feature is not supported in many NAND parts. 'Micron' NAND parts do
2433   have this feature, but it allows only to lock all blocks, not for specified
2434   range for block. Implementing 'lock' feature by making use of 'unlock', for
2435   now.
2436   </para><para>
2437
2438   Returns lock status.
2439</para>
2440</refsect1>
2441</refentry>
2442
2443<refentry id="API-nand-scan-ident">
2444<refentryinfo>
2445 <title>LINUX</title>
2446 <productname>Kernel Hackers Manual</productname>
2447 <date>July 2017</date>
2448</refentryinfo>
2449<refmeta>
2450 <refentrytitle><phrase>nand_scan_ident</phrase></refentrytitle>
2451 <manvolnum>9</manvolnum>
2452 <refmiscinfo class="version">4.1.27</refmiscinfo>
2453</refmeta>
2454<refnamediv>
2455 <refname>nand_scan_ident</refname>
2456 <refpurpose>
2457     [NAND Interface] Scan for the NAND device
2458 </refpurpose>
2459</refnamediv>
2460<refsynopsisdiv>
2461 <title>Synopsis</title>
2462  <funcsynopsis><funcprototype>
2463   <funcdef>int <function>nand_scan_ident </function></funcdef>
2464   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
2465   <paramdef>int <parameter>maxchips</parameter></paramdef>
2466   <paramdef>struct nand_flash_dev * <parameter>table</parameter></paramdef>
2467  </funcprototype></funcsynopsis>
2468</refsynopsisdiv>
2469<refsect1>
2470 <title>Arguments</title>
2471 <variablelist>
2472  <varlistentry>
2473   <term><parameter>mtd</parameter></term>
2474   <listitem>
2475    <para>
2476     MTD device structure
2477    </para>
2478   </listitem>
2479  </varlistentry>
2480  <varlistentry>
2481   <term><parameter>maxchips</parameter></term>
2482   <listitem>
2483    <para>
2484     number of chips to scan for
2485    </para>
2486   </listitem>
2487  </varlistentry>
2488  <varlistentry>
2489   <term><parameter>table</parameter></term>
2490   <listitem>
2491    <para>
2492     alternative NAND ID table
2493    </para>
2494   </listitem>
2495  </varlistentry>
2496 </variablelist>
2497</refsect1>
2498<refsect1>
2499<title>Description</title>
2500<para>
2501   This is the first phase of the normal <function>nand_scan</function> function. It reads the
2502   flash ID and sets up MTD fields accordingly.
2503   </para><para>
2504
2505   The mtd-&gt;owner field must be set to the module of the caller.
2506</para>
2507</refsect1>
2508</refentry>
2509
2510<refentry id="API-nand-scan-tail">
2511<refentryinfo>
2512 <title>LINUX</title>
2513 <productname>Kernel Hackers Manual</productname>
2514 <date>July 2017</date>
2515</refentryinfo>
2516<refmeta>
2517 <refentrytitle><phrase>nand_scan_tail</phrase></refentrytitle>
2518 <manvolnum>9</manvolnum>
2519 <refmiscinfo class="version">4.1.27</refmiscinfo>
2520</refmeta>
2521<refnamediv>
2522 <refname>nand_scan_tail</refname>
2523 <refpurpose>
2524     [NAND Interface] Scan for the NAND device
2525 </refpurpose>
2526</refnamediv>
2527<refsynopsisdiv>
2528 <title>Synopsis</title>
2529  <funcsynopsis><funcprototype>
2530   <funcdef>int <function>nand_scan_tail </function></funcdef>
2531   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
2532  </funcprototype></funcsynopsis>
2533</refsynopsisdiv>
2534<refsect1>
2535 <title>Arguments</title>
2536 <variablelist>
2537  <varlistentry>
2538   <term><parameter>mtd</parameter></term>
2539   <listitem>
2540    <para>
2541     MTD device structure
2542    </para>
2543   </listitem>
2544  </varlistentry>
2545 </variablelist>
2546</refsect1>
2547<refsect1>
2548<title>Description</title>
2549<para>
2550   This is the second phase of the normal <function>nand_scan</function> function. It fills out
2551   all the uninitialized function pointers with the defaults and scans for a
2552   bad block table if appropriate.
2553</para>
2554</refsect1>
2555</refentry>
2556
2557<refentry id="API-nand-scan">
2558<refentryinfo>
2559 <title>LINUX</title>
2560 <productname>Kernel Hackers Manual</productname>
2561 <date>July 2017</date>
2562</refentryinfo>
2563<refmeta>
2564 <refentrytitle><phrase>nand_scan</phrase></refentrytitle>
2565 <manvolnum>9</manvolnum>
2566 <refmiscinfo class="version">4.1.27</refmiscinfo>
2567</refmeta>
2568<refnamediv>
2569 <refname>nand_scan</refname>
2570 <refpurpose>
2571     [NAND Interface] Scan for the NAND device
2572 </refpurpose>
2573</refnamediv>
2574<refsynopsisdiv>
2575 <title>Synopsis</title>
2576  <funcsynopsis><funcprototype>
2577   <funcdef>int <function>nand_scan </function></funcdef>
2578   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
2579   <paramdef>int <parameter>maxchips</parameter></paramdef>
2580  </funcprototype></funcsynopsis>
2581</refsynopsisdiv>
2582<refsect1>
2583 <title>Arguments</title>
2584 <variablelist>
2585  <varlistentry>
2586   <term><parameter>mtd</parameter></term>
2587   <listitem>
2588    <para>
2589     MTD device structure
2590    </para>
2591   </listitem>
2592  </varlistentry>
2593  <varlistentry>
2594   <term><parameter>maxchips</parameter></term>
2595   <listitem>
2596    <para>
2597     number of chips to scan for
2598    </para>
2599   </listitem>
2600  </varlistentry>
2601 </variablelist>
2602</refsect1>
2603<refsect1>
2604<title>Description</title>
2605<para>
2606   This fills out all the uninitialized function pointers with the defaults.
2607   The flash ID is read and the mtd/chip structures are filled with the
2608   appropriate values. The mtd-&gt;owner field must be set to the module of the
2609   caller.
2610</para>
2611</refsect1>
2612</refentry>
2613
2614<refentry id="API-nand-release">
2615<refentryinfo>
2616 <title>LINUX</title>
2617 <productname>Kernel Hackers Manual</productname>
2618 <date>July 2017</date>
2619</refentryinfo>
2620<refmeta>
2621 <refentrytitle><phrase>nand_release</phrase></refentrytitle>
2622 <manvolnum>9</manvolnum>
2623 <refmiscinfo class="version">4.1.27</refmiscinfo>
2624</refmeta>
2625<refnamediv>
2626 <refname>nand_release</refname>
2627 <refpurpose>
2628     [NAND Interface] Free resources held by the NAND device
2629 </refpurpose>
2630</refnamediv>
2631<refsynopsisdiv>
2632 <title>Synopsis</title>
2633  <funcsynopsis><funcprototype>
2634   <funcdef>void <function>nand_release </function></funcdef>
2635   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
2636  </funcprototype></funcsynopsis>
2637</refsynopsisdiv>
2638<refsect1>
2639 <title>Arguments</title>
2640 <variablelist>
2641  <varlistentry>
2642   <term><parameter>mtd</parameter></term>
2643   <listitem>
2644    <para>
2645     MTD device structure
2646    </para>
2647   </listitem>
2648  </varlistentry>
2649 </variablelist>
2650</refsect1>
2651</refentry>
2652
2653<!-- drivers/mtd/nand/nand_bbt.c -->
2654<refentry id="API-nand-scan-bbt">
2655<refentryinfo>
2656 <title>LINUX</title>
2657 <productname>Kernel Hackers Manual</productname>
2658 <date>July 2017</date>
2659</refentryinfo>
2660<refmeta>
2661 <refentrytitle><phrase>nand_scan_bbt</phrase></refentrytitle>
2662 <manvolnum>9</manvolnum>
2663 <refmiscinfo class="version">4.1.27</refmiscinfo>
2664</refmeta>
2665<refnamediv>
2666 <refname>nand_scan_bbt</refname>
2667 <refpurpose>
2668  [NAND Interface] scan, find, read and maybe create bad block table(s)
2669 </refpurpose>
2670</refnamediv>
2671<refsynopsisdiv>
2672 <title>Synopsis</title>
2673  <funcsynopsis><funcprototype>
2674   <funcdef>int <function>nand_scan_bbt </function></funcdef>
2675   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
2676   <paramdef>struct nand_bbt_descr * <parameter>bd</parameter></paramdef>
2677  </funcprototype></funcsynopsis>
2678</refsynopsisdiv>
2679<refsect1>
2680 <title>Arguments</title>
2681 <variablelist>
2682  <varlistentry>
2683   <term><parameter>mtd</parameter></term>
2684   <listitem>
2685    <para>
2686     MTD device structure
2687    </para>
2688   </listitem>
2689  </varlistentry>
2690  <varlistentry>
2691   <term><parameter>bd</parameter></term>
2692   <listitem>
2693    <para>
2694     descriptor for the good/bad block search pattern
2695    </para>
2696   </listitem>
2697  </varlistentry>
2698 </variablelist>
2699</refsect1>
2700<refsect1>
2701<title>Description</title>
2702<para>
2703   The function checks, if a bad block table(s) is/are already available. If
2704   not it scans the device for manufacturer marked good / bad blocks and writes
2705   the bad block table(s) to the selected place.
2706   </para><para>
2707
2708   The bad block table memory is allocated here. It must be freed by calling
2709   the nand_free_bbt function.
2710</para>
2711</refsect1>
2712</refentry>
2713
2714<!-- drivers/mtd/nand/nand_ecc.c -->
2715<refentry id="API---nand-calculate-ecc">
2716<refentryinfo>
2717 <title>LINUX</title>
2718 <productname>Kernel Hackers Manual</productname>
2719 <date>July 2017</date>
2720</refentryinfo>
2721<refmeta>
2722 <refentrytitle><phrase>__nand_calculate_ecc</phrase></refentrytitle>
2723 <manvolnum>9</manvolnum>
2724 <refmiscinfo class="version">4.1.27</refmiscinfo>
2725</refmeta>
2726<refnamediv>
2727 <refname>__nand_calculate_ecc</refname>
2728 <refpurpose>
2729  [NAND Interface] Calculate 3-byte ECC for 256/512-byte block
2730 </refpurpose>
2731</refnamediv>
2732<refsynopsisdiv>
2733 <title>Synopsis</title>
2734  <funcsynopsis><funcprototype>
2735   <funcdef>void <function>__nand_calculate_ecc </function></funcdef>
2736   <paramdef>const unsigned char * <parameter>buf</parameter></paramdef>
2737   <paramdef>unsigned int <parameter>eccsize</parameter></paramdef>
2738   <paramdef>unsigned char * <parameter>code</parameter></paramdef>
2739  </funcprototype></funcsynopsis>
2740</refsynopsisdiv>
2741<refsect1>
2742 <title>Arguments</title>
2743 <variablelist>
2744  <varlistentry>
2745   <term><parameter>buf</parameter></term>
2746   <listitem>
2747    <para>
2748     input buffer with raw data
2749    </para>
2750   </listitem>
2751  </varlistentry>
2752  <varlistentry>
2753   <term><parameter>eccsize</parameter></term>
2754   <listitem>
2755    <para>
2756     data bytes per ECC step (256 or 512)
2757    </para>
2758   </listitem>
2759  </varlistentry>
2760  <varlistentry>
2761   <term><parameter>code</parameter></term>
2762   <listitem>
2763    <para>
2764     output buffer with ECC
2765    </para>
2766   </listitem>
2767  </varlistentry>
2768 </variablelist>
2769</refsect1>
2770</refentry>
2771
2772<refentry id="API-nand-calculate-ecc">
2773<refentryinfo>
2774 <title>LINUX</title>
2775 <productname>Kernel Hackers Manual</productname>
2776 <date>July 2017</date>
2777</refentryinfo>
2778<refmeta>
2779 <refentrytitle><phrase>nand_calculate_ecc</phrase></refentrytitle>
2780 <manvolnum>9</manvolnum>
2781 <refmiscinfo class="version">4.1.27</refmiscinfo>
2782</refmeta>
2783<refnamediv>
2784 <refname>nand_calculate_ecc</refname>
2785 <refpurpose>
2786     [NAND Interface] Calculate 3-byte ECC for 256/512-byte block
2787 </refpurpose>
2788</refnamediv>
2789<refsynopsisdiv>
2790 <title>Synopsis</title>
2791  <funcsynopsis><funcprototype>
2792   <funcdef>int <function>nand_calculate_ecc </function></funcdef>
2793   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
2794   <paramdef>const unsigned char * <parameter>buf</parameter></paramdef>
2795   <paramdef>unsigned char * <parameter>code</parameter></paramdef>
2796  </funcprototype></funcsynopsis>
2797</refsynopsisdiv>
2798<refsect1>
2799 <title>Arguments</title>
2800 <variablelist>
2801  <varlistentry>
2802   <term><parameter>mtd</parameter></term>
2803   <listitem>
2804    <para>
2805     MTD block structure
2806    </para>
2807   </listitem>
2808  </varlistentry>
2809  <varlistentry>
2810   <term><parameter>buf</parameter></term>
2811   <listitem>
2812    <para>
2813     input buffer with raw data
2814    </para>
2815   </listitem>
2816  </varlistentry>
2817  <varlistentry>
2818   <term><parameter>code</parameter></term>
2819   <listitem>
2820    <para>
2821     output buffer with ECC
2822    </para>
2823   </listitem>
2824  </varlistentry>
2825 </variablelist>
2826</refsect1>
2827</refentry>
2828
2829<refentry id="API---nand-correct-data">
2830<refentryinfo>
2831 <title>LINUX</title>
2832 <productname>Kernel Hackers Manual</productname>
2833 <date>July 2017</date>
2834</refentryinfo>
2835<refmeta>
2836 <refentrytitle><phrase>__nand_correct_data</phrase></refentrytitle>
2837 <manvolnum>9</manvolnum>
2838 <refmiscinfo class="version">4.1.27</refmiscinfo>
2839</refmeta>
2840<refnamediv>
2841 <refname>__nand_correct_data</refname>
2842 <refpurpose>
2843     [NAND Interface] Detect and correct bit error(s)
2844 </refpurpose>
2845</refnamediv>
2846<refsynopsisdiv>
2847 <title>Synopsis</title>
2848  <funcsynopsis><funcprototype>
2849   <funcdef>int <function>__nand_correct_data </function></funcdef>
2850   <paramdef>unsigned char * <parameter>buf</parameter></paramdef>
2851   <paramdef>unsigned char * <parameter>read_ecc</parameter></paramdef>
2852   <paramdef>unsigned char * <parameter>calc_ecc</parameter></paramdef>
2853   <paramdef>unsigned int <parameter>eccsize</parameter></paramdef>
2854  </funcprototype></funcsynopsis>
2855</refsynopsisdiv>
2856<refsect1>
2857 <title>Arguments</title>
2858 <variablelist>
2859  <varlistentry>
2860   <term><parameter>buf</parameter></term>
2861   <listitem>
2862    <para>
2863     raw data read from the chip
2864    </para>
2865   </listitem>
2866  </varlistentry>
2867  <varlistentry>
2868   <term><parameter>read_ecc</parameter></term>
2869   <listitem>
2870    <para>
2871     ECC from the chip
2872    </para>
2873   </listitem>
2874  </varlistentry>
2875  <varlistentry>
2876   <term><parameter>calc_ecc</parameter></term>
2877   <listitem>
2878    <para>
2879     the ECC calculated from raw data
2880    </para>
2881   </listitem>
2882  </varlistentry>
2883  <varlistentry>
2884   <term><parameter>eccsize</parameter></term>
2885   <listitem>
2886    <para>
2887     data bytes per ECC step (256 or 512)
2888    </para>
2889   </listitem>
2890  </varlistentry>
2891 </variablelist>
2892</refsect1>
2893<refsect1>
2894<title>Description</title>
2895<para>
2896   Detect and correct a 1 bit error for eccsize byte block
2897</para>
2898</refsect1>
2899</refentry>
2900
2901<refentry id="API-nand-correct-data">
2902<refentryinfo>
2903 <title>LINUX</title>
2904 <productname>Kernel Hackers Manual</productname>
2905 <date>July 2017</date>
2906</refentryinfo>
2907<refmeta>
2908 <refentrytitle><phrase>nand_correct_data</phrase></refentrytitle>
2909 <manvolnum>9</manvolnum>
2910 <refmiscinfo class="version">4.1.27</refmiscinfo>
2911</refmeta>
2912<refnamediv>
2913 <refname>nand_correct_data</refname>
2914 <refpurpose>
2915     [NAND Interface] Detect and correct bit error(s)
2916 </refpurpose>
2917</refnamediv>
2918<refsynopsisdiv>
2919 <title>Synopsis</title>
2920  <funcsynopsis><funcprototype>
2921   <funcdef>int <function>nand_correct_data </function></funcdef>
2922   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
2923   <paramdef>unsigned char * <parameter>buf</parameter></paramdef>
2924   <paramdef>unsigned char * <parameter>read_ecc</parameter></paramdef>
2925   <paramdef>unsigned char * <parameter>calc_ecc</parameter></paramdef>
2926  </funcprototype></funcsynopsis>
2927</refsynopsisdiv>
2928<refsect1>
2929 <title>Arguments</title>
2930 <variablelist>
2931  <varlistentry>
2932   <term><parameter>mtd</parameter></term>
2933   <listitem>
2934    <para>
2935     MTD block structure
2936    </para>
2937   </listitem>
2938  </varlistentry>
2939  <varlistentry>
2940   <term><parameter>buf</parameter></term>
2941   <listitem>
2942    <para>
2943     raw data read from the chip
2944    </para>
2945   </listitem>
2946  </varlistentry>
2947  <varlistentry>
2948   <term><parameter>read_ecc</parameter></term>
2949   <listitem>
2950    <para>
2951     ECC from the chip
2952    </para>
2953   </listitem>
2954  </varlistentry>
2955  <varlistentry>
2956   <term><parameter>calc_ecc</parameter></term>
2957   <listitem>
2958    <para>
2959     the ECC calculated from raw data
2960    </para>
2961   </listitem>
2962  </varlistentry>
2963 </variablelist>
2964</refsect1>
2965<refsect1>
2966<title>Description</title>
2967<para>
2968   Detect and correct a 1 bit error for 256/512 byte block
2969</para>
2970</refsect1>
2971</refentry>
2972
2973  </chapter>
2974  
2975  <chapter id="intfunctions">
2976     <title>Internal Functions Provided</title>
2977     <para>
2978     This chapter contains the autogenerated documentation of the NAND driver internal functions.
2979     Each function has a short description which is marked with an [XXX] identifier.
2980     See the chapter "Documentation hints" for an explanation.
2981     The functions marked with [DEFAULT] might be relevant for a board driver developer.
2982     </para>
2983<!-- drivers/mtd/nand/nand_base.c -->
2984<refentry id="API-nand-release-device">
2985<refentryinfo>
2986 <title>LINUX</title>
2987 <productname>Kernel Hackers Manual</productname>
2988 <date>July 2017</date>
2989</refentryinfo>
2990<refmeta>
2991 <refentrytitle><phrase>nand_release_device</phrase></refentrytitle>
2992 <manvolnum>9</manvolnum>
2993 <refmiscinfo class="version">4.1.27</refmiscinfo>
2994</refmeta>
2995<refnamediv>
2996 <refname>nand_release_device</refname>
2997 <refpurpose>
2998  [GENERIC] release chip
2999 </refpurpose>
3000</refnamediv>
3001<refsynopsisdiv>
3002 <title>Synopsis</title>
3003  <funcsynopsis><funcprototype>
3004   <funcdef>void <function>nand_release_device </function></funcdef>
3005   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3006  </funcprototype></funcsynopsis>
3007</refsynopsisdiv>
3008<refsect1>
3009 <title>Arguments</title>
3010 <variablelist>
3011  <varlistentry>
3012   <term><parameter>mtd</parameter></term>
3013   <listitem>
3014    <para>
3015     MTD device structure
3016    </para>
3017   </listitem>
3018  </varlistentry>
3019 </variablelist>
3020</refsect1>
3021<refsect1>
3022<title>Description</title>
3023<para>
3024   Release chip lock and wake up anyone waiting on the device.
3025</para>
3026</refsect1>
3027</refentry>
3028
3029<refentry id="API-nand-read-byte">
3030<refentryinfo>
3031 <title>LINUX</title>
3032 <productname>Kernel Hackers Manual</productname>
3033 <date>July 2017</date>
3034</refentryinfo>
3035<refmeta>
3036 <refentrytitle><phrase>nand_read_byte</phrase></refentrytitle>
3037 <manvolnum>9</manvolnum>
3038 <refmiscinfo class="version">4.1.27</refmiscinfo>
3039</refmeta>
3040<refnamediv>
3041 <refname>nand_read_byte</refname>
3042 <refpurpose>
3043     [DEFAULT] read one byte from the chip
3044 </refpurpose>
3045</refnamediv>
3046<refsynopsisdiv>
3047 <title>Synopsis</title>
3048  <funcsynopsis><funcprototype>
3049   <funcdef>uint8_t <function>nand_read_byte </function></funcdef>
3050   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3051  </funcprototype></funcsynopsis>
3052</refsynopsisdiv>
3053<refsect1>
3054 <title>Arguments</title>
3055 <variablelist>
3056  <varlistentry>
3057   <term><parameter>mtd</parameter></term>
3058   <listitem>
3059    <para>
3060     MTD device structure
3061    </para>
3062   </listitem>
3063  </varlistentry>
3064 </variablelist>
3065</refsect1>
3066<refsect1>
3067<title>Description</title>
3068<para>
3069   Default read function for 8bit buswidth
3070</para>
3071</refsect1>
3072</refentry>
3073
3074<refentry id="API-nand-read-byte16">
3075<refentryinfo>
3076 <title>LINUX</title>
3077 <productname>Kernel Hackers Manual</productname>
3078 <date>July 2017</date>
3079</refentryinfo>
3080<refmeta>
3081 <refentrytitle><phrase>nand_read_byte16</phrase></refentrytitle>
3082 <manvolnum>9</manvolnum>
3083 <refmiscinfo class="version">4.1.27</refmiscinfo>
3084</refmeta>
3085<refnamediv>
3086 <refname>nand_read_byte16</refname>
3087 <refpurpose>
3088     [DEFAULT] read one byte endianness aware from the chip
3089 </refpurpose>
3090</refnamediv>
3091<refsynopsisdiv>
3092 <title>Synopsis</title>
3093  <funcsynopsis><funcprototype>
3094   <funcdef>uint8_t <function>nand_read_byte16 </function></funcdef>
3095   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3096  </funcprototype></funcsynopsis>
3097</refsynopsisdiv>
3098<refsect1>
3099 <title>Arguments</title>
3100 <variablelist>
3101  <varlistentry>
3102   <term><parameter>mtd</parameter></term>
3103   <listitem>
3104    <para>
3105     MTD device structure
3106    </para>
3107   </listitem>
3108  </varlistentry>
3109 </variablelist>
3110</refsect1>
3111<refsect1>
3112<title>Description</title>
3113<para>
3114   Default read function for 16bit buswidth with endianness conversion.
3115</para>
3116</refsect1>
3117</refentry>
3118
3119<refentry id="API-nand-read-word">
3120<refentryinfo>
3121 <title>LINUX</title>
3122 <productname>Kernel Hackers Manual</productname>
3123 <date>July 2017</date>
3124</refentryinfo>
3125<refmeta>
3126 <refentrytitle><phrase>nand_read_word</phrase></refentrytitle>
3127 <manvolnum>9</manvolnum>
3128 <refmiscinfo class="version">4.1.27</refmiscinfo>
3129</refmeta>
3130<refnamediv>
3131 <refname>nand_read_word</refname>
3132 <refpurpose>
3133     [DEFAULT] read one word from the chip
3134 </refpurpose>
3135</refnamediv>
3136<refsynopsisdiv>
3137 <title>Synopsis</title>
3138  <funcsynopsis><funcprototype>
3139   <funcdef>u16 <function>nand_read_word </function></funcdef>
3140   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3141  </funcprototype></funcsynopsis>
3142</refsynopsisdiv>
3143<refsect1>
3144 <title>Arguments</title>
3145 <variablelist>
3146  <varlistentry>
3147   <term><parameter>mtd</parameter></term>
3148   <listitem>
3149    <para>
3150     MTD device structure
3151    </para>
3152   </listitem>
3153  </varlistentry>
3154 </variablelist>
3155</refsect1>
3156<refsect1>
3157<title>Description</title>
3158<para>
3159   Default read function for 16bit buswidth without endianness conversion.
3160</para>
3161</refsect1>
3162</refentry>
3163
3164<refentry id="API-nand-select-chip">
3165<refentryinfo>
3166 <title>LINUX</title>
3167 <productname>Kernel Hackers Manual</productname>
3168 <date>July 2017</date>
3169</refentryinfo>
3170<refmeta>
3171 <refentrytitle><phrase>nand_select_chip</phrase></refentrytitle>
3172 <manvolnum>9</manvolnum>
3173 <refmiscinfo class="version">4.1.27</refmiscinfo>
3174</refmeta>
3175<refnamediv>
3176 <refname>nand_select_chip</refname>
3177 <refpurpose>
3178     [DEFAULT] control CE line
3179 </refpurpose>
3180</refnamediv>
3181<refsynopsisdiv>
3182 <title>Synopsis</title>
3183  <funcsynopsis><funcprototype>
3184   <funcdef>void <function>nand_select_chip </function></funcdef>
3185   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3186   <paramdef>int <parameter>chipnr</parameter></paramdef>
3187  </funcprototype></funcsynopsis>
3188</refsynopsisdiv>
3189<refsect1>
3190 <title>Arguments</title>
3191 <variablelist>
3192  <varlistentry>
3193   <term><parameter>mtd</parameter></term>
3194   <listitem>
3195    <para>
3196     MTD device structure
3197    </para>
3198   </listitem>
3199  </varlistentry>
3200  <varlistentry>
3201   <term><parameter>chipnr</parameter></term>
3202   <listitem>
3203    <para>
3204     chipnumber to select, -1 for deselect
3205    </para>
3206   </listitem>
3207  </varlistentry>
3208 </variablelist>
3209</refsect1>
3210<refsect1>
3211<title>Description</title>
3212<para>
3213   Default select function for 1 chip devices.
3214</para>
3215</refsect1>
3216</refentry>
3217
3218<refentry id="API-nand-write-byte">
3219<refentryinfo>
3220 <title>LINUX</title>
3221 <productname>Kernel Hackers Manual</productname>
3222 <date>July 2017</date>
3223</refentryinfo>
3224<refmeta>
3225 <refentrytitle><phrase>nand_write_byte</phrase></refentrytitle>
3226 <manvolnum>9</manvolnum>
3227 <refmiscinfo class="version">4.1.27</refmiscinfo>
3228</refmeta>
3229<refnamediv>
3230 <refname>nand_write_byte</refname>
3231 <refpurpose>
3232     [DEFAULT] write single byte to chip
3233 </refpurpose>
3234</refnamediv>
3235<refsynopsisdiv>
3236 <title>Synopsis</title>
3237  <funcsynopsis><funcprototype>
3238   <funcdef>void <function>nand_write_byte </function></funcdef>
3239   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3240   <paramdef>uint8_t <parameter>byte</parameter></paramdef>
3241  </funcprototype></funcsynopsis>
3242</refsynopsisdiv>
3243<refsect1>
3244 <title>Arguments</title>
3245 <variablelist>
3246  <varlistentry>
3247   <term><parameter>mtd</parameter></term>
3248   <listitem>
3249    <para>
3250     MTD device structure
3251    </para>
3252   </listitem>
3253  </varlistentry>
3254  <varlistentry>
3255   <term><parameter>byte</parameter></term>
3256   <listitem>
3257    <para>
3258     value to write
3259    </para>
3260   </listitem>
3261  </varlistentry>
3262 </variablelist>
3263</refsect1>
3264<refsect1>
3265<title>Description</title>
3266<para>
3267   Default function to write a byte to I/O[7:0]
3268</para>
3269</refsect1>
3270</refentry>
3271
3272<refentry id="API-nand-write-byte16">
3273<refentryinfo>
3274 <title>LINUX</title>
3275 <productname>Kernel Hackers Manual</productname>
3276 <date>July 2017</date>
3277</refentryinfo>
3278<refmeta>
3279 <refentrytitle><phrase>nand_write_byte16</phrase></refentrytitle>
3280 <manvolnum>9</manvolnum>
3281 <refmiscinfo class="version">4.1.27</refmiscinfo>
3282</refmeta>
3283<refnamediv>
3284 <refname>nand_write_byte16</refname>
3285 <refpurpose>
3286     [DEFAULT] write single byte to a chip with width 16
3287 </refpurpose>
3288</refnamediv>
3289<refsynopsisdiv>
3290 <title>Synopsis</title>
3291  <funcsynopsis><funcprototype>
3292   <funcdef>void <function>nand_write_byte16 </function></funcdef>
3293   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3294   <paramdef>uint8_t <parameter>byte</parameter></paramdef>
3295  </funcprototype></funcsynopsis>
3296</refsynopsisdiv>
3297<refsect1>
3298 <title>Arguments</title>
3299 <variablelist>
3300  <varlistentry>
3301   <term><parameter>mtd</parameter></term>
3302   <listitem>
3303    <para>
3304     MTD device structure
3305    </para>
3306   </listitem>
3307  </varlistentry>
3308  <varlistentry>
3309   <term><parameter>byte</parameter></term>
3310   <listitem>
3311    <para>
3312     value to write
3313    </para>
3314   </listitem>
3315  </varlistentry>
3316 </variablelist>
3317</refsect1>
3318<refsect1>
3319<title>Description</title>
3320<para>
3321   Default function to write a byte to I/O[7:0] on a 16-bit wide chip.
3322</para>
3323</refsect1>
3324</refentry>
3325
3326<refentry id="API-nand-write-buf">
3327<refentryinfo>
3328 <title>LINUX</title>
3329 <productname>Kernel Hackers Manual</productname>
3330 <date>July 2017</date>
3331</refentryinfo>
3332<refmeta>
3333 <refentrytitle><phrase>nand_write_buf</phrase></refentrytitle>
3334 <manvolnum>9</manvolnum>
3335 <refmiscinfo class="version">4.1.27</refmiscinfo>
3336</refmeta>
3337<refnamediv>
3338 <refname>nand_write_buf</refname>
3339 <refpurpose>
3340     [DEFAULT] write buffer to chip
3341 </refpurpose>
3342</refnamediv>
3343<refsynopsisdiv>
3344 <title>Synopsis</title>
3345  <funcsynopsis><funcprototype>
3346   <funcdef>void <function>nand_write_buf </function></funcdef>
3347   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3348   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
3349   <paramdef>int <parameter>len</parameter></paramdef>
3350  </funcprototype></funcsynopsis>
3351</refsynopsisdiv>
3352<refsect1>
3353 <title>Arguments</title>
3354 <variablelist>
3355  <varlistentry>
3356   <term><parameter>mtd</parameter></term>
3357   <listitem>
3358    <para>
3359     MTD device structure
3360    </para>
3361   </listitem>
3362  </varlistentry>
3363  <varlistentry>
3364   <term><parameter>buf</parameter></term>
3365   <listitem>
3366    <para>
3367     data buffer
3368    </para>
3369   </listitem>
3370  </varlistentry>
3371  <varlistentry>
3372   <term><parameter>len</parameter></term>
3373   <listitem>
3374    <para>
3375     number of bytes to write
3376    </para>
3377   </listitem>
3378  </varlistentry>
3379 </variablelist>
3380</refsect1>
3381<refsect1>
3382<title>Description</title>
3383<para>
3384   Default write function for 8bit buswidth.
3385</para>
3386</refsect1>
3387</refentry>
3388
3389<refentry id="API-nand-read-buf">
3390<refentryinfo>
3391 <title>LINUX</title>
3392 <productname>Kernel Hackers Manual</productname>
3393 <date>July 2017</date>
3394</refentryinfo>
3395<refmeta>
3396 <refentrytitle><phrase>nand_read_buf</phrase></refentrytitle>
3397 <manvolnum>9</manvolnum>
3398 <refmiscinfo class="version">4.1.27</refmiscinfo>
3399</refmeta>
3400<refnamediv>
3401 <refname>nand_read_buf</refname>
3402 <refpurpose>
3403     [DEFAULT] read chip data into buffer
3404 </refpurpose>
3405</refnamediv>
3406<refsynopsisdiv>
3407 <title>Synopsis</title>
3408  <funcsynopsis><funcprototype>
3409   <funcdef>void <function>nand_read_buf </function></funcdef>
3410   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3411   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
3412   <paramdef>int <parameter>len</parameter></paramdef>
3413  </funcprototype></funcsynopsis>
3414</refsynopsisdiv>
3415<refsect1>
3416 <title>Arguments</title>
3417 <variablelist>
3418  <varlistentry>
3419   <term><parameter>mtd</parameter></term>
3420   <listitem>
3421    <para>
3422     MTD device structure
3423    </para>
3424   </listitem>
3425  </varlistentry>
3426  <varlistentry>
3427   <term><parameter>buf</parameter></term>
3428   <listitem>
3429    <para>
3430     buffer to store date
3431    </para>
3432   </listitem>
3433  </varlistentry>
3434  <varlistentry>
3435   <term><parameter>len</parameter></term>
3436   <listitem>
3437    <para>
3438     number of bytes to read
3439    </para>
3440   </listitem>
3441  </varlistentry>
3442 </variablelist>
3443</refsect1>
3444<refsect1>
3445<title>Description</title>
3446<para>
3447   Default read function for 8bit buswidth.
3448</para>
3449</refsect1>
3450</refentry>
3451
3452<refentry id="API-nand-write-buf16">
3453<refentryinfo>
3454 <title>LINUX</title>
3455 <productname>Kernel Hackers Manual</productname>
3456 <date>July 2017</date>
3457</refentryinfo>
3458<refmeta>
3459 <refentrytitle><phrase>nand_write_buf16</phrase></refentrytitle>
3460 <manvolnum>9</manvolnum>
3461 <refmiscinfo class="version">4.1.27</refmiscinfo>
3462</refmeta>
3463<refnamediv>
3464 <refname>nand_write_buf16</refname>
3465 <refpurpose>
3466     [DEFAULT] write buffer to chip
3467 </refpurpose>
3468</refnamediv>
3469<refsynopsisdiv>
3470 <title>Synopsis</title>
3471  <funcsynopsis><funcprototype>
3472   <funcdef>void <function>nand_write_buf16 </function></funcdef>
3473   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3474   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
3475   <paramdef>int <parameter>len</parameter></paramdef>
3476  </funcprototype></funcsynopsis>
3477</refsynopsisdiv>
3478<refsect1>
3479 <title>Arguments</title>
3480 <variablelist>
3481  <varlistentry>
3482   <term><parameter>mtd</parameter></term>
3483   <listitem>
3484    <para>
3485     MTD device structure
3486    </para>
3487   </listitem>
3488  </varlistentry>
3489  <varlistentry>
3490   <term><parameter>buf</parameter></term>
3491   <listitem>
3492    <para>
3493     data buffer
3494    </para>
3495   </listitem>
3496  </varlistentry>
3497  <varlistentry>
3498   <term><parameter>len</parameter></term>
3499   <listitem>
3500    <para>
3501     number of bytes to write
3502    </para>
3503   </listitem>
3504  </varlistentry>
3505 </variablelist>
3506</refsect1>
3507<refsect1>
3508<title>Description</title>
3509<para>
3510   Default write function for 16bit buswidth.
3511</para>
3512</refsect1>
3513</refentry>
3514
3515<refentry id="API-nand-read-buf16">
3516<refentryinfo>
3517 <title>LINUX</title>
3518 <productname>Kernel Hackers Manual</productname>
3519 <date>July 2017</date>
3520</refentryinfo>
3521<refmeta>
3522 <refentrytitle><phrase>nand_read_buf16</phrase></refentrytitle>
3523 <manvolnum>9</manvolnum>
3524 <refmiscinfo class="version">4.1.27</refmiscinfo>
3525</refmeta>
3526<refnamediv>
3527 <refname>nand_read_buf16</refname>
3528 <refpurpose>
3529     [DEFAULT] read chip data into buffer
3530 </refpurpose>
3531</refnamediv>
3532<refsynopsisdiv>
3533 <title>Synopsis</title>
3534  <funcsynopsis><funcprototype>
3535   <funcdef>void <function>nand_read_buf16 </function></funcdef>
3536   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3537   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
3538   <paramdef>int <parameter>len</parameter></paramdef>
3539  </funcprototype></funcsynopsis>
3540</refsynopsisdiv>
3541<refsect1>
3542 <title>Arguments</title>
3543 <variablelist>
3544  <varlistentry>
3545   <term><parameter>mtd</parameter></term>
3546   <listitem>
3547    <para>
3548     MTD device structure
3549    </para>
3550   </listitem>
3551  </varlistentry>
3552  <varlistentry>
3553   <term><parameter>buf</parameter></term>
3554   <listitem>
3555    <para>
3556     buffer to store date
3557    </para>
3558   </listitem>
3559  </varlistentry>
3560  <varlistentry>
3561   <term><parameter>len</parameter></term>
3562   <listitem>
3563    <para>
3564     number of bytes to read
3565    </para>
3566   </listitem>
3567  </varlistentry>
3568 </variablelist>
3569</refsect1>
3570<refsect1>
3571<title>Description</title>
3572<para>
3573   Default read function for 16bit buswidth.
3574</para>
3575</refsect1>
3576</refentry>
3577
3578<refentry id="API-nand-block-bad">
3579<refentryinfo>
3580 <title>LINUX</title>
3581 <productname>Kernel Hackers Manual</productname>
3582 <date>July 2017</date>
3583</refentryinfo>
3584<refmeta>
3585 <refentrytitle><phrase>nand_block_bad</phrase></refentrytitle>
3586 <manvolnum>9</manvolnum>
3587 <refmiscinfo class="version">4.1.27</refmiscinfo>
3588</refmeta>
3589<refnamediv>
3590 <refname>nand_block_bad</refname>
3591 <refpurpose>
3592     [DEFAULT] Read bad block marker from the chip
3593 </refpurpose>
3594</refnamediv>
3595<refsynopsisdiv>
3596 <title>Synopsis</title>
3597  <funcsynopsis><funcprototype>
3598   <funcdef>int <function>nand_block_bad </function></funcdef>
3599   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3600   <paramdef>loff_t <parameter>ofs</parameter></paramdef>
3601   <paramdef>int <parameter>getchip</parameter></paramdef>
3602  </funcprototype></funcsynopsis>
3603</refsynopsisdiv>
3604<refsect1>
3605 <title>Arguments</title>
3606 <variablelist>
3607  <varlistentry>
3608   <term><parameter>mtd</parameter></term>
3609   <listitem>
3610    <para>
3611     MTD device structure
3612    </para>
3613   </listitem>
3614  </varlistentry>
3615  <varlistentry>
3616   <term><parameter>ofs</parameter></term>
3617   <listitem>
3618    <para>
3619     offset from device start
3620    </para>
3621   </listitem>
3622  </varlistentry>
3623  <varlistentry>
3624   <term><parameter>getchip</parameter></term>
3625   <listitem>
3626    <para>
3627     0, if the chip is already selected
3628    </para>
3629   </listitem>
3630  </varlistentry>
3631 </variablelist>
3632</refsect1>
3633<refsect1>
3634<title>Description</title>
3635<para>
3636   Check, if the block is bad.
3637</para>
3638</refsect1>
3639</refentry>
3640
3641<refentry id="API-nand-default-block-markbad">
3642<refentryinfo>
3643 <title>LINUX</title>
3644 <productname>Kernel Hackers Manual</productname>
3645 <date>July 2017</date>
3646</refentryinfo>
3647<refmeta>
3648 <refentrytitle><phrase>nand_default_block_markbad</phrase></refentrytitle>
3649 <manvolnum>9</manvolnum>
3650 <refmiscinfo class="version">4.1.27</refmiscinfo>
3651</refmeta>
3652<refnamediv>
3653 <refname>nand_default_block_markbad</refname>
3654 <refpurpose>
3655     [DEFAULT] mark a block bad via bad block marker
3656 </refpurpose>
3657</refnamediv>
3658<refsynopsisdiv>
3659 <title>Synopsis</title>
3660  <funcsynopsis><funcprototype>
3661   <funcdef>int <function>nand_default_block_markbad </function></funcdef>
3662   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3663   <paramdef>loff_t <parameter>ofs</parameter></paramdef>
3664  </funcprototype></funcsynopsis>
3665</refsynopsisdiv>
3666<refsect1>
3667 <title>Arguments</title>
3668 <variablelist>
3669  <varlistentry>
3670   <term><parameter>mtd</parameter></term>
3671   <listitem>
3672    <para>
3673     MTD device structure
3674    </para>
3675   </listitem>
3676  </varlistentry>
3677  <varlistentry>
3678   <term><parameter>ofs</parameter></term>
3679   <listitem>
3680    <para>
3681     offset from device start
3682    </para>
3683   </listitem>
3684  </varlistentry>
3685 </variablelist>
3686</refsect1>
3687<refsect1>
3688<title>Description</title>
3689<para>
3690   This is the default implementation, which can be overridden by a hardware
3691   specific driver. It provides the details for writing a bad block marker to a
3692   block.
3693</para>
3694</refsect1>
3695</refentry>
3696
3697<refentry id="API-nand-block-markbad-lowlevel">
3698<refentryinfo>
3699 <title>LINUX</title>
3700 <productname>Kernel Hackers Manual</productname>
3701 <date>July 2017</date>
3702</refentryinfo>
3703<refmeta>
3704 <refentrytitle><phrase>nand_block_markbad_lowlevel</phrase></refentrytitle>
3705 <manvolnum>9</manvolnum>
3706 <refmiscinfo class="version">4.1.27</refmiscinfo>
3707</refmeta>
3708<refnamediv>
3709 <refname>nand_block_markbad_lowlevel</refname>
3710 <refpurpose>
3711     mark a block bad
3712 </refpurpose>
3713</refnamediv>
3714<refsynopsisdiv>
3715 <title>Synopsis</title>
3716  <funcsynopsis><funcprototype>
3717   <funcdef>int <function>nand_block_markbad_lowlevel </function></funcdef>
3718   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3719   <paramdef>loff_t <parameter>ofs</parameter></paramdef>
3720  </funcprototype></funcsynopsis>
3721</refsynopsisdiv>
3722<refsect1>
3723 <title>Arguments</title>
3724 <variablelist>
3725  <varlistentry>
3726   <term><parameter>mtd</parameter></term>
3727   <listitem>
3728    <para>
3729     MTD device structure
3730    </para>
3731   </listitem>
3732  </varlistentry>
3733  <varlistentry>
3734   <term><parameter>ofs</parameter></term>
3735   <listitem>
3736    <para>
3737     offset from device start
3738    </para>
3739   </listitem>
3740  </varlistentry>
3741 </variablelist>
3742</refsect1>
3743<refsect1>
3744<title>Description</title>
3745<para>
3746   This function performs the generic NAND bad block marking steps (i.e., bad
3747   block table(s) and/or marker(s)). We only allow the hardware driver to
3748   specify how to write bad block markers to OOB (chip-&gt;block_markbad).
3749</para>
3750</refsect1>
3751<refsect1>
3752<title>We try operations in the following order</title>
3753<para>
3754   (1) erase the affected block, to allow OOB marker to be written cleanly
3755   (2) write bad block marker to OOB area of affected block (unless flag
3756   NAND_BBT_NO_OOB_BBM is present)
3757   (3) update the BBT
3758   Note that we retain the first error encountered in (2) or (3), finish the
3759   procedures, and dump the error in the end.
3760</para>
3761</refsect1>
3762</refentry>
3763
3764<refentry id="API-nand-check-wp">
3765<refentryinfo>
3766 <title>LINUX</title>
3767 <productname>Kernel Hackers Manual</productname>
3768 <date>July 2017</date>
3769</refentryinfo>
3770<refmeta>
3771 <refentrytitle><phrase>nand_check_wp</phrase></refentrytitle>
3772 <manvolnum>9</manvolnum>
3773 <refmiscinfo class="version">4.1.27</refmiscinfo>
3774</refmeta>
3775<refnamediv>
3776 <refname>nand_check_wp</refname>
3777 <refpurpose>
3778     [GENERIC] check if the chip is write protected
3779 </refpurpose>
3780</refnamediv>
3781<refsynopsisdiv>
3782 <title>Synopsis</title>
3783  <funcsynopsis><funcprototype>
3784   <funcdef>int <function>nand_check_wp </function></funcdef>
3785   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3786  </funcprototype></funcsynopsis>
3787</refsynopsisdiv>
3788<refsect1>
3789 <title>Arguments</title>
3790 <variablelist>
3791  <varlistentry>
3792   <term><parameter>mtd</parameter></term>
3793   <listitem>
3794    <para>
3795     MTD device structure
3796    </para>
3797   </listitem>
3798  </varlistentry>
3799 </variablelist>
3800</refsect1>
3801<refsect1>
3802<title>Description</title>
3803<para>
3804   Check, if the device is write protected. The function expects, that the
3805   device is already selected.
3806</para>
3807</refsect1>
3808</refentry>
3809
3810<refentry id="API-nand-block-isreserved">
3811<refentryinfo>
3812 <title>LINUX</title>
3813 <productname>Kernel Hackers Manual</productname>
3814 <date>July 2017</date>
3815</refentryinfo>
3816<refmeta>
3817 <refentrytitle><phrase>nand_block_isreserved</phrase></refentrytitle>
3818 <manvolnum>9</manvolnum>
3819 <refmiscinfo class="version">4.1.27</refmiscinfo>
3820</refmeta>
3821<refnamediv>
3822 <refname>nand_block_isreserved</refname>
3823 <refpurpose>
3824     [GENERIC] Check if a block is marked reserved.
3825 </refpurpose>
3826</refnamediv>
3827<refsynopsisdiv>
3828 <title>Synopsis</title>
3829  <funcsynopsis><funcprototype>
3830   <funcdef>int <function>nand_block_isreserved </function></funcdef>
3831   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3832   <paramdef>loff_t <parameter>ofs</parameter></paramdef>
3833  </funcprototype></funcsynopsis>
3834</refsynopsisdiv>
3835<refsect1>
3836 <title>Arguments</title>
3837 <variablelist>
3838  <varlistentry>
3839   <term><parameter>mtd</parameter></term>
3840   <listitem>
3841    <para>
3842     MTD device structure
3843    </para>
3844   </listitem>
3845  </varlistentry>
3846  <varlistentry>
3847   <term><parameter>ofs</parameter></term>
3848   <listitem>
3849    <para>
3850     offset from device start
3851    </para>
3852   </listitem>
3853  </varlistentry>
3854 </variablelist>
3855</refsect1>
3856<refsect1>
3857<title>Description</title>
3858<para>
3859   Check if the block is marked as reserved.
3860</para>
3861</refsect1>
3862</refentry>
3863
3864<refentry id="API-nand-block-checkbad">
3865<refentryinfo>
3866 <title>LINUX</title>
3867 <productname>Kernel Hackers Manual</productname>
3868 <date>July 2017</date>
3869</refentryinfo>
3870<refmeta>
3871 <refentrytitle><phrase>nand_block_checkbad</phrase></refentrytitle>
3872 <manvolnum>9</manvolnum>
3873 <refmiscinfo class="version">4.1.27</refmiscinfo>
3874</refmeta>
3875<refnamediv>
3876 <refname>nand_block_checkbad</refname>
3877 <refpurpose>
3878     [GENERIC] Check if a block is marked bad
3879 </refpurpose>
3880</refnamediv>
3881<refsynopsisdiv>
3882 <title>Synopsis</title>
3883  <funcsynopsis><funcprototype>
3884   <funcdef>int <function>nand_block_checkbad </function></funcdef>
3885   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3886   <paramdef>loff_t <parameter>ofs</parameter></paramdef>
3887   <paramdef>int <parameter>getchip</parameter></paramdef>
3888   <paramdef>int <parameter>allowbbt</parameter></paramdef>
3889  </funcprototype></funcsynopsis>
3890</refsynopsisdiv>
3891<refsect1>
3892 <title>Arguments</title>
3893 <variablelist>
3894  <varlistentry>
3895   <term><parameter>mtd</parameter></term>
3896   <listitem>
3897    <para>
3898     MTD device structure
3899    </para>
3900   </listitem>
3901  </varlistentry>
3902  <varlistentry>
3903   <term><parameter>ofs</parameter></term>
3904   <listitem>
3905    <para>
3906     offset from device start
3907    </para>
3908   </listitem>
3909  </varlistentry>
3910  <varlistentry>
3911   <term><parameter>getchip</parameter></term>
3912   <listitem>
3913    <para>
3914     0, if the chip is already selected
3915    </para>
3916   </listitem>
3917  </varlistentry>
3918  <varlistentry>
3919   <term><parameter>allowbbt</parameter></term>
3920   <listitem>
3921    <para>
3922     1, if its allowed to access the bbt area
3923    </para>
3924   </listitem>
3925  </varlistentry>
3926 </variablelist>
3927</refsect1>
3928<refsect1>
3929<title>Description</title>
3930<para>
3931   Check, if the block is bad. Either by reading the bad block table or
3932   calling of the scan function.
3933</para>
3934</refsect1>
3935</refentry>
3936
3937<refentry id="API-panic-nand-wait-ready">
3938<refentryinfo>
3939 <title>LINUX</title>
3940 <productname>Kernel Hackers Manual</productname>
3941 <date>July 2017</date>
3942</refentryinfo>
3943<refmeta>
3944 <refentrytitle><phrase>panic_nand_wait_ready</phrase></refentrytitle>
3945 <manvolnum>9</manvolnum>
3946 <refmiscinfo class="version">4.1.27</refmiscinfo>
3947</refmeta>
3948<refnamediv>
3949 <refname>panic_nand_wait_ready</refname>
3950 <refpurpose>
3951     [GENERIC] Wait for the ready pin after commands.
3952 </refpurpose>
3953</refnamediv>
3954<refsynopsisdiv>
3955 <title>Synopsis</title>
3956  <funcsynopsis><funcprototype>
3957   <funcdef>void <function>panic_nand_wait_ready </function></funcdef>
3958   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
3959   <paramdef>unsigned long <parameter>timeo</parameter></paramdef>
3960  </funcprototype></funcsynopsis>
3961</refsynopsisdiv>
3962<refsect1>
3963 <title>Arguments</title>
3964 <variablelist>
3965  <varlistentry>
3966   <term><parameter>mtd</parameter></term>
3967   <listitem>
3968    <para>
3969     MTD device structure
3970    </para>
3971   </listitem>
3972  </varlistentry>
3973  <varlistentry>
3974   <term><parameter>timeo</parameter></term>
3975   <listitem>
3976    <para>
3977     Timeout
3978    </para>
3979   </listitem>
3980  </varlistentry>
3981 </variablelist>
3982</refsect1>
3983<refsect1>
3984<title>Description</title>
3985<para>
3986   Helper function for nand_wait_ready used when needing to wait in interrupt
3987   context.
3988</para>
3989</refsect1>
3990</refentry>
3991
3992<refentry id="API-nand-wait-status-ready">
3993<refentryinfo>
3994 <title>LINUX</title>
3995 <productname>Kernel Hackers Manual</productname>
3996 <date>July 2017</date>
3997</refentryinfo>
3998<refmeta>
3999 <refentrytitle><phrase>nand_wait_status_ready</phrase></refentrytitle>
4000 <manvolnum>9</manvolnum>
4001 <refmiscinfo class="version">4.1.27</refmiscinfo>
4002</refmeta>
4003<refnamediv>
4004 <refname>nand_wait_status_ready</refname>
4005 <refpurpose>
4006     [GENERIC] Wait for the ready status after commands.
4007 </refpurpose>
4008</refnamediv>
4009<refsynopsisdiv>
4010 <title>Synopsis</title>
4011  <funcsynopsis><funcprototype>
4012   <funcdef>void <function>nand_wait_status_ready </function></funcdef>
4013   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4014   <paramdef>unsigned long <parameter>timeo</parameter></paramdef>
4015  </funcprototype></funcsynopsis>
4016</refsynopsisdiv>
4017<refsect1>
4018 <title>Arguments</title>
4019 <variablelist>
4020  <varlistentry>
4021   <term><parameter>mtd</parameter></term>
4022   <listitem>
4023    <para>
4024     MTD device structure
4025    </para>
4026   </listitem>
4027  </varlistentry>
4028  <varlistentry>
4029   <term><parameter>timeo</parameter></term>
4030   <listitem>
4031    <para>
4032     Timeout in ms
4033    </para>
4034   </listitem>
4035  </varlistentry>
4036 </variablelist>
4037</refsect1>
4038<refsect1>
4039<title>Description</title>
4040<para>
4041   Wait for status ready (i.e. command done) or timeout.
4042</para>
4043</refsect1>
4044</refentry>
4045
4046<refentry id="API-nand-command">
4047<refentryinfo>
4048 <title>LINUX</title>
4049 <productname>Kernel Hackers Manual</productname>
4050 <date>July 2017</date>
4051</refentryinfo>
4052<refmeta>
4053 <refentrytitle><phrase>nand_command</phrase></refentrytitle>
4054 <manvolnum>9</manvolnum>
4055 <refmiscinfo class="version">4.1.27</refmiscinfo>
4056</refmeta>
4057<refnamediv>
4058 <refname>nand_command</refname>
4059 <refpurpose>
4060     [DEFAULT] Send command to NAND device
4061 </refpurpose>
4062</refnamediv>
4063<refsynopsisdiv>
4064 <title>Synopsis</title>
4065  <funcsynopsis><funcprototype>
4066   <funcdef>void <function>nand_command </function></funcdef>
4067   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4068   <paramdef>unsigned int <parameter>command</parameter></paramdef>
4069   <paramdef>int <parameter>column</parameter></paramdef>
4070   <paramdef>int <parameter>page_addr</parameter></paramdef>
4071  </funcprototype></funcsynopsis>
4072</refsynopsisdiv>
4073<refsect1>
4074 <title>Arguments</title>
4075 <variablelist>
4076  <varlistentry>
4077   <term><parameter>mtd</parameter></term>
4078   <listitem>
4079    <para>
4080     MTD device structure
4081    </para>
4082   </listitem>
4083  </varlistentry>
4084  <varlistentry>
4085   <term><parameter>command</parameter></term>
4086   <listitem>
4087    <para>
4088     the command to be sent
4089    </para>
4090   </listitem>
4091  </varlistentry>
4092  <varlistentry>
4093   <term><parameter>column</parameter></term>
4094   <listitem>
4095    <para>
4096     the column address for this command, -1 if none
4097    </para>
4098   </listitem>
4099  </varlistentry>
4100  <varlistentry>
4101   <term><parameter>page_addr</parameter></term>
4102   <listitem>
4103    <para>
4104     the page address for this command, -1 if none
4105    </para>
4106   </listitem>
4107  </varlistentry>
4108 </variablelist>
4109</refsect1>
4110<refsect1>
4111<title>Description</title>
4112<para>
4113   Send command to NAND device. This function is used for small page devices
4114   (512 Bytes per page).
4115</para>
4116</refsect1>
4117</refentry>
4118
4119<refentry id="API-nand-command-lp">
4120<refentryinfo>
4121 <title>LINUX</title>
4122 <productname>Kernel Hackers Manual</productname>
4123 <date>July 2017</date>
4124</refentryinfo>
4125<refmeta>
4126 <refentrytitle><phrase>nand_command_lp</phrase></refentrytitle>
4127 <manvolnum>9</manvolnum>
4128 <refmiscinfo class="version">4.1.27</refmiscinfo>
4129</refmeta>
4130<refnamediv>
4131 <refname>nand_command_lp</refname>
4132 <refpurpose>
4133     [DEFAULT] Send command to NAND large page device
4134 </refpurpose>
4135</refnamediv>
4136<refsynopsisdiv>
4137 <title>Synopsis</title>
4138  <funcsynopsis><funcprototype>
4139   <funcdef>void <function>nand_command_lp </function></funcdef>
4140   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4141   <paramdef>unsigned int <parameter>command</parameter></paramdef>
4142   <paramdef>int <parameter>column</parameter></paramdef>
4143   <paramdef>int <parameter>page_addr</parameter></paramdef>
4144  </funcprototype></funcsynopsis>
4145</refsynopsisdiv>
4146<refsect1>
4147 <title>Arguments</title>
4148 <variablelist>
4149  <varlistentry>
4150   <term><parameter>mtd</parameter></term>
4151   <listitem>
4152    <para>
4153     MTD device structure
4154    </para>
4155   </listitem>
4156  </varlistentry>
4157  <varlistentry>
4158   <term><parameter>command</parameter></term>
4159   <listitem>
4160    <para>
4161     the command to be sent
4162    </para>
4163   </listitem>
4164  </varlistentry>
4165  <varlistentry>
4166   <term><parameter>column</parameter></term>
4167   <listitem>
4168    <para>
4169     the column address for this command, -1 if none
4170    </para>
4171   </listitem>
4172  </varlistentry>
4173  <varlistentry>
4174   <term><parameter>page_addr</parameter></term>
4175   <listitem>
4176    <para>
4177     the page address for this command, -1 if none
4178    </para>
4179   </listitem>
4180  </varlistentry>
4181 </variablelist>
4182</refsect1>
4183<refsect1>
4184<title>Description</title>
4185<para>
4186   Send command to NAND device. This is the version for the new large page
4187   devices. We don't have the separate regions as we have in the small page
4188   devices. We must emulate NAND_CMD_READOOB to keep the code compatible.
4189</para>
4190</refsect1>
4191</refentry>
4192
4193<refentry id="API-panic-nand-get-device">
4194<refentryinfo>
4195 <title>LINUX</title>
4196 <productname>Kernel Hackers Manual</productname>
4197 <date>July 2017</date>
4198</refentryinfo>
4199<refmeta>
4200 <refentrytitle><phrase>panic_nand_get_device</phrase></refentrytitle>
4201 <manvolnum>9</manvolnum>
4202 <refmiscinfo class="version">4.1.27</refmiscinfo>
4203</refmeta>
4204<refnamediv>
4205 <refname>panic_nand_get_device</refname>
4206 <refpurpose>
4207     [GENERIC] Get chip for selected access
4208 </refpurpose>
4209</refnamediv>
4210<refsynopsisdiv>
4211 <title>Synopsis</title>
4212  <funcsynopsis><funcprototype>
4213   <funcdef>void <function>panic_nand_get_device </function></funcdef>
4214   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
4215   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4216   <paramdef>int <parameter>new_state</parameter></paramdef>
4217  </funcprototype></funcsynopsis>
4218</refsynopsisdiv>
4219<refsect1>
4220 <title>Arguments</title>
4221 <variablelist>
4222  <varlistentry>
4223   <term><parameter>chip</parameter></term>
4224   <listitem>
4225    <para>
4226     the nand chip descriptor
4227    </para>
4228   </listitem>
4229  </varlistentry>
4230  <varlistentry>
4231   <term><parameter>mtd</parameter></term>
4232   <listitem>
4233    <para>
4234     MTD device structure
4235    </para>
4236   </listitem>
4237  </varlistentry>
4238  <varlistentry>
4239   <term><parameter>new_state</parameter></term>
4240   <listitem>
4241    <para>
4242     the state which is requested
4243    </para>
4244   </listitem>
4245  </varlistentry>
4246 </variablelist>
4247</refsect1>
4248<refsect1>
4249<title>Description</title>
4250<para>
4251   Used when in panic, no locks are taken.
4252</para>
4253</refsect1>
4254</refentry>
4255
4256<refentry id="API-nand-get-device">
4257<refentryinfo>
4258 <title>LINUX</title>
4259 <productname>Kernel Hackers Manual</productname>
4260 <date>July 2017</date>
4261</refentryinfo>
4262<refmeta>
4263 <refentrytitle><phrase>nand_get_device</phrase></refentrytitle>
4264 <manvolnum>9</manvolnum>
4265 <refmiscinfo class="version">4.1.27</refmiscinfo>
4266</refmeta>
4267<refnamediv>
4268 <refname>nand_get_device</refname>
4269 <refpurpose>
4270     [GENERIC] Get chip for selected access
4271 </refpurpose>
4272</refnamediv>
4273<refsynopsisdiv>
4274 <title>Synopsis</title>
4275  <funcsynopsis><funcprototype>
4276   <funcdef>int <function>nand_get_device </function></funcdef>
4277   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4278   <paramdef>int <parameter>new_state</parameter></paramdef>
4279  </funcprototype></funcsynopsis>
4280</refsynopsisdiv>
4281<refsect1>
4282 <title>Arguments</title>
4283 <variablelist>
4284  <varlistentry>
4285   <term><parameter>mtd</parameter></term>
4286   <listitem>
4287    <para>
4288     MTD device structure
4289    </para>
4290   </listitem>
4291  </varlistentry>
4292  <varlistentry>
4293   <term><parameter>new_state</parameter></term>
4294   <listitem>
4295    <para>
4296     the state which is requested
4297    </para>
4298   </listitem>
4299  </varlistentry>
4300 </variablelist>
4301</refsect1>
4302<refsect1>
4303<title>Description</title>
4304<para>
4305   Get the device and lock it for exclusive access
4306</para>
4307</refsect1>
4308</refentry>
4309
4310<refentry id="API-panic-nand-wait">
4311<refentryinfo>
4312 <title>LINUX</title>
4313 <productname>Kernel Hackers Manual</productname>
4314 <date>July 2017</date>
4315</refentryinfo>
4316<refmeta>
4317 <refentrytitle><phrase>panic_nand_wait</phrase></refentrytitle>
4318 <manvolnum>9</manvolnum>
4319 <refmiscinfo class="version">4.1.27</refmiscinfo>
4320</refmeta>
4321<refnamediv>
4322 <refname>panic_nand_wait</refname>
4323 <refpurpose>
4324     [GENERIC] wait until the command is done
4325 </refpurpose>
4326</refnamediv>
4327<refsynopsisdiv>
4328 <title>Synopsis</title>
4329  <funcsynopsis><funcprototype>
4330   <funcdef>void <function>panic_nand_wait </function></funcdef>
4331   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4332   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
4333   <paramdef>unsigned long <parameter>timeo</parameter></paramdef>
4334  </funcprototype></funcsynopsis>
4335</refsynopsisdiv>
4336<refsect1>
4337 <title>Arguments</title>
4338 <variablelist>
4339  <varlistentry>
4340   <term><parameter>mtd</parameter></term>
4341   <listitem>
4342    <para>
4343     MTD device structure
4344    </para>
4345   </listitem>
4346  </varlistentry>
4347  <varlistentry>
4348   <term><parameter>chip</parameter></term>
4349   <listitem>
4350    <para>
4351     NAND chip structure
4352    </para>
4353   </listitem>
4354  </varlistentry>
4355  <varlistentry>
4356   <term><parameter>timeo</parameter></term>
4357   <listitem>
4358    <para>
4359     timeout
4360    </para>
4361   </listitem>
4362  </varlistentry>
4363 </variablelist>
4364</refsect1>
4365<refsect1>
4366<title>Description</title>
4367<para>
4368   Wait for command done. This is a helper function for nand_wait used when
4369   we are in interrupt context. May happen when in panic and trying to write
4370   an oops through mtdoops.
4371</para>
4372</refsect1>
4373</refentry>
4374
4375<refentry id="API-nand-wait">
4376<refentryinfo>
4377 <title>LINUX</title>
4378 <productname>Kernel Hackers Manual</productname>
4379 <date>July 2017</date>
4380</refentryinfo>
4381<refmeta>
4382 <refentrytitle><phrase>nand_wait</phrase></refentrytitle>
4383 <manvolnum>9</manvolnum>
4384 <refmiscinfo class="version">4.1.27</refmiscinfo>
4385</refmeta>
4386<refnamediv>
4387 <refname>nand_wait</refname>
4388 <refpurpose>
4389     [DEFAULT] wait until the command is done
4390 </refpurpose>
4391</refnamediv>
4392<refsynopsisdiv>
4393 <title>Synopsis</title>
4394  <funcsynopsis><funcprototype>
4395   <funcdef>int <function>nand_wait </function></funcdef>
4396   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4397   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
4398  </funcprototype></funcsynopsis>
4399</refsynopsisdiv>
4400<refsect1>
4401 <title>Arguments</title>
4402 <variablelist>
4403  <varlistentry>
4404   <term><parameter>mtd</parameter></term>
4405   <listitem>
4406    <para>
4407     MTD device structure
4408    </para>
4409   </listitem>
4410  </varlistentry>
4411  <varlistentry>
4412   <term><parameter>chip</parameter></term>
4413   <listitem>
4414    <para>
4415     NAND chip structure
4416    </para>
4417   </listitem>
4418  </varlistentry>
4419 </variablelist>
4420</refsect1>
4421<refsect1>
4422<title>Description</title>
4423<para>
4424   Wait for command done. This applies to erase and program only. Erase can
4425   take up to 400ms and program up to 20ms according to general NAND and
4426   SmartMedia specs.
4427</para>
4428</refsect1>
4429</refentry>
4430
4431<refentry id="API---nand-unlock">
4432<refentryinfo>
4433 <title>LINUX</title>
4434 <productname>Kernel Hackers Manual</productname>
4435 <date>July 2017</date>
4436</refentryinfo>
4437<refmeta>
4438 <refentrytitle><phrase>__nand_unlock</phrase></refentrytitle>
4439 <manvolnum>9</manvolnum>
4440 <refmiscinfo class="version">4.1.27</refmiscinfo>
4441</refmeta>
4442<refnamediv>
4443 <refname>__nand_unlock</refname>
4444 <refpurpose>
4445     [REPLACEABLE] unlocks specified locked blocks
4446 </refpurpose>
4447</refnamediv>
4448<refsynopsisdiv>
4449 <title>Synopsis</title>
4450  <funcsynopsis><funcprototype>
4451   <funcdef>int <function>__nand_unlock </function></funcdef>
4452   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4453   <paramdef>loff_t <parameter>ofs</parameter></paramdef>
4454   <paramdef>uint64_t <parameter>len</parameter></paramdef>
4455   <paramdef>int <parameter>invert</parameter></paramdef>
4456  </funcprototype></funcsynopsis>
4457</refsynopsisdiv>
4458<refsect1>
4459 <title>Arguments</title>
4460 <variablelist>
4461  <varlistentry>
4462   <term><parameter>mtd</parameter></term>
4463   <listitem>
4464    <para>
4465     mtd info
4466    </para>
4467   </listitem>
4468  </varlistentry>
4469  <varlistentry>
4470   <term><parameter>ofs</parameter></term>
4471   <listitem>
4472    <para>
4473     offset to start unlock from
4474    </para>
4475   </listitem>
4476  </varlistentry>
4477  <varlistentry>
4478   <term><parameter>len</parameter></term>
4479   <listitem>
4480    <para>
4481     length to unlock
4482    </para>
4483   </listitem>
4484  </varlistentry>
4485  <varlistentry>
4486   <term><parameter>invert</parameter></term>
4487   <listitem>
4488    <para>
4489     when = 0, unlock the range of blocks within the lower and
4490     upper boundary address
4491     when = 1, unlock the range of blocks outside the boundaries
4492     of the lower and upper boundary address
4493    </para>
4494   </listitem>
4495  </varlistentry>
4496 </variablelist>
4497</refsect1>
4498<refsect1>
4499<title>Description</title>
4500<para>
4501   Returs unlock status.
4502</para>
4503</refsect1>
4504</refentry>
4505
4506<refentry id="API-nand-read-page-raw">
4507<refentryinfo>
4508 <title>LINUX</title>
4509 <productname>Kernel Hackers Manual</productname>
4510 <date>July 2017</date>
4511</refentryinfo>
4512<refmeta>
4513 <refentrytitle><phrase>nand_read_page_raw</phrase></refentrytitle>
4514 <manvolnum>9</manvolnum>
4515 <refmiscinfo class="version">4.1.27</refmiscinfo>
4516</refmeta>
4517<refnamediv>
4518 <refname>nand_read_page_raw</refname>
4519 <refpurpose>
4520     [INTERN] read raw page data without ecc
4521 </refpurpose>
4522</refnamediv>
4523<refsynopsisdiv>
4524 <title>Synopsis</title>
4525  <funcsynopsis><funcprototype>
4526   <funcdef>int <function>nand_read_page_raw </function></funcdef>
4527   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4528   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
4529   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
4530   <paramdef>int <parameter>oob_required</parameter></paramdef>
4531   <paramdef>int <parameter>page</parameter></paramdef>
4532  </funcprototype></funcsynopsis>
4533</refsynopsisdiv>
4534<refsect1>
4535 <title>Arguments</title>
4536 <variablelist>
4537  <varlistentry>
4538   <term><parameter>mtd</parameter></term>
4539   <listitem>
4540    <para>
4541     mtd info structure
4542    </para>
4543   </listitem>
4544  </varlistentry>
4545  <varlistentry>
4546   <term><parameter>chip</parameter></term>
4547   <listitem>
4548    <para>
4549     nand chip info structure
4550    </para>
4551   </listitem>
4552  </varlistentry>
4553  <varlistentry>
4554   <term><parameter>buf</parameter></term>
4555   <listitem>
4556    <para>
4557     buffer to store read data
4558    </para>
4559   </listitem>
4560  </varlistentry>
4561  <varlistentry>
4562   <term><parameter>oob_required</parameter></term>
4563   <listitem>
4564    <para>
4565     caller requires OOB data read to chip-&gt;oob_poi
4566    </para>
4567   </listitem>
4568  </varlistentry>
4569  <varlistentry>
4570   <term><parameter>page</parameter></term>
4571   <listitem>
4572    <para>
4573     page number to read
4574    </para>
4575   </listitem>
4576  </varlistentry>
4577 </variablelist>
4578</refsect1>
4579<refsect1>
4580<title>Description</title>
4581<para>
4582   Not for syndrome calculating ECC controllers, which use a special oob layout.
4583</para>
4584</refsect1>
4585</refentry>
4586
4587<refentry id="API-nand-read-page-raw-syndrome">
4588<refentryinfo>
4589 <title>LINUX</title>
4590 <productname>Kernel Hackers Manual</productname>
4591 <date>July 2017</date>
4592</refentryinfo>
4593<refmeta>
4594 <refentrytitle><phrase>nand_read_page_raw_syndrome</phrase></refentrytitle>
4595 <manvolnum>9</manvolnum>
4596 <refmiscinfo class="version">4.1.27</refmiscinfo>
4597</refmeta>
4598<refnamediv>
4599 <refname>nand_read_page_raw_syndrome</refname>
4600 <refpurpose>
4601     [INTERN] read raw page data without ecc
4602 </refpurpose>
4603</refnamediv>
4604<refsynopsisdiv>
4605 <title>Synopsis</title>
4606  <funcsynopsis><funcprototype>
4607   <funcdef>int <function>nand_read_page_raw_syndrome </function></funcdef>
4608   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4609   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
4610   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
4611   <paramdef>int <parameter>oob_required</parameter></paramdef>
4612   <paramdef>int <parameter>page</parameter></paramdef>
4613  </funcprototype></funcsynopsis>
4614</refsynopsisdiv>
4615<refsect1>
4616 <title>Arguments</title>
4617 <variablelist>
4618  <varlistentry>
4619   <term><parameter>mtd</parameter></term>
4620   <listitem>
4621    <para>
4622     mtd info structure
4623    </para>
4624   </listitem>
4625  </varlistentry>
4626  <varlistentry>
4627   <term><parameter>chip</parameter></term>
4628   <listitem>
4629    <para>
4630     nand chip info structure
4631    </para>
4632   </listitem>
4633  </varlistentry>
4634  <varlistentry>
4635   <term><parameter>buf</parameter></term>
4636   <listitem>
4637    <para>
4638     buffer to store read data
4639    </para>
4640   </listitem>
4641  </varlistentry>
4642  <varlistentry>
4643   <term><parameter>oob_required</parameter></term>
4644   <listitem>
4645    <para>
4646     caller requires OOB data read to chip-&gt;oob_poi
4647    </para>
4648   </listitem>
4649  </varlistentry>
4650  <varlistentry>
4651   <term><parameter>page</parameter></term>
4652   <listitem>
4653    <para>
4654     page number to read
4655    </para>
4656   </listitem>
4657  </varlistentry>
4658 </variablelist>
4659</refsect1>
4660<refsect1>
4661<title>Description</title>
4662<para>
4663   We need a special oob layout and handling even when OOB isn't used.
4664</para>
4665</refsect1>
4666</refentry>
4667
4668<refentry id="API-nand-read-page-swecc">
4669<refentryinfo>
4670 <title>LINUX</title>
4671 <productname>Kernel Hackers Manual</productname>
4672 <date>July 2017</date>
4673</refentryinfo>
4674<refmeta>
4675 <refentrytitle><phrase>nand_read_page_swecc</phrase></refentrytitle>
4676 <manvolnum>9</manvolnum>
4677 <refmiscinfo class="version">4.1.27</refmiscinfo>
4678</refmeta>
4679<refnamediv>
4680 <refname>nand_read_page_swecc</refname>
4681 <refpurpose>
4682     [REPLACEABLE] software ECC based page read function
4683 </refpurpose>
4684</refnamediv>
4685<refsynopsisdiv>
4686 <title>Synopsis</title>
4687  <funcsynopsis><funcprototype>
4688   <funcdef>int <function>nand_read_page_swecc </function></funcdef>
4689   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4690   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
4691   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
4692   <paramdef>int <parameter>oob_required</parameter></paramdef>
4693   <paramdef>int <parameter>page</parameter></paramdef>
4694  </funcprototype></funcsynopsis>
4695</refsynopsisdiv>
4696<refsect1>
4697 <title>Arguments</title>
4698 <variablelist>
4699  <varlistentry>
4700   <term><parameter>mtd</parameter></term>
4701   <listitem>
4702    <para>
4703     mtd info structure
4704    </para>
4705   </listitem>
4706  </varlistentry>
4707  <varlistentry>
4708   <term><parameter>chip</parameter></term>
4709   <listitem>
4710    <para>
4711     nand chip info structure
4712    </para>
4713   </listitem>
4714  </varlistentry>
4715  <varlistentry>
4716   <term><parameter>buf</parameter></term>
4717   <listitem>
4718    <para>
4719     buffer to store read data
4720    </para>
4721   </listitem>
4722  </varlistentry>
4723  <varlistentry>
4724   <term><parameter>oob_required</parameter></term>
4725   <listitem>
4726    <para>
4727     caller requires OOB data read to chip-&gt;oob_poi
4728    </para>
4729   </listitem>
4730  </varlistentry>
4731  <varlistentry>
4732   <term><parameter>page</parameter></term>
4733   <listitem>
4734    <para>
4735     page number to read
4736    </para>
4737   </listitem>
4738  </varlistentry>
4739 </variablelist>
4740</refsect1>
4741</refentry>
4742
4743<refentry id="API-nand-read-subpage">
4744<refentryinfo>
4745 <title>LINUX</title>
4746 <productname>Kernel Hackers Manual</productname>
4747 <date>July 2017</date>
4748</refentryinfo>
4749<refmeta>
4750 <refentrytitle><phrase>nand_read_subpage</phrase></refentrytitle>
4751 <manvolnum>9</manvolnum>
4752 <refmiscinfo class="version">4.1.27</refmiscinfo>
4753</refmeta>
4754<refnamediv>
4755 <refname>nand_read_subpage</refname>
4756 <refpurpose>
4757     [REPLACEABLE] ECC based sub-page read function
4758 </refpurpose>
4759</refnamediv>
4760<refsynopsisdiv>
4761 <title>Synopsis</title>
4762  <funcsynopsis><funcprototype>
4763   <funcdef>int <function>nand_read_subpage </function></funcdef>
4764   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4765   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
4766   <paramdef>uint32_t <parameter>data_offs</parameter></paramdef>
4767   <paramdef>uint32_t <parameter>readlen</parameter></paramdef>
4768   <paramdef>uint8_t * <parameter>bufpoi</parameter></paramdef>
4769   <paramdef>int <parameter>page</parameter></paramdef>
4770  </funcprototype></funcsynopsis>
4771</refsynopsisdiv>
4772<refsect1>
4773 <title>Arguments</title>
4774 <variablelist>
4775  <varlistentry>
4776   <term><parameter>mtd</parameter></term>
4777   <listitem>
4778    <para>
4779     mtd info structure
4780    </para>
4781   </listitem>
4782  </varlistentry>
4783  <varlistentry>
4784   <term><parameter>chip</parameter></term>
4785   <listitem>
4786    <para>
4787     nand chip info structure
4788    </para>
4789   </listitem>
4790  </varlistentry>
4791  <varlistentry>
4792   <term><parameter>data_offs</parameter></term>
4793   <listitem>
4794    <para>
4795     offset of requested data within the page
4796    </para>
4797   </listitem>
4798  </varlistentry>
4799  <varlistentry>
4800   <term><parameter>readlen</parameter></term>
4801   <listitem>
4802    <para>
4803     data length
4804    </para>
4805   </listitem>
4806  </varlistentry>
4807  <varlistentry>
4808   <term><parameter>bufpoi</parameter></term>
4809   <listitem>
4810    <para>
4811     buffer to store read data
4812    </para>
4813   </listitem>
4814  </varlistentry>
4815  <varlistentry>
4816   <term><parameter>page</parameter></term>
4817   <listitem>
4818    <para>
4819     page number to read
4820    </para>
4821   </listitem>
4822  </varlistentry>
4823 </variablelist>
4824</refsect1>
4825</refentry>
4826
4827<refentry id="API-nand-read-page-hwecc">
4828<refentryinfo>
4829 <title>LINUX</title>
4830 <productname>Kernel Hackers Manual</productname>
4831 <date>July 2017</date>
4832</refentryinfo>
4833<refmeta>
4834 <refentrytitle><phrase>nand_read_page_hwecc</phrase></refentrytitle>
4835 <manvolnum>9</manvolnum>
4836 <refmiscinfo class="version">4.1.27</refmiscinfo>
4837</refmeta>
4838<refnamediv>
4839 <refname>nand_read_page_hwecc</refname>
4840 <refpurpose>
4841     [REPLACEABLE] hardware ECC based page read function
4842 </refpurpose>
4843</refnamediv>
4844<refsynopsisdiv>
4845 <title>Synopsis</title>
4846  <funcsynopsis><funcprototype>
4847   <funcdef>int <function>nand_read_page_hwecc </function></funcdef>
4848   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4849   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
4850   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
4851   <paramdef>int <parameter>oob_required</parameter></paramdef>
4852   <paramdef>int <parameter>page</parameter></paramdef>
4853  </funcprototype></funcsynopsis>
4854</refsynopsisdiv>
4855<refsect1>
4856 <title>Arguments</title>
4857 <variablelist>
4858  <varlistentry>
4859   <term><parameter>mtd</parameter></term>
4860   <listitem>
4861    <para>
4862     mtd info structure
4863    </para>
4864   </listitem>
4865  </varlistentry>
4866  <varlistentry>
4867   <term><parameter>chip</parameter></term>
4868   <listitem>
4869    <para>
4870     nand chip info structure
4871    </para>
4872   </listitem>
4873  </varlistentry>
4874  <varlistentry>
4875   <term><parameter>buf</parameter></term>
4876   <listitem>
4877    <para>
4878     buffer to store read data
4879    </para>
4880   </listitem>
4881  </varlistentry>
4882  <varlistentry>
4883   <term><parameter>oob_required</parameter></term>
4884   <listitem>
4885    <para>
4886     caller requires OOB data read to chip-&gt;oob_poi
4887    </para>
4888   </listitem>
4889  </varlistentry>
4890  <varlistentry>
4891   <term><parameter>page</parameter></term>
4892   <listitem>
4893    <para>
4894     page number to read
4895    </para>
4896   </listitem>
4897  </varlistentry>
4898 </variablelist>
4899</refsect1>
4900<refsect1>
4901<title>Description</title>
4902<para>
4903   Not for syndrome calculating ECC controllers which need a special oob layout.
4904</para>
4905</refsect1>
4906</refentry>
4907
4908<refentry id="API-nand-read-page-hwecc-oob-first">
4909<refentryinfo>
4910 <title>LINUX</title>
4911 <productname>Kernel Hackers Manual</productname>
4912 <date>July 2017</date>
4913</refentryinfo>
4914<refmeta>
4915 <refentrytitle><phrase>nand_read_page_hwecc_oob_first</phrase></refentrytitle>
4916 <manvolnum>9</manvolnum>
4917 <refmiscinfo class="version">4.1.27</refmiscinfo>
4918</refmeta>
4919<refnamediv>
4920 <refname>nand_read_page_hwecc_oob_first</refname>
4921 <refpurpose>
4922     [REPLACEABLE] hw ecc, read oob first
4923 </refpurpose>
4924</refnamediv>
4925<refsynopsisdiv>
4926 <title>Synopsis</title>
4927  <funcsynopsis><funcprototype>
4928   <funcdef>int <function>nand_read_page_hwecc_oob_first </function></funcdef>
4929   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
4930   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
4931   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
4932   <paramdef>int <parameter>oob_required</parameter></paramdef>
4933   <paramdef>int <parameter>page</parameter></paramdef>
4934  </funcprototype></funcsynopsis>
4935</refsynopsisdiv>
4936<refsect1>
4937 <title>Arguments</title>
4938 <variablelist>
4939  <varlistentry>
4940   <term><parameter>mtd</parameter></term>
4941   <listitem>
4942    <para>
4943     mtd info structure
4944    </para>
4945   </listitem>
4946  </varlistentry>
4947  <varlistentry>
4948   <term><parameter>chip</parameter></term>
4949   <listitem>
4950    <para>
4951     nand chip info structure
4952    </para>
4953   </listitem>
4954  </varlistentry>
4955  <varlistentry>
4956   <term><parameter>buf</parameter></term>
4957   <listitem>
4958    <para>
4959     buffer to store read data
4960    </para>
4961   </listitem>
4962  </varlistentry>
4963  <varlistentry>
4964   <term><parameter>oob_required</parameter></term>
4965   <listitem>
4966    <para>
4967     caller requires OOB data read to chip-&gt;oob_poi
4968    </para>
4969   </listitem>
4970  </varlistentry>
4971  <varlistentry>
4972   <term><parameter>page</parameter></term>
4973   <listitem>
4974    <para>
4975     page number to read
4976    </para>
4977   </listitem>
4978  </varlistentry>
4979 </variablelist>
4980</refsect1>
4981<refsect1>
4982<title>Description</title>
4983<para>
4984   Hardware ECC for large page chips, require OOB to be read first. For this
4985   ECC mode, the write_page method is re-used from ECC_HW. These methods
4986   read/write ECC from the OOB area, unlike the ECC_HW_SYNDROME support with
4987   multiple ECC steps, follows the <quote>infix ECC</quote> scheme and reads/writes ECC from
4988   the data area, by overwriting the NAND manufacturer bad block markings.
4989</para>
4990</refsect1>
4991</refentry>
4992
4993<refentry id="API-nand-read-page-syndrome">
4994<refentryinfo>
4995 <title>LINUX</title>
4996 <productname>Kernel Hackers Manual</productname>
4997 <date>July 2017</date>
4998</refentryinfo>
4999<refmeta>
5000 <refentrytitle><phrase>nand_read_page_syndrome</phrase></refentrytitle>
5001 <manvolnum>9</manvolnum>
5002 <refmiscinfo class="version">4.1.27</refmiscinfo>
5003</refmeta>
5004<refnamediv>
5005 <refname>nand_read_page_syndrome</refname>
5006 <refpurpose>
5007     [REPLACEABLE] hardware ECC syndrome based page read
5008 </refpurpose>
5009</refnamediv>
5010<refsynopsisdiv>
5011 <title>Synopsis</title>
5012  <funcsynopsis><funcprototype>
5013   <funcdef>int <function>nand_read_page_syndrome </function></funcdef>
5014   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5015   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5016   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
5017   <paramdef>int <parameter>oob_required</parameter></paramdef>
5018   <paramdef>int <parameter>page</parameter></paramdef>
5019  </funcprototype></funcsynopsis>
5020</refsynopsisdiv>
5021<refsect1>
5022 <title>Arguments</title>
5023 <variablelist>
5024  <varlistentry>
5025   <term><parameter>mtd</parameter></term>
5026   <listitem>
5027    <para>
5028     mtd info structure
5029    </para>
5030   </listitem>
5031  </varlistentry>
5032  <varlistentry>
5033   <term><parameter>chip</parameter></term>
5034   <listitem>
5035    <para>
5036     nand chip info structure
5037    </para>
5038   </listitem>
5039  </varlistentry>
5040  <varlistentry>
5041   <term><parameter>buf</parameter></term>
5042   <listitem>
5043    <para>
5044     buffer to store read data
5045    </para>
5046   </listitem>
5047  </varlistentry>
5048  <varlistentry>
5049   <term><parameter>oob_required</parameter></term>
5050   <listitem>
5051    <para>
5052     caller requires OOB data read to chip-&gt;oob_poi
5053    </para>
5054   </listitem>
5055  </varlistentry>
5056  <varlistentry>
5057   <term><parameter>page</parameter></term>
5058   <listitem>
5059    <para>
5060     page number to read
5061    </para>
5062   </listitem>
5063  </varlistentry>
5064 </variablelist>
5065</refsect1>
5066<refsect1>
5067<title>Description</title>
5068<para>
5069   The hw generator calculates the error syndrome automatically. Therefore we
5070   need a special oob layout and handling.
5071</para>
5072</refsect1>
5073</refentry>
5074
5075<refentry id="API-nand-transfer-oob">
5076<refentryinfo>
5077 <title>LINUX</title>
5078 <productname>Kernel Hackers Manual</productname>
5079 <date>July 2017</date>
5080</refentryinfo>
5081<refmeta>
5082 <refentrytitle><phrase>nand_transfer_oob</phrase></refentrytitle>
5083 <manvolnum>9</manvolnum>
5084 <refmiscinfo class="version">4.1.27</refmiscinfo>
5085</refmeta>
5086<refnamediv>
5087 <refname>nand_transfer_oob</refname>
5088 <refpurpose>
5089     [INTERN] Transfer oob to client buffer
5090 </refpurpose>
5091</refnamediv>
5092<refsynopsisdiv>
5093 <title>Synopsis</title>
5094  <funcsynopsis><funcprototype>
5095   <funcdef>uint8_t * <function>nand_transfer_oob </function></funcdef>
5096   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5097   <paramdef>uint8_t * <parameter>oob</parameter></paramdef>
5098   <paramdef>struct mtd_oob_ops * <parameter>ops</parameter></paramdef>
5099   <paramdef>size_t <parameter>len</parameter></paramdef>
5100  </funcprototype></funcsynopsis>
5101</refsynopsisdiv>
5102<refsect1>
5103 <title>Arguments</title>
5104 <variablelist>
5105  <varlistentry>
5106   <term><parameter>chip</parameter></term>
5107   <listitem>
5108    <para>
5109     nand chip structure
5110    </para>
5111   </listitem>
5112  </varlistentry>
5113  <varlistentry>
5114   <term><parameter>oob</parameter></term>
5115   <listitem>
5116    <para>
5117     oob destination address
5118    </para>
5119   </listitem>
5120  </varlistentry>
5121  <varlistentry>
5122   <term><parameter>ops</parameter></term>
5123   <listitem>
5124    <para>
5125     oob ops structure
5126    </para>
5127   </listitem>
5128  </varlistentry>
5129  <varlistentry>
5130   <term><parameter>len</parameter></term>
5131   <listitem>
5132    <para>
5133     size of oob to transfer
5134    </para>
5135   </listitem>
5136  </varlistentry>
5137 </variablelist>
5138</refsect1>
5139</refentry>
5140
5141<refentry id="API-nand-setup-read-retry">
5142<refentryinfo>
5143 <title>LINUX</title>
5144 <productname>Kernel Hackers Manual</productname>
5145 <date>July 2017</date>
5146</refentryinfo>
5147<refmeta>
5148 <refentrytitle><phrase>nand_setup_read_retry</phrase></refentrytitle>
5149 <manvolnum>9</manvolnum>
5150 <refmiscinfo class="version">4.1.27</refmiscinfo>
5151</refmeta>
5152<refnamediv>
5153 <refname>nand_setup_read_retry</refname>
5154 <refpurpose>
5155     [INTERN] Set the READ RETRY mode
5156 </refpurpose>
5157</refnamediv>
5158<refsynopsisdiv>
5159 <title>Synopsis</title>
5160  <funcsynopsis><funcprototype>
5161   <funcdef>int <function>nand_setup_read_retry </function></funcdef>
5162   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5163   <paramdef>int <parameter>retry_mode</parameter></paramdef>
5164  </funcprototype></funcsynopsis>
5165</refsynopsisdiv>
5166<refsect1>
5167 <title>Arguments</title>
5168 <variablelist>
5169  <varlistentry>
5170   <term><parameter>mtd</parameter></term>
5171   <listitem>
5172    <para>
5173     MTD device structure
5174    </para>
5175   </listitem>
5176  </varlistentry>
5177  <varlistentry>
5178   <term><parameter>retry_mode</parameter></term>
5179   <listitem>
5180    <para>
5181     the retry mode to use
5182    </para>
5183   </listitem>
5184  </varlistentry>
5185 </variablelist>
5186</refsect1>
5187<refsect1>
5188<title>Description</title>
5189<para>
5190   Some vendors supply a special command to shift the Vt threshold, to be used
5191   when there are too many bitflips in a page (i.e., ECC error). After setting
5192   a new threshold, the host should retry reading the page.
5193</para>
5194</refsect1>
5195</refentry>
5196
5197<refentry id="API-nand-do-read-ops">
5198<refentryinfo>
5199 <title>LINUX</title>
5200 <productname>Kernel Hackers Manual</productname>
5201 <date>July 2017</date>
5202</refentryinfo>
5203<refmeta>
5204 <refentrytitle><phrase>nand_do_read_ops</phrase></refentrytitle>
5205 <manvolnum>9</manvolnum>
5206 <refmiscinfo class="version">4.1.27</refmiscinfo>
5207</refmeta>
5208<refnamediv>
5209 <refname>nand_do_read_ops</refname>
5210 <refpurpose>
5211     [INTERN] Read data with ECC
5212 </refpurpose>
5213</refnamediv>
5214<refsynopsisdiv>
5215 <title>Synopsis</title>
5216  <funcsynopsis><funcprototype>
5217   <funcdef>int <function>nand_do_read_ops </function></funcdef>
5218   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5219   <paramdef>loff_t <parameter>from</parameter></paramdef>
5220   <paramdef>struct mtd_oob_ops * <parameter>ops</parameter></paramdef>
5221  </funcprototype></funcsynopsis>
5222</refsynopsisdiv>
5223<refsect1>
5224 <title>Arguments</title>
5225 <variablelist>
5226  <varlistentry>
5227   <term><parameter>mtd</parameter></term>
5228   <listitem>
5229    <para>
5230     MTD device structure
5231    </para>
5232   </listitem>
5233  </varlistentry>
5234  <varlistentry>
5235   <term><parameter>from</parameter></term>
5236   <listitem>
5237    <para>
5238     offset to read from
5239    </para>
5240   </listitem>
5241  </varlistentry>
5242  <varlistentry>
5243   <term><parameter>ops</parameter></term>
5244   <listitem>
5245    <para>
5246     oob ops structure
5247    </para>
5248   </listitem>
5249  </varlistentry>
5250 </variablelist>
5251</refsect1>
5252<refsect1>
5253<title>Description</title>
5254<para>
5255   Internal function. Called with chip held.
5256</para>
5257</refsect1>
5258</refentry>
5259
5260<refentry id="API-nand-read">
5261<refentryinfo>
5262 <title>LINUX</title>
5263 <productname>Kernel Hackers Manual</productname>
5264 <date>July 2017</date>
5265</refentryinfo>
5266<refmeta>
5267 <refentrytitle><phrase>nand_read</phrase></refentrytitle>
5268 <manvolnum>9</manvolnum>
5269 <refmiscinfo class="version">4.1.27</refmiscinfo>
5270</refmeta>
5271<refnamediv>
5272 <refname>nand_read</refname>
5273 <refpurpose>
5274     [MTD Interface] MTD compatibility function for nand_do_read_ecc
5275 </refpurpose>
5276</refnamediv>
5277<refsynopsisdiv>
5278 <title>Synopsis</title>
5279  <funcsynopsis><funcprototype>
5280   <funcdef>int <function>nand_read </function></funcdef>
5281   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5282   <paramdef>loff_t <parameter>from</parameter></paramdef>
5283   <paramdef>size_t <parameter>len</parameter></paramdef>
5284   <paramdef>size_t * <parameter>retlen</parameter></paramdef>
5285   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
5286  </funcprototype></funcsynopsis>
5287</refsynopsisdiv>
5288<refsect1>
5289 <title>Arguments</title>
5290 <variablelist>
5291  <varlistentry>
5292   <term><parameter>mtd</parameter></term>
5293   <listitem>
5294    <para>
5295     MTD device structure
5296    </para>
5297   </listitem>
5298  </varlistentry>
5299  <varlistentry>
5300   <term><parameter>from</parameter></term>
5301   <listitem>
5302    <para>
5303     offset to read from
5304    </para>
5305   </listitem>
5306  </varlistentry>
5307  <varlistentry>
5308   <term><parameter>len</parameter></term>
5309   <listitem>
5310    <para>
5311     number of bytes to read
5312    </para>
5313   </listitem>
5314  </varlistentry>
5315  <varlistentry>
5316   <term><parameter>retlen</parameter></term>
5317   <listitem>
5318    <para>
5319     pointer to variable to store the number of read bytes
5320    </para>
5321   </listitem>
5322  </varlistentry>
5323  <varlistentry>
5324   <term><parameter>buf</parameter></term>
5325   <listitem>
5326    <para>
5327     the databuffer to put data
5328    </para>
5329   </listitem>
5330  </varlistentry>
5331 </variablelist>
5332</refsect1>
5333<refsect1>
5334<title>Description</title>
5335<para>
5336   Get hold of the chip and call nand_do_read.
5337</para>
5338</refsect1>
5339</refentry>
5340
5341<refentry id="API-nand-read-oob-std">
5342<refentryinfo>
5343 <title>LINUX</title>
5344 <productname>Kernel Hackers Manual</productname>
5345 <date>July 2017</date>
5346</refentryinfo>
5347<refmeta>
5348 <refentrytitle><phrase>nand_read_oob_std</phrase></refentrytitle>
5349 <manvolnum>9</manvolnum>
5350 <refmiscinfo class="version">4.1.27</refmiscinfo>
5351</refmeta>
5352<refnamediv>
5353 <refname>nand_read_oob_std</refname>
5354 <refpurpose>
5355     [REPLACEABLE] the most common OOB data read function
5356 </refpurpose>
5357</refnamediv>
5358<refsynopsisdiv>
5359 <title>Synopsis</title>
5360  <funcsynopsis><funcprototype>
5361   <funcdef>int <function>nand_read_oob_std </function></funcdef>
5362   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5363   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5364   <paramdef>int <parameter>page</parameter></paramdef>
5365  </funcprototype></funcsynopsis>
5366</refsynopsisdiv>
5367<refsect1>
5368 <title>Arguments</title>
5369 <variablelist>
5370  <varlistentry>
5371   <term><parameter>mtd</parameter></term>
5372   <listitem>
5373    <para>
5374     mtd info structure
5375    </para>
5376   </listitem>
5377  </varlistentry>
5378  <varlistentry>
5379   <term><parameter>chip</parameter></term>
5380   <listitem>
5381    <para>
5382     nand chip info structure
5383    </para>
5384   </listitem>
5385  </varlistentry>
5386  <varlistentry>
5387   <term><parameter>page</parameter></term>
5388   <listitem>
5389    <para>
5390     page number to read
5391    </para>
5392   </listitem>
5393  </varlistentry>
5394 </variablelist>
5395</refsect1>
5396</refentry>
5397
5398<refentry id="API-nand-read-oob-syndrome">
5399<refentryinfo>
5400 <title>LINUX</title>
5401 <productname>Kernel Hackers Manual</productname>
5402 <date>July 2017</date>
5403</refentryinfo>
5404<refmeta>
5405 <refentrytitle><phrase>nand_read_oob_syndrome</phrase></refentrytitle>
5406 <manvolnum>9</manvolnum>
5407 <refmiscinfo class="version">4.1.27</refmiscinfo>
5408</refmeta>
5409<refnamediv>
5410 <refname>nand_read_oob_syndrome</refname>
5411 <refpurpose>
5412     [REPLACEABLE] OOB data read function for HW ECC with syndromes
5413 </refpurpose>
5414</refnamediv>
5415<refsynopsisdiv>
5416 <title>Synopsis</title>
5417  <funcsynopsis><funcprototype>
5418   <funcdef>int <function>nand_read_oob_syndrome </function></funcdef>
5419   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5420   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5421   <paramdef>int <parameter>page</parameter></paramdef>
5422  </funcprototype></funcsynopsis>
5423</refsynopsisdiv>
5424<refsect1>
5425 <title>Arguments</title>
5426 <variablelist>
5427  <varlistentry>
5428   <term><parameter>mtd</parameter></term>
5429   <listitem>
5430    <para>
5431     mtd info structure
5432    </para>
5433   </listitem>
5434  </varlistentry>
5435  <varlistentry>
5436   <term><parameter>chip</parameter></term>
5437   <listitem>
5438    <para>
5439     nand chip info structure
5440    </para>
5441   </listitem>
5442  </varlistentry>
5443  <varlistentry>
5444   <term><parameter>page</parameter></term>
5445   <listitem>
5446    <para>
5447     page number to read
5448    </para>
5449   </listitem>
5450  </varlistentry>
5451 </variablelist>
5452</refsect1>
5453</refentry>
5454
5455<refentry id="API-nand-write-oob-std">
5456<refentryinfo>
5457 <title>LINUX</title>
5458 <productname>Kernel Hackers Manual</productname>
5459 <date>July 2017</date>
5460</refentryinfo>
5461<refmeta>
5462 <refentrytitle><phrase>nand_write_oob_std</phrase></refentrytitle>
5463 <manvolnum>9</manvolnum>
5464 <refmiscinfo class="version">4.1.27</refmiscinfo>
5465</refmeta>
5466<refnamediv>
5467 <refname>nand_write_oob_std</refname>
5468 <refpurpose>
5469     [REPLACEABLE] the most common OOB data write function
5470 </refpurpose>
5471</refnamediv>
5472<refsynopsisdiv>
5473 <title>Synopsis</title>
5474  <funcsynopsis><funcprototype>
5475   <funcdef>int <function>nand_write_oob_std </function></funcdef>
5476   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5477   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5478   <paramdef>int <parameter>page</parameter></paramdef>
5479  </funcprototype></funcsynopsis>
5480</refsynopsisdiv>
5481<refsect1>
5482 <title>Arguments</title>
5483 <variablelist>
5484  <varlistentry>
5485   <term><parameter>mtd</parameter></term>
5486   <listitem>
5487    <para>
5488     mtd info structure
5489    </para>
5490   </listitem>
5491  </varlistentry>
5492  <varlistentry>
5493   <term><parameter>chip</parameter></term>
5494   <listitem>
5495    <para>
5496     nand chip info structure
5497    </para>
5498   </listitem>
5499  </varlistentry>
5500  <varlistentry>
5501   <term><parameter>page</parameter></term>
5502   <listitem>
5503    <para>
5504     page number to write
5505    </para>
5506   </listitem>
5507  </varlistentry>
5508 </variablelist>
5509</refsect1>
5510</refentry>
5511
5512<refentry id="API-nand-write-oob-syndrome">
5513<refentryinfo>
5514 <title>LINUX</title>
5515 <productname>Kernel Hackers Manual</productname>
5516 <date>July 2017</date>
5517</refentryinfo>
5518<refmeta>
5519 <refentrytitle><phrase>nand_write_oob_syndrome</phrase></refentrytitle>
5520 <manvolnum>9</manvolnum>
5521 <refmiscinfo class="version">4.1.27</refmiscinfo>
5522</refmeta>
5523<refnamediv>
5524 <refname>nand_write_oob_syndrome</refname>
5525 <refpurpose>
5526     [REPLACEABLE] OOB data write function for HW ECC with syndrome - only for large page flash
5527 </refpurpose>
5528</refnamediv>
5529<refsynopsisdiv>
5530 <title>Synopsis</title>
5531  <funcsynopsis><funcprototype>
5532   <funcdef>int <function>nand_write_oob_syndrome </function></funcdef>
5533   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5534   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5535   <paramdef>int <parameter>page</parameter></paramdef>
5536  </funcprototype></funcsynopsis>
5537</refsynopsisdiv>
5538<refsect1>
5539 <title>Arguments</title>
5540 <variablelist>
5541  <varlistentry>
5542   <term><parameter>mtd</parameter></term>
5543   <listitem>
5544    <para>
5545     mtd info structure
5546    </para>
5547   </listitem>
5548  </varlistentry>
5549  <varlistentry>
5550   <term><parameter>chip</parameter></term>
5551   <listitem>
5552    <para>
5553     nand chip info structure
5554    </para>
5555   </listitem>
5556  </varlistentry>
5557  <varlistentry>
5558   <term><parameter>page</parameter></term>
5559   <listitem>
5560    <para>
5561     page number to write
5562    </para>
5563   </listitem>
5564  </varlistentry>
5565 </variablelist>
5566</refsect1>
5567</refentry>
5568
5569<refentry id="API-nand-do-read-oob">
5570<refentryinfo>
5571 <title>LINUX</title>
5572 <productname>Kernel Hackers Manual</productname>
5573 <date>July 2017</date>
5574</refentryinfo>
5575<refmeta>
5576 <refentrytitle><phrase>nand_do_read_oob</phrase></refentrytitle>
5577 <manvolnum>9</manvolnum>
5578 <refmiscinfo class="version">4.1.27</refmiscinfo>
5579</refmeta>
5580<refnamediv>
5581 <refname>nand_do_read_oob</refname>
5582 <refpurpose>
5583     [INTERN] NAND read out-of-band
5584 </refpurpose>
5585</refnamediv>
5586<refsynopsisdiv>
5587 <title>Synopsis</title>
5588  <funcsynopsis><funcprototype>
5589   <funcdef>int <function>nand_do_read_oob </function></funcdef>
5590   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5591   <paramdef>loff_t <parameter>from</parameter></paramdef>
5592   <paramdef>struct mtd_oob_ops * <parameter>ops</parameter></paramdef>
5593  </funcprototype></funcsynopsis>
5594</refsynopsisdiv>
5595<refsect1>
5596 <title>Arguments</title>
5597 <variablelist>
5598  <varlistentry>
5599   <term><parameter>mtd</parameter></term>
5600   <listitem>
5601    <para>
5602     MTD device structure
5603    </para>
5604   </listitem>
5605  </varlistentry>
5606  <varlistentry>
5607   <term><parameter>from</parameter></term>
5608   <listitem>
5609    <para>
5610     offset to read from
5611    </para>
5612   </listitem>
5613  </varlistentry>
5614  <varlistentry>
5615   <term><parameter>ops</parameter></term>
5616   <listitem>
5617    <para>
5618     oob operations description structure
5619    </para>
5620   </listitem>
5621  </varlistentry>
5622 </variablelist>
5623</refsect1>
5624<refsect1>
5625<title>Description</title>
5626<para>
5627   NAND read out-of-band data from the spare area.
5628</para>
5629</refsect1>
5630</refentry>
5631
5632<refentry id="API-nand-read-oob">
5633<refentryinfo>
5634 <title>LINUX</title>
5635 <productname>Kernel Hackers Manual</productname>
5636 <date>July 2017</date>
5637</refentryinfo>
5638<refmeta>
5639 <refentrytitle><phrase>nand_read_oob</phrase></refentrytitle>
5640 <manvolnum>9</manvolnum>
5641 <refmiscinfo class="version">4.1.27</refmiscinfo>
5642</refmeta>
5643<refnamediv>
5644 <refname>nand_read_oob</refname>
5645 <refpurpose>
5646     [MTD Interface] NAND read data and/or out-of-band
5647 </refpurpose>
5648</refnamediv>
5649<refsynopsisdiv>
5650 <title>Synopsis</title>
5651  <funcsynopsis><funcprototype>
5652   <funcdef>int <function>nand_read_oob </function></funcdef>
5653   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5654   <paramdef>loff_t <parameter>from</parameter></paramdef>
5655   <paramdef>struct mtd_oob_ops * <parameter>ops</parameter></paramdef>
5656  </funcprototype></funcsynopsis>
5657</refsynopsisdiv>
5658<refsect1>
5659 <title>Arguments</title>
5660 <variablelist>
5661  <varlistentry>
5662   <term><parameter>mtd</parameter></term>
5663   <listitem>
5664    <para>
5665     MTD device structure
5666    </para>
5667   </listitem>
5668  </varlistentry>
5669  <varlistentry>
5670   <term><parameter>from</parameter></term>
5671   <listitem>
5672    <para>
5673     offset to read from
5674    </para>
5675   </listitem>
5676  </varlistentry>
5677  <varlistentry>
5678   <term><parameter>ops</parameter></term>
5679   <listitem>
5680    <para>
5681     oob operation description structure
5682    </para>
5683   </listitem>
5684  </varlistentry>
5685 </variablelist>
5686</refsect1>
5687<refsect1>
5688<title>Description</title>
5689<para>
5690   NAND read data and/or out-of-band data.
5691</para>
5692</refsect1>
5693</refentry>
5694
5695<refentry id="API-nand-write-page-raw">
5696<refentryinfo>
5697 <title>LINUX</title>
5698 <productname>Kernel Hackers Manual</productname>
5699 <date>July 2017</date>
5700</refentryinfo>
5701<refmeta>
5702 <refentrytitle><phrase>nand_write_page_raw</phrase></refentrytitle>
5703 <manvolnum>9</manvolnum>
5704 <refmiscinfo class="version">4.1.27</refmiscinfo>
5705</refmeta>
5706<refnamediv>
5707 <refname>nand_write_page_raw</refname>
5708 <refpurpose>
5709     [INTERN] raw page write function
5710 </refpurpose>
5711</refnamediv>
5712<refsynopsisdiv>
5713 <title>Synopsis</title>
5714  <funcsynopsis><funcprototype>
5715   <funcdef>int <function>nand_write_page_raw </function></funcdef>
5716   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5717   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5718   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
5719   <paramdef>int <parameter>oob_required</parameter></paramdef>
5720  </funcprototype></funcsynopsis>
5721</refsynopsisdiv>
5722<refsect1>
5723 <title>Arguments</title>
5724 <variablelist>
5725  <varlistentry>
5726   <term><parameter>mtd</parameter></term>
5727   <listitem>
5728    <para>
5729     mtd info structure
5730    </para>
5731   </listitem>
5732  </varlistentry>
5733  <varlistentry>
5734   <term><parameter>chip</parameter></term>
5735   <listitem>
5736    <para>
5737     nand chip info structure
5738    </para>
5739   </listitem>
5740  </varlistentry>
5741  <varlistentry>
5742   <term><parameter>buf</parameter></term>
5743   <listitem>
5744    <para>
5745     data buffer
5746    </para>
5747   </listitem>
5748  </varlistentry>
5749  <varlistentry>
5750   <term><parameter>oob_required</parameter></term>
5751   <listitem>
5752    <para>
5753     must write chip-&gt;oob_poi to OOB
5754    </para>
5755   </listitem>
5756  </varlistentry>
5757 </variablelist>
5758</refsect1>
5759<refsect1>
5760<title>Description</title>
5761<para>
5762   Not for syndrome calculating ECC controllers, which use a special oob layout.
5763</para>
5764</refsect1>
5765</refentry>
5766
5767<refentry id="API-nand-write-page-raw-syndrome">
5768<refentryinfo>
5769 <title>LINUX</title>
5770 <productname>Kernel Hackers Manual</productname>
5771 <date>July 2017</date>
5772</refentryinfo>
5773<refmeta>
5774 <refentrytitle><phrase>nand_write_page_raw_syndrome</phrase></refentrytitle>
5775 <manvolnum>9</manvolnum>
5776 <refmiscinfo class="version">4.1.27</refmiscinfo>
5777</refmeta>
5778<refnamediv>
5779 <refname>nand_write_page_raw_syndrome</refname>
5780 <refpurpose>
5781     [INTERN] raw page write function
5782 </refpurpose>
5783</refnamediv>
5784<refsynopsisdiv>
5785 <title>Synopsis</title>
5786  <funcsynopsis><funcprototype>
5787   <funcdef>int <function>nand_write_page_raw_syndrome </function></funcdef>
5788   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5789   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5790   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
5791   <paramdef>int <parameter>oob_required</parameter></paramdef>
5792  </funcprototype></funcsynopsis>
5793</refsynopsisdiv>
5794<refsect1>
5795 <title>Arguments</title>
5796 <variablelist>
5797  <varlistentry>
5798   <term><parameter>mtd</parameter></term>
5799   <listitem>
5800    <para>
5801     mtd info structure
5802    </para>
5803   </listitem>
5804  </varlistentry>
5805  <varlistentry>
5806   <term><parameter>chip</parameter></term>
5807   <listitem>
5808    <para>
5809     nand chip info structure
5810    </para>
5811   </listitem>
5812  </varlistentry>
5813  <varlistentry>
5814   <term><parameter>buf</parameter></term>
5815   <listitem>
5816    <para>
5817     data buffer
5818    </para>
5819   </listitem>
5820  </varlistentry>
5821  <varlistentry>
5822   <term><parameter>oob_required</parameter></term>
5823   <listitem>
5824    <para>
5825     must write chip-&gt;oob_poi to OOB
5826    </para>
5827   </listitem>
5828  </varlistentry>
5829 </variablelist>
5830</refsect1>
5831<refsect1>
5832<title>Description</title>
5833<para>
5834   We need a special oob layout and handling even when ECC isn't checked.
5835</para>
5836</refsect1>
5837</refentry>
5838
5839<refentry id="API-nand-write-page-swecc">
5840<refentryinfo>
5841 <title>LINUX</title>
5842 <productname>Kernel Hackers Manual</productname>
5843 <date>July 2017</date>
5844</refentryinfo>
5845<refmeta>
5846 <refentrytitle><phrase>nand_write_page_swecc</phrase></refentrytitle>
5847 <manvolnum>9</manvolnum>
5848 <refmiscinfo class="version">4.1.27</refmiscinfo>
5849</refmeta>
5850<refnamediv>
5851 <refname>nand_write_page_swecc</refname>
5852 <refpurpose>
5853     [REPLACEABLE] software ECC based page write function
5854 </refpurpose>
5855</refnamediv>
5856<refsynopsisdiv>
5857 <title>Synopsis</title>
5858  <funcsynopsis><funcprototype>
5859   <funcdef>int <function>nand_write_page_swecc </function></funcdef>
5860   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5861   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5862   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
5863   <paramdef>int <parameter>oob_required</parameter></paramdef>
5864  </funcprototype></funcsynopsis>
5865</refsynopsisdiv>
5866<refsect1>
5867 <title>Arguments</title>
5868 <variablelist>
5869  <varlistentry>
5870   <term><parameter>mtd</parameter></term>
5871   <listitem>
5872    <para>
5873     mtd info structure
5874    </para>
5875   </listitem>
5876  </varlistentry>
5877  <varlistentry>
5878   <term><parameter>chip</parameter></term>
5879   <listitem>
5880    <para>
5881     nand chip info structure
5882    </para>
5883   </listitem>
5884  </varlistentry>
5885  <varlistentry>
5886   <term><parameter>buf</parameter></term>
5887   <listitem>
5888    <para>
5889     data buffer
5890    </para>
5891   </listitem>
5892  </varlistentry>
5893  <varlistentry>
5894   <term><parameter>oob_required</parameter></term>
5895   <listitem>
5896    <para>
5897     must write chip-&gt;oob_poi to OOB
5898    </para>
5899   </listitem>
5900  </varlistentry>
5901 </variablelist>
5902</refsect1>
5903</refentry>
5904
5905<refentry id="API-nand-write-page-hwecc">
5906<refentryinfo>
5907 <title>LINUX</title>
5908 <productname>Kernel Hackers Manual</productname>
5909 <date>July 2017</date>
5910</refentryinfo>
5911<refmeta>
5912 <refentrytitle><phrase>nand_write_page_hwecc</phrase></refentrytitle>
5913 <manvolnum>9</manvolnum>
5914 <refmiscinfo class="version">4.1.27</refmiscinfo>
5915</refmeta>
5916<refnamediv>
5917 <refname>nand_write_page_hwecc</refname>
5918 <refpurpose>
5919     [REPLACEABLE] hardware ECC based page write function
5920 </refpurpose>
5921</refnamediv>
5922<refsynopsisdiv>
5923 <title>Synopsis</title>
5924  <funcsynopsis><funcprototype>
5925   <funcdef>int <function>nand_write_page_hwecc </function></funcdef>
5926   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5927   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5928   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
5929   <paramdef>int <parameter>oob_required</parameter></paramdef>
5930  </funcprototype></funcsynopsis>
5931</refsynopsisdiv>
5932<refsect1>
5933 <title>Arguments</title>
5934 <variablelist>
5935  <varlistentry>
5936   <term><parameter>mtd</parameter></term>
5937   <listitem>
5938    <para>
5939     mtd info structure
5940    </para>
5941   </listitem>
5942  </varlistentry>
5943  <varlistentry>
5944   <term><parameter>chip</parameter></term>
5945   <listitem>
5946    <para>
5947     nand chip info structure
5948    </para>
5949   </listitem>
5950  </varlistentry>
5951  <varlistentry>
5952   <term><parameter>buf</parameter></term>
5953   <listitem>
5954    <para>
5955     data buffer
5956    </para>
5957   </listitem>
5958  </varlistentry>
5959  <varlistentry>
5960   <term><parameter>oob_required</parameter></term>
5961   <listitem>
5962    <para>
5963     must write chip-&gt;oob_poi to OOB
5964    </para>
5965   </listitem>
5966  </varlistentry>
5967 </variablelist>
5968</refsect1>
5969</refentry>
5970
5971<refentry id="API-nand-write-subpage-hwecc">
5972<refentryinfo>
5973 <title>LINUX</title>
5974 <productname>Kernel Hackers Manual</productname>
5975 <date>July 2017</date>
5976</refentryinfo>
5977<refmeta>
5978 <refentrytitle><phrase>nand_write_subpage_hwecc</phrase></refentrytitle>
5979 <manvolnum>9</manvolnum>
5980 <refmiscinfo class="version">4.1.27</refmiscinfo>
5981</refmeta>
5982<refnamediv>
5983 <refname>nand_write_subpage_hwecc</refname>
5984 <refpurpose>
5985     [REPLACEABLE] hardware ECC based subpage write
5986 </refpurpose>
5987</refnamediv>
5988<refsynopsisdiv>
5989 <title>Synopsis</title>
5990  <funcsynopsis><funcprototype>
5991   <funcdef>int <function>nand_write_subpage_hwecc </function></funcdef>
5992   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
5993   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
5994   <paramdef>uint32_t <parameter>offset</parameter></paramdef>
5995   <paramdef>uint32_t <parameter>data_len</parameter></paramdef>
5996   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
5997   <paramdef>int <parameter>oob_required</parameter></paramdef>
5998  </funcprototype></funcsynopsis>
5999</refsynopsisdiv>
6000<refsect1>
6001 <title>Arguments</title>
6002 <variablelist>
6003  <varlistentry>
6004   <term><parameter>mtd</parameter></term>
6005   <listitem>
6006    <para>
6007     mtd info structure
6008    </para>
6009   </listitem>
6010  </varlistentry>
6011  <varlistentry>
6012   <term><parameter>chip</parameter></term>
6013   <listitem>
6014    <para>
6015     nand chip info structure
6016    </para>
6017   </listitem>
6018  </varlistentry>
6019  <varlistentry>
6020   <term><parameter>offset</parameter></term>
6021   <listitem>
6022    <para>
6023     column address of subpage within the page
6024    </para>
6025   </listitem>
6026  </varlistentry>
6027  <varlistentry>
6028   <term><parameter>data_len</parameter></term>
6029   <listitem>
6030    <para>
6031     data length
6032    </para>
6033   </listitem>
6034  </varlistentry>
6035  <varlistentry>
6036   <term><parameter>buf</parameter></term>
6037   <listitem>
6038    <para>
6039     data buffer
6040    </para>
6041   </listitem>
6042  </varlistentry>
6043  <varlistentry>
6044   <term><parameter>oob_required</parameter></term>
6045   <listitem>
6046    <para>
6047     must write chip-&gt;oob_poi to OOB
6048    </para>
6049   </listitem>
6050  </varlistentry>
6051 </variablelist>
6052</refsect1>
6053</refentry>
6054
6055<refentry id="API-nand-write-page-syndrome">
6056<refentryinfo>
6057 <title>LINUX</title>
6058 <productname>Kernel Hackers Manual</productname>
6059 <date>July 2017</date>
6060</refentryinfo>
6061<refmeta>
6062 <refentrytitle><phrase>nand_write_page_syndrome</phrase></refentrytitle>
6063 <manvolnum>9</manvolnum>
6064 <refmiscinfo class="version">4.1.27</refmiscinfo>
6065</refmeta>
6066<refnamediv>
6067 <refname>nand_write_page_syndrome</refname>
6068 <refpurpose>
6069     [REPLACEABLE] hardware ECC syndrome based page write
6070 </refpurpose>
6071</refnamediv>
6072<refsynopsisdiv>
6073 <title>Synopsis</title>
6074  <funcsynopsis><funcprototype>
6075   <funcdef>int <function>nand_write_page_syndrome </function></funcdef>
6076   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6077   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
6078   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
6079   <paramdef>int <parameter>oob_required</parameter></paramdef>
6080  </funcprototype></funcsynopsis>
6081</refsynopsisdiv>
6082<refsect1>
6083 <title>Arguments</title>
6084 <variablelist>
6085  <varlistentry>
6086   <term><parameter>mtd</parameter></term>
6087   <listitem>
6088    <para>
6089     mtd info structure
6090    </para>
6091   </listitem>
6092  </varlistentry>
6093  <varlistentry>
6094   <term><parameter>chip</parameter></term>
6095   <listitem>
6096    <para>
6097     nand chip info structure
6098    </para>
6099   </listitem>
6100  </varlistentry>
6101  <varlistentry>
6102   <term><parameter>buf</parameter></term>
6103   <listitem>
6104    <para>
6105     data buffer
6106    </para>
6107   </listitem>
6108  </varlistentry>
6109  <varlistentry>
6110   <term><parameter>oob_required</parameter></term>
6111   <listitem>
6112    <para>
6113     must write chip-&gt;oob_poi to OOB
6114    </para>
6115   </listitem>
6116  </varlistentry>
6117 </variablelist>
6118</refsect1>
6119<refsect1>
6120<title>Description</title>
6121<para>
6122   The hw generator calculates the error syndrome automatically. Therefore we
6123   need a special oob layout and handling.
6124</para>
6125</refsect1>
6126</refentry>
6127
6128<refentry id="API-nand-write-page">
6129<refentryinfo>
6130 <title>LINUX</title>
6131 <productname>Kernel Hackers Manual</productname>
6132 <date>July 2017</date>
6133</refentryinfo>
6134<refmeta>
6135 <refentrytitle><phrase>nand_write_page</phrase></refentrytitle>
6136 <manvolnum>9</manvolnum>
6137 <refmiscinfo class="version">4.1.27</refmiscinfo>
6138</refmeta>
6139<refnamediv>
6140 <refname>nand_write_page</refname>
6141 <refpurpose>
6142     [REPLACEABLE] write one page
6143 </refpurpose>
6144</refnamediv>
6145<refsynopsisdiv>
6146 <title>Synopsis</title>
6147  <funcsynopsis><funcprototype>
6148   <funcdef>int <function>nand_write_page </function></funcdef>
6149   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6150   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
6151   <paramdef>uint32_t <parameter>offset</parameter></paramdef>
6152   <paramdef>int <parameter>data_len</parameter></paramdef>
6153   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
6154   <paramdef>int <parameter>oob_required</parameter></paramdef>
6155   <paramdef>int <parameter>page</parameter></paramdef>
6156   <paramdef>int <parameter>cached</parameter></paramdef>
6157   <paramdef>int <parameter>raw</parameter></paramdef>
6158  </funcprototype></funcsynopsis>
6159</refsynopsisdiv>
6160<refsect1>
6161 <title>Arguments</title>
6162 <variablelist>
6163  <varlistentry>
6164   <term><parameter>mtd</parameter></term>
6165   <listitem>
6166    <para>
6167     MTD device structure
6168    </para>
6169   </listitem>
6170  </varlistentry>
6171  <varlistentry>
6172   <term><parameter>chip</parameter></term>
6173   <listitem>
6174    <para>
6175     NAND chip descriptor
6176    </para>
6177   </listitem>
6178  </varlistentry>
6179  <varlistentry>
6180   <term><parameter>offset</parameter></term>
6181   <listitem>
6182    <para>
6183     address offset within the page
6184    </para>
6185   </listitem>
6186  </varlistentry>
6187  <varlistentry>
6188   <term><parameter>data_len</parameter></term>
6189   <listitem>
6190    <para>
6191     length of actual data to be written
6192    </para>
6193   </listitem>
6194  </varlistentry>
6195  <varlistentry>
6196   <term><parameter>buf</parameter></term>
6197   <listitem>
6198    <para>
6199     the data to write
6200    </para>
6201   </listitem>
6202  </varlistentry>
6203  <varlistentry>
6204   <term><parameter>oob_required</parameter></term>
6205   <listitem>
6206    <para>
6207     must write chip-&gt;oob_poi to OOB
6208    </para>
6209   </listitem>
6210  </varlistentry>
6211  <varlistentry>
6212   <term><parameter>page</parameter></term>
6213   <listitem>
6214    <para>
6215     page number to write
6216    </para>
6217   </listitem>
6218  </varlistentry>
6219  <varlistentry>
6220   <term><parameter>cached</parameter></term>
6221   <listitem>
6222    <para>
6223     cached programming
6224    </para>
6225   </listitem>
6226  </varlistentry>
6227  <varlistentry>
6228   <term><parameter>raw</parameter></term>
6229   <listitem>
6230    <para>
6231     use _raw version of write_page
6232    </para>
6233   </listitem>
6234  </varlistentry>
6235 </variablelist>
6236</refsect1>
6237</refentry>
6238
6239<refentry id="API-nand-fill-oob">
6240<refentryinfo>
6241 <title>LINUX</title>
6242 <productname>Kernel Hackers Manual</productname>
6243 <date>July 2017</date>
6244</refentryinfo>
6245<refmeta>
6246 <refentrytitle><phrase>nand_fill_oob</phrase></refentrytitle>
6247 <manvolnum>9</manvolnum>
6248 <refmiscinfo class="version">4.1.27</refmiscinfo>
6249</refmeta>
6250<refnamediv>
6251 <refname>nand_fill_oob</refname>
6252 <refpurpose>
6253     [INTERN] Transfer client buffer to oob
6254 </refpurpose>
6255</refnamediv>
6256<refsynopsisdiv>
6257 <title>Synopsis</title>
6258  <funcsynopsis><funcprototype>
6259   <funcdef>uint8_t * <function>nand_fill_oob </function></funcdef>
6260   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6261   <paramdef>uint8_t * <parameter>oob</parameter></paramdef>
6262   <paramdef>size_t <parameter>len</parameter></paramdef>
6263   <paramdef>struct mtd_oob_ops * <parameter>ops</parameter></paramdef>
6264  </funcprototype></funcsynopsis>
6265</refsynopsisdiv>
6266<refsect1>
6267 <title>Arguments</title>
6268 <variablelist>
6269  <varlistentry>
6270   <term><parameter>mtd</parameter></term>
6271   <listitem>
6272    <para>
6273     MTD device structure
6274    </para>
6275   </listitem>
6276  </varlistentry>
6277  <varlistentry>
6278   <term><parameter>oob</parameter></term>
6279   <listitem>
6280    <para>
6281     oob data buffer
6282    </para>
6283   </listitem>
6284  </varlistentry>
6285  <varlistentry>
6286   <term><parameter>len</parameter></term>
6287   <listitem>
6288    <para>
6289     oob data write length
6290    </para>
6291   </listitem>
6292  </varlistentry>
6293  <varlistentry>
6294   <term><parameter>ops</parameter></term>
6295   <listitem>
6296    <para>
6297     oob ops structure
6298    </para>
6299   </listitem>
6300  </varlistentry>
6301 </variablelist>
6302</refsect1>
6303</refentry>
6304
6305<refentry id="API-nand-do-write-ops">
6306<refentryinfo>
6307 <title>LINUX</title>
6308 <productname>Kernel Hackers Manual</productname>
6309 <date>July 2017</date>
6310</refentryinfo>
6311<refmeta>
6312 <refentrytitle><phrase>nand_do_write_ops</phrase></refentrytitle>
6313 <manvolnum>9</manvolnum>
6314 <refmiscinfo class="version">4.1.27</refmiscinfo>
6315</refmeta>
6316<refnamediv>
6317 <refname>nand_do_write_ops</refname>
6318 <refpurpose>
6319     [INTERN] NAND write with ECC
6320 </refpurpose>
6321</refnamediv>
6322<refsynopsisdiv>
6323 <title>Synopsis</title>
6324  <funcsynopsis><funcprototype>
6325   <funcdef>int <function>nand_do_write_ops </function></funcdef>
6326   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6327   <paramdef>loff_t <parameter>to</parameter></paramdef>
6328   <paramdef>struct mtd_oob_ops * <parameter>ops</parameter></paramdef>
6329  </funcprototype></funcsynopsis>
6330</refsynopsisdiv>
6331<refsect1>
6332 <title>Arguments</title>
6333 <variablelist>
6334  <varlistentry>
6335   <term><parameter>mtd</parameter></term>
6336   <listitem>
6337    <para>
6338     MTD device structure
6339    </para>
6340   </listitem>
6341  </varlistentry>
6342  <varlistentry>
6343   <term><parameter>to</parameter></term>
6344   <listitem>
6345    <para>
6346     offset to write to
6347    </para>
6348   </listitem>
6349  </varlistentry>
6350  <varlistentry>
6351   <term><parameter>ops</parameter></term>
6352   <listitem>
6353    <para>
6354     oob operations description structure
6355    </para>
6356   </listitem>
6357  </varlistentry>
6358 </variablelist>
6359</refsect1>
6360<refsect1>
6361<title>Description</title>
6362<para>
6363   NAND write with ECC.
6364</para>
6365</refsect1>
6366</refentry>
6367
6368<refentry id="API-panic-nand-write">
6369<refentryinfo>
6370 <title>LINUX</title>
6371 <productname>Kernel Hackers Manual</productname>
6372 <date>July 2017</date>
6373</refentryinfo>
6374<refmeta>
6375 <refentrytitle><phrase>panic_nand_write</phrase></refentrytitle>
6376 <manvolnum>9</manvolnum>
6377 <refmiscinfo class="version">4.1.27</refmiscinfo>
6378</refmeta>
6379<refnamediv>
6380 <refname>panic_nand_write</refname>
6381 <refpurpose>
6382     [MTD Interface] NAND write with ECC
6383 </refpurpose>
6384</refnamediv>
6385<refsynopsisdiv>
6386 <title>Synopsis</title>
6387  <funcsynopsis><funcprototype>
6388   <funcdef>int <function>panic_nand_write </function></funcdef>
6389   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6390   <paramdef>loff_t <parameter>to</parameter></paramdef>
6391   <paramdef>size_t <parameter>len</parameter></paramdef>
6392   <paramdef>size_t * <parameter>retlen</parameter></paramdef>
6393   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
6394  </funcprototype></funcsynopsis>
6395</refsynopsisdiv>
6396<refsect1>
6397 <title>Arguments</title>
6398 <variablelist>
6399  <varlistentry>
6400   <term><parameter>mtd</parameter></term>
6401   <listitem>
6402    <para>
6403     MTD device structure
6404    </para>
6405   </listitem>
6406  </varlistentry>
6407  <varlistentry>
6408   <term><parameter>to</parameter></term>
6409   <listitem>
6410    <para>
6411     offset to write to
6412    </para>
6413   </listitem>
6414  </varlistentry>
6415  <varlistentry>
6416   <term><parameter>len</parameter></term>
6417   <listitem>
6418    <para>
6419     number of bytes to write
6420    </para>
6421   </listitem>
6422  </varlistentry>
6423  <varlistentry>
6424   <term><parameter>retlen</parameter></term>
6425   <listitem>
6426    <para>
6427     pointer to variable to store the number of written bytes
6428    </para>
6429   </listitem>
6430  </varlistentry>
6431  <varlistentry>
6432   <term><parameter>buf</parameter></term>
6433   <listitem>
6434    <para>
6435     the data to write
6436    </para>
6437   </listitem>
6438  </varlistentry>
6439 </variablelist>
6440</refsect1>
6441<refsect1>
6442<title>Description</title>
6443<para>
6444   NAND write with ECC. Used when performing writes in interrupt context, this
6445   may for example be called by mtdoops when writing an oops while in panic.
6446</para>
6447</refsect1>
6448</refentry>
6449
6450<refentry id="API-nand-write">
6451<refentryinfo>
6452 <title>LINUX</title>
6453 <productname>Kernel Hackers Manual</productname>
6454 <date>July 2017</date>
6455</refentryinfo>
6456<refmeta>
6457 <refentrytitle><phrase>nand_write</phrase></refentrytitle>
6458 <manvolnum>9</manvolnum>
6459 <refmiscinfo class="version">4.1.27</refmiscinfo>
6460</refmeta>
6461<refnamediv>
6462 <refname>nand_write</refname>
6463 <refpurpose>
6464     [MTD Interface] NAND write with ECC
6465 </refpurpose>
6466</refnamediv>
6467<refsynopsisdiv>
6468 <title>Synopsis</title>
6469  <funcsynopsis><funcprototype>
6470   <funcdef>int <function>nand_write </function></funcdef>
6471   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6472   <paramdef>loff_t <parameter>to</parameter></paramdef>
6473   <paramdef>size_t <parameter>len</parameter></paramdef>
6474   <paramdef>size_t * <parameter>retlen</parameter></paramdef>
6475   <paramdef>const uint8_t * <parameter>buf</parameter></paramdef>
6476  </funcprototype></funcsynopsis>
6477</refsynopsisdiv>
6478<refsect1>
6479 <title>Arguments</title>
6480 <variablelist>
6481  <varlistentry>
6482   <term><parameter>mtd</parameter></term>
6483   <listitem>
6484    <para>
6485     MTD device structure
6486    </para>
6487   </listitem>
6488  </varlistentry>
6489  <varlistentry>
6490   <term><parameter>to</parameter></term>
6491   <listitem>
6492    <para>
6493     offset to write to
6494    </para>
6495   </listitem>
6496  </varlistentry>
6497  <varlistentry>
6498   <term><parameter>len</parameter></term>
6499   <listitem>
6500    <para>
6501     number of bytes to write
6502    </para>
6503   </listitem>
6504  </varlistentry>
6505  <varlistentry>
6506   <term><parameter>retlen</parameter></term>
6507   <listitem>
6508    <para>
6509     pointer to variable to store the number of written bytes
6510    </para>
6511   </listitem>
6512  </varlistentry>
6513  <varlistentry>
6514   <term><parameter>buf</parameter></term>
6515   <listitem>
6516    <para>
6517     the data to write
6518    </para>
6519   </listitem>
6520  </varlistentry>
6521 </variablelist>
6522</refsect1>
6523<refsect1>
6524<title>Description</title>
6525<para>
6526   NAND write with ECC.
6527</para>
6528</refsect1>
6529</refentry>
6530
6531<refentry id="API-nand-do-write-oob">
6532<refentryinfo>
6533 <title>LINUX</title>
6534 <productname>Kernel Hackers Manual</productname>
6535 <date>July 2017</date>
6536</refentryinfo>
6537<refmeta>
6538 <refentrytitle><phrase>nand_do_write_oob</phrase></refentrytitle>
6539 <manvolnum>9</manvolnum>
6540 <refmiscinfo class="version">4.1.27</refmiscinfo>
6541</refmeta>
6542<refnamediv>
6543 <refname>nand_do_write_oob</refname>
6544 <refpurpose>
6545     [MTD Interface] NAND write out-of-band
6546 </refpurpose>
6547</refnamediv>
6548<refsynopsisdiv>
6549 <title>Synopsis</title>
6550  <funcsynopsis><funcprototype>
6551   <funcdef>int <function>nand_do_write_oob </function></funcdef>
6552   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6553   <paramdef>loff_t <parameter>to</parameter></paramdef>
6554   <paramdef>struct mtd_oob_ops * <parameter>ops</parameter></paramdef>
6555  </funcprototype></funcsynopsis>
6556</refsynopsisdiv>
6557<refsect1>
6558 <title>Arguments</title>
6559 <variablelist>
6560  <varlistentry>
6561   <term><parameter>mtd</parameter></term>
6562   <listitem>
6563    <para>
6564     MTD device structure
6565    </para>
6566   </listitem>
6567  </varlistentry>
6568  <varlistentry>
6569   <term><parameter>to</parameter></term>
6570   <listitem>
6571    <para>
6572     offset to write to
6573    </para>
6574   </listitem>
6575  </varlistentry>
6576  <varlistentry>
6577   <term><parameter>ops</parameter></term>
6578   <listitem>
6579    <para>
6580     oob operation description structure
6581    </para>
6582   </listitem>
6583  </varlistentry>
6584 </variablelist>
6585</refsect1>
6586<refsect1>
6587<title>Description</title>
6588<para>
6589   NAND write out-of-band.
6590</para>
6591</refsect1>
6592</refentry>
6593
6594<refentry id="API-nand-write-oob">
6595<refentryinfo>
6596 <title>LINUX</title>
6597 <productname>Kernel Hackers Manual</productname>
6598 <date>July 2017</date>
6599</refentryinfo>
6600<refmeta>
6601 <refentrytitle><phrase>nand_write_oob</phrase></refentrytitle>
6602 <manvolnum>9</manvolnum>
6603 <refmiscinfo class="version">4.1.27</refmiscinfo>
6604</refmeta>
6605<refnamediv>
6606 <refname>nand_write_oob</refname>
6607 <refpurpose>
6608     [MTD Interface] NAND write data and/or out-of-band
6609 </refpurpose>
6610</refnamediv>
6611<refsynopsisdiv>
6612 <title>Synopsis</title>
6613  <funcsynopsis><funcprototype>
6614   <funcdef>int <function>nand_write_oob </function></funcdef>
6615   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6616   <paramdef>loff_t <parameter>to</parameter></paramdef>
6617   <paramdef>struct mtd_oob_ops * <parameter>ops</parameter></paramdef>
6618  </funcprototype></funcsynopsis>
6619</refsynopsisdiv>
6620<refsect1>
6621 <title>Arguments</title>
6622 <variablelist>
6623  <varlistentry>
6624   <term><parameter>mtd</parameter></term>
6625   <listitem>
6626    <para>
6627     MTD device structure
6628    </para>
6629   </listitem>
6630  </varlistentry>
6631  <varlistentry>
6632   <term><parameter>to</parameter></term>
6633   <listitem>
6634    <para>
6635     offset to write to
6636    </para>
6637   </listitem>
6638  </varlistentry>
6639  <varlistentry>
6640   <term><parameter>ops</parameter></term>
6641   <listitem>
6642    <para>
6643     oob operation description structure
6644    </para>
6645   </listitem>
6646  </varlistentry>
6647 </variablelist>
6648</refsect1>
6649</refentry>
6650
6651<refentry id="API-single-erase">
6652<refentryinfo>
6653 <title>LINUX</title>
6654 <productname>Kernel Hackers Manual</productname>
6655 <date>July 2017</date>
6656</refentryinfo>
6657<refmeta>
6658 <refentrytitle><phrase>single_erase</phrase></refentrytitle>
6659 <manvolnum>9</manvolnum>
6660 <refmiscinfo class="version">4.1.27</refmiscinfo>
6661</refmeta>
6662<refnamediv>
6663 <refname>single_erase</refname>
6664 <refpurpose>
6665     [GENERIC] NAND standard block erase command function
6666 </refpurpose>
6667</refnamediv>
6668<refsynopsisdiv>
6669 <title>Synopsis</title>
6670  <funcsynopsis><funcprototype>
6671   <funcdef>int <function>single_erase </function></funcdef>
6672   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6673   <paramdef>int <parameter>page</parameter></paramdef>
6674  </funcprototype></funcsynopsis>
6675</refsynopsisdiv>
6676<refsect1>
6677 <title>Arguments</title>
6678 <variablelist>
6679  <varlistentry>
6680   <term><parameter>mtd</parameter></term>
6681   <listitem>
6682    <para>
6683     MTD device structure
6684    </para>
6685   </listitem>
6686  </varlistentry>
6687  <varlistentry>
6688   <term><parameter>page</parameter></term>
6689   <listitem>
6690    <para>
6691     the page address of the block which will be erased
6692    </para>
6693   </listitem>
6694  </varlistentry>
6695 </variablelist>
6696</refsect1>
6697<refsect1>
6698<title>Description</title>
6699<para>
6700   Standard erase command for NAND chips. Returns NAND status.
6701</para>
6702</refsect1>
6703</refentry>
6704
6705<refentry id="API-nand-erase">
6706<refentryinfo>
6707 <title>LINUX</title>
6708 <productname>Kernel Hackers Manual</productname>
6709 <date>July 2017</date>
6710</refentryinfo>
6711<refmeta>
6712 <refentrytitle><phrase>nand_erase</phrase></refentrytitle>
6713 <manvolnum>9</manvolnum>
6714 <refmiscinfo class="version">4.1.27</refmiscinfo>
6715</refmeta>
6716<refnamediv>
6717 <refname>nand_erase</refname>
6718 <refpurpose>
6719     [MTD Interface] erase block(s)
6720 </refpurpose>
6721</refnamediv>
6722<refsynopsisdiv>
6723 <title>Synopsis</title>
6724  <funcsynopsis><funcprototype>
6725   <funcdef>int <function>nand_erase </function></funcdef>
6726   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6727   <paramdef>struct erase_info * <parameter>instr</parameter></paramdef>
6728  </funcprototype></funcsynopsis>
6729</refsynopsisdiv>
6730<refsect1>
6731 <title>Arguments</title>
6732 <variablelist>
6733  <varlistentry>
6734   <term><parameter>mtd</parameter></term>
6735   <listitem>
6736    <para>
6737     MTD device structure
6738    </para>
6739   </listitem>
6740  </varlistentry>
6741  <varlistentry>
6742   <term><parameter>instr</parameter></term>
6743   <listitem>
6744    <para>
6745     erase instruction
6746    </para>
6747   </listitem>
6748  </varlistentry>
6749 </variablelist>
6750</refsect1>
6751<refsect1>
6752<title>Description</title>
6753<para>
6754   Erase one ore more blocks.
6755</para>
6756</refsect1>
6757</refentry>
6758
6759<refentry id="API-nand-erase-nand">
6760<refentryinfo>
6761 <title>LINUX</title>
6762 <productname>Kernel Hackers Manual</productname>
6763 <date>July 2017</date>
6764</refentryinfo>
6765<refmeta>
6766 <refentrytitle><phrase>nand_erase_nand</phrase></refentrytitle>
6767 <manvolnum>9</manvolnum>
6768 <refmiscinfo class="version">4.1.27</refmiscinfo>
6769</refmeta>
6770<refnamediv>
6771 <refname>nand_erase_nand</refname>
6772 <refpurpose>
6773     [INTERN] erase block(s)
6774 </refpurpose>
6775</refnamediv>
6776<refsynopsisdiv>
6777 <title>Synopsis</title>
6778  <funcsynopsis><funcprototype>
6779   <funcdef>int <function>nand_erase_nand </function></funcdef>
6780   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6781   <paramdef>struct erase_info * <parameter>instr</parameter></paramdef>
6782   <paramdef>int <parameter>allowbbt</parameter></paramdef>
6783  </funcprototype></funcsynopsis>
6784</refsynopsisdiv>
6785<refsect1>
6786 <title>Arguments</title>
6787 <variablelist>
6788  <varlistentry>
6789   <term><parameter>mtd</parameter></term>
6790   <listitem>
6791    <para>
6792     MTD device structure
6793    </para>
6794   </listitem>
6795  </varlistentry>
6796  <varlistentry>
6797   <term><parameter>instr</parameter></term>
6798   <listitem>
6799    <para>
6800     erase instruction
6801    </para>
6802   </listitem>
6803  </varlistentry>
6804  <varlistentry>
6805   <term><parameter>allowbbt</parameter></term>
6806   <listitem>
6807    <para>
6808     allow erasing the bbt area
6809    </para>
6810   </listitem>
6811  </varlistentry>
6812 </variablelist>
6813</refsect1>
6814<refsect1>
6815<title>Description</title>
6816<para>
6817   Erase one ore more blocks.
6818</para>
6819</refsect1>
6820</refentry>
6821
6822<refentry id="API-nand-sync">
6823<refentryinfo>
6824 <title>LINUX</title>
6825 <productname>Kernel Hackers Manual</productname>
6826 <date>July 2017</date>
6827</refentryinfo>
6828<refmeta>
6829 <refentrytitle><phrase>nand_sync</phrase></refentrytitle>
6830 <manvolnum>9</manvolnum>
6831 <refmiscinfo class="version">4.1.27</refmiscinfo>
6832</refmeta>
6833<refnamediv>
6834 <refname>nand_sync</refname>
6835 <refpurpose>
6836     [MTD Interface] sync
6837 </refpurpose>
6838</refnamediv>
6839<refsynopsisdiv>
6840 <title>Synopsis</title>
6841  <funcsynopsis><funcprototype>
6842   <funcdef>void <function>nand_sync </function></funcdef>
6843   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6844  </funcprototype></funcsynopsis>
6845</refsynopsisdiv>
6846<refsect1>
6847 <title>Arguments</title>
6848 <variablelist>
6849  <varlistentry>
6850   <term><parameter>mtd</parameter></term>
6851   <listitem>
6852    <para>
6853     MTD device structure
6854    </para>
6855   </listitem>
6856  </varlistentry>
6857 </variablelist>
6858</refsect1>
6859<refsect1>
6860<title>Description</title>
6861<para>
6862   Sync is actually a wait for chip ready function.
6863</para>
6864</refsect1>
6865</refentry>
6866
6867<refentry id="API-nand-block-isbad">
6868<refentryinfo>
6869 <title>LINUX</title>
6870 <productname>Kernel Hackers Manual</productname>
6871 <date>July 2017</date>
6872</refentryinfo>
6873<refmeta>
6874 <refentrytitle><phrase>nand_block_isbad</phrase></refentrytitle>
6875 <manvolnum>9</manvolnum>
6876 <refmiscinfo class="version">4.1.27</refmiscinfo>
6877</refmeta>
6878<refnamediv>
6879 <refname>nand_block_isbad</refname>
6880 <refpurpose>
6881     [MTD Interface] Check if block at offset is bad
6882 </refpurpose>
6883</refnamediv>
6884<refsynopsisdiv>
6885 <title>Synopsis</title>
6886  <funcsynopsis><funcprototype>
6887   <funcdef>int <function>nand_block_isbad </function></funcdef>
6888   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6889   <paramdef>loff_t <parameter>offs</parameter></paramdef>
6890  </funcprototype></funcsynopsis>
6891</refsynopsisdiv>
6892<refsect1>
6893 <title>Arguments</title>
6894 <variablelist>
6895  <varlistentry>
6896   <term><parameter>mtd</parameter></term>
6897   <listitem>
6898    <para>
6899     MTD device structure
6900    </para>
6901   </listitem>
6902  </varlistentry>
6903  <varlistentry>
6904   <term><parameter>offs</parameter></term>
6905   <listitem>
6906    <para>
6907     offset relative to mtd start
6908    </para>
6909   </listitem>
6910  </varlistentry>
6911 </variablelist>
6912</refsect1>
6913</refentry>
6914
6915<refentry id="API-nand-block-markbad">
6916<refentryinfo>
6917 <title>LINUX</title>
6918 <productname>Kernel Hackers Manual</productname>
6919 <date>July 2017</date>
6920</refentryinfo>
6921<refmeta>
6922 <refentrytitle><phrase>nand_block_markbad</phrase></refentrytitle>
6923 <manvolnum>9</manvolnum>
6924 <refmiscinfo class="version">4.1.27</refmiscinfo>
6925</refmeta>
6926<refnamediv>
6927 <refname>nand_block_markbad</refname>
6928 <refpurpose>
6929     [MTD Interface] Mark block at the given offset as bad
6930 </refpurpose>
6931</refnamediv>
6932<refsynopsisdiv>
6933 <title>Synopsis</title>
6934  <funcsynopsis><funcprototype>
6935   <funcdef>int <function>nand_block_markbad </function></funcdef>
6936   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6937   <paramdef>loff_t <parameter>ofs</parameter></paramdef>
6938  </funcprototype></funcsynopsis>
6939</refsynopsisdiv>
6940<refsect1>
6941 <title>Arguments</title>
6942 <variablelist>
6943  <varlistentry>
6944   <term><parameter>mtd</parameter></term>
6945   <listitem>
6946    <para>
6947     MTD device structure
6948    </para>
6949   </listitem>
6950  </varlistentry>
6951  <varlistentry>
6952   <term><parameter>ofs</parameter></term>
6953   <listitem>
6954    <para>
6955     offset relative to mtd start
6956    </para>
6957   </listitem>
6958  </varlistentry>
6959 </variablelist>
6960</refsect1>
6961</refentry>
6962
6963<refentry id="API-nand-onfi-set-features">
6964<refentryinfo>
6965 <title>LINUX</title>
6966 <productname>Kernel Hackers Manual</productname>
6967 <date>July 2017</date>
6968</refentryinfo>
6969<refmeta>
6970 <refentrytitle><phrase>nand_onfi_set_features</phrase></refentrytitle>
6971 <manvolnum>9</manvolnum>
6972 <refmiscinfo class="version">4.1.27</refmiscinfo>
6973</refmeta>
6974<refnamediv>
6975 <refname>nand_onfi_set_features</refname>
6976 <refpurpose>
6977     [REPLACEABLE] set features for ONFI nand
6978 </refpurpose>
6979</refnamediv>
6980<refsynopsisdiv>
6981 <title>Synopsis</title>
6982  <funcsynopsis><funcprototype>
6983   <funcdef>int <function>nand_onfi_set_features </function></funcdef>
6984   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
6985   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
6986   <paramdef>int <parameter>addr</parameter></paramdef>
6987   <paramdef>uint8_t * <parameter>subfeature_param</parameter></paramdef>
6988  </funcprototype></funcsynopsis>
6989</refsynopsisdiv>
6990<refsect1>
6991 <title>Arguments</title>
6992 <variablelist>
6993  <varlistentry>
6994   <term><parameter>mtd</parameter></term>
6995   <listitem>
6996    <para>
6997     MTD device structure
6998    </para>
6999   </listitem>
7000  </varlistentry>
7001  <varlistentry>
7002   <term><parameter>chip</parameter></term>
7003   <listitem>
7004    <para>
7005     nand chip info structure
7006    </para>
7007   </listitem>
7008  </varlistentry>
7009  <varlistentry>
7010   <term><parameter>addr</parameter></term>
7011   <listitem>
7012    <para>
7013     feature address.
7014    </para>
7015   </listitem>
7016  </varlistentry>
7017  <varlistentry>
7018   <term><parameter>subfeature_param</parameter></term>
7019   <listitem>
7020    <para>
7021     the subfeature parameters, a four bytes array.
7022    </para>
7023   </listitem>
7024  </varlistentry>
7025 </variablelist>
7026</refsect1>
7027</refentry>
7028
7029<refentry id="API-nand-onfi-get-features">
7030<refentryinfo>
7031 <title>LINUX</title>
7032 <productname>Kernel Hackers Manual</productname>
7033 <date>July 2017</date>
7034</refentryinfo>
7035<refmeta>
7036 <refentrytitle><phrase>nand_onfi_get_features</phrase></refentrytitle>
7037 <manvolnum>9</manvolnum>
7038 <refmiscinfo class="version">4.1.27</refmiscinfo>
7039</refmeta>
7040<refnamediv>
7041 <refname>nand_onfi_get_features</refname>
7042 <refpurpose>
7043     [REPLACEABLE] get features for ONFI nand
7044 </refpurpose>
7045</refnamediv>
7046<refsynopsisdiv>
7047 <title>Synopsis</title>
7048  <funcsynopsis><funcprototype>
7049   <funcdef>int <function>nand_onfi_get_features </function></funcdef>
7050   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7051   <paramdef>struct nand_chip * <parameter>chip</parameter></paramdef>
7052   <paramdef>int <parameter>addr</parameter></paramdef>
7053   <paramdef>uint8_t * <parameter>subfeature_param</parameter></paramdef>
7054  </funcprototype></funcsynopsis>
7055</refsynopsisdiv>
7056<refsect1>
7057 <title>Arguments</title>
7058 <variablelist>
7059  <varlistentry>
7060   <term><parameter>mtd</parameter></term>
7061   <listitem>
7062    <para>
7063     MTD device structure
7064    </para>
7065   </listitem>
7066  </varlistentry>
7067  <varlistentry>
7068   <term><parameter>chip</parameter></term>
7069   <listitem>
7070    <para>
7071     nand chip info structure
7072    </para>
7073   </listitem>
7074  </varlistentry>
7075  <varlistentry>
7076   <term><parameter>addr</parameter></term>
7077   <listitem>
7078    <para>
7079     feature address.
7080    </para>
7081   </listitem>
7082  </varlistentry>
7083  <varlistentry>
7084   <term><parameter>subfeature_param</parameter></term>
7085   <listitem>
7086    <para>
7087     the subfeature parameters, a four bytes array.
7088    </para>
7089   </listitem>
7090  </varlistentry>
7091 </variablelist>
7092</refsect1>
7093</refentry>
7094
7095<refentry id="API-nand-suspend">
7096<refentryinfo>
7097 <title>LINUX</title>
7098 <productname>Kernel Hackers Manual</productname>
7099 <date>July 2017</date>
7100</refentryinfo>
7101<refmeta>
7102 <refentrytitle><phrase>nand_suspend</phrase></refentrytitle>
7103 <manvolnum>9</manvolnum>
7104 <refmiscinfo class="version">4.1.27</refmiscinfo>
7105</refmeta>
7106<refnamediv>
7107 <refname>nand_suspend</refname>
7108 <refpurpose>
7109     [MTD Interface] Suspend the NAND flash
7110 </refpurpose>
7111</refnamediv>
7112<refsynopsisdiv>
7113 <title>Synopsis</title>
7114  <funcsynopsis><funcprototype>
7115   <funcdef>int <function>nand_suspend </function></funcdef>
7116   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7117  </funcprototype></funcsynopsis>
7118</refsynopsisdiv>
7119<refsect1>
7120 <title>Arguments</title>
7121 <variablelist>
7122  <varlistentry>
7123   <term><parameter>mtd</parameter></term>
7124   <listitem>
7125    <para>
7126     MTD device structure
7127    </para>
7128   </listitem>
7129  </varlistentry>
7130 </variablelist>
7131</refsect1>
7132</refentry>
7133
7134<refentry id="API-nand-resume">
7135<refentryinfo>
7136 <title>LINUX</title>
7137 <productname>Kernel Hackers Manual</productname>
7138 <date>July 2017</date>
7139</refentryinfo>
7140<refmeta>
7141 <refentrytitle><phrase>nand_resume</phrase></refentrytitle>
7142 <manvolnum>9</manvolnum>
7143 <refmiscinfo class="version">4.1.27</refmiscinfo>
7144</refmeta>
7145<refnamediv>
7146 <refname>nand_resume</refname>
7147 <refpurpose>
7148     [MTD Interface] Resume the NAND flash
7149 </refpurpose>
7150</refnamediv>
7151<refsynopsisdiv>
7152 <title>Synopsis</title>
7153  <funcsynopsis><funcprototype>
7154   <funcdef>void <function>nand_resume </function></funcdef>
7155   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7156  </funcprototype></funcsynopsis>
7157</refsynopsisdiv>
7158<refsect1>
7159 <title>Arguments</title>
7160 <variablelist>
7161  <varlistentry>
7162   <term><parameter>mtd</parameter></term>
7163   <listitem>
7164    <para>
7165     MTD device structure
7166    </para>
7167   </listitem>
7168  </varlistentry>
7169 </variablelist>
7170</refsect1>
7171</refentry>
7172
7173<refentry id="API-nand-shutdown">
7174<refentryinfo>
7175 <title>LINUX</title>
7176 <productname>Kernel Hackers Manual</productname>
7177 <date>July 2017</date>
7178</refentryinfo>
7179<refmeta>
7180 <refentrytitle><phrase>nand_shutdown</phrase></refentrytitle>
7181 <manvolnum>9</manvolnum>
7182 <refmiscinfo class="version">4.1.27</refmiscinfo>
7183</refmeta>
7184<refnamediv>
7185 <refname>nand_shutdown</refname>
7186 <refpurpose>
7187     [MTD Interface] Finish the current NAND operation and prevent further operations
7188 </refpurpose>
7189</refnamediv>
7190<refsynopsisdiv>
7191 <title>Synopsis</title>
7192  <funcsynopsis><funcprototype>
7193   <funcdef>void <function>nand_shutdown </function></funcdef>
7194   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7195  </funcprototype></funcsynopsis>
7196</refsynopsisdiv>
7197<refsect1>
7198 <title>Arguments</title>
7199 <variablelist>
7200  <varlistentry>
7201   <term><parameter>mtd</parameter></term>
7202   <listitem>
7203    <para>
7204     MTD device structure
7205    </para>
7206   </listitem>
7207  </varlistentry>
7208 </variablelist>
7209</refsect1>
7210</refentry>
7211
7212<!-- drivers/mtd/nand/nand_bbt.c -->
7213<refentry id="API-check-pattern">
7214<refentryinfo>
7215 <title>LINUX</title>
7216 <productname>Kernel Hackers Manual</productname>
7217 <date>July 2017</date>
7218</refentryinfo>
7219<refmeta>
7220 <refentrytitle><phrase>check_pattern</phrase></refentrytitle>
7221 <manvolnum>9</manvolnum>
7222 <refmiscinfo class="version">4.1.27</refmiscinfo>
7223</refmeta>
7224<refnamediv>
7225 <refname>check_pattern</refname>
7226 <refpurpose>
7227  [GENERIC] check if a pattern is in the buffer
7228 </refpurpose>
7229</refnamediv>
7230<refsynopsisdiv>
7231 <title>Synopsis</title>
7232  <funcsynopsis><funcprototype>
7233   <funcdef>int <function>check_pattern </function></funcdef>
7234   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7235   <paramdef>int <parameter>len</parameter></paramdef>
7236   <paramdef>int <parameter>paglen</parameter></paramdef>
7237   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
7238  </funcprototype></funcsynopsis>
7239</refsynopsisdiv>
7240<refsect1>
7241 <title>Arguments</title>
7242 <variablelist>
7243  <varlistentry>
7244   <term><parameter>buf</parameter></term>
7245   <listitem>
7246    <para>
7247     the buffer to search
7248    </para>
7249   </listitem>
7250  </varlistentry>
7251  <varlistentry>
7252   <term><parameter>len</parameter></term>
7253   <listitem>
7254    <para>
7255     the length of buffer to search
7256    </para>
7257   </listitem>
7258  </varlistentry>
7259  <varlistentry>
7260   <term><parameter>paglen</parameter></term>
7261   <listitem>
7262    <para>
7263     the pagelength
7264    </para>
7265   </listitem>
7266  </varlistentry>
7267  <varlistentry>
7268   <term><parameter>td</parameter></term>
7269   <listitem>
7270    <para>
7271     search pattern descriptor
7272    </para>
7273   </listitem>
7274  </varlistentry>
7275 </variablelist>
7276</refsect1>
7277<refsect1>
7278<title>Description</title>
7279<para>
7280   Check for a pattern at the given place. Used to search bad block tables and
7281   good / bad block identifiers.
7282</para>
7283</refsect1>
7284</refentry>
7285
7286<refentry id="API-check-short-pattern">
7287<refentryinfo>
7288 <title>LINUX</title>
7289 <productname>Kernel Hackers Manual</productname>
7290 <date>July 2017</date>
7291</refentryinfo>
7292<refmeta>
7293 <refentrytitle><phrase>check_short_pattern</phrase></refentrytitle>
7294 <manvolnum>9</manvolnum>
7295 <refmiscinfo class="version">4.1.27</refmiscinfo>
7296</refmeta>
7297<refnamediv>
7298 <refname>check_short_pattern</refname>
7299 <refpurpose>
7300     [GENERIC] check if a pattern is in the buffer
7301 </refpurpose>
7302</refnamediv>
7303<refsynopsisdiv>
7304 <title>Synopsis</title>
7305  <funcsynopsis><funcprototype>
7306   <funcdef>int <function>check_short_pattern </function></funcdef>
7307   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7308   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
7309  </funcprototype></funcsynopsis>
7310</refsynopsisdiv>
7311<refsect1>
7312 <title>Arguments</title>
7313 <variablelist>
7314  <varlistentry>
7315   <term><parameter>buf</parameter></term>
7316   <listitem>
7317    <para>
7318     the buffer to search
7319    </para>
7320   </listitem>
7321  </varlistentry>
7322  <varlistentry>
7323   <term><parameter>td</parameter></term>
7324   <listitem>
7325    <para>
7326     search pattern descriptor
7327    </para>
7328   </listitem>
7329  </varlistentry>
7330 </variablelist>
7331</refsect1>
7332<refsect1>
7333<title>Description</title>
7334<para>
7335   Check for a pattern at the given place. Used to search bad block tables and
7336   good / bad block identifiers. Same as check_pattern, but no optional empty
7337   check.
7338</para>
7339</refsect1>
7340</refentry>
7341
7342<refentry id="API-add-marker-len">
7343<refentryinfo>
7344 <title>LINUX</title>
7345 <productname>Kernel Hackers Manual</productname>
7346 <date>July 2017</date>
7347</refentryinfo>
7348<refmeta>
7349 <refentrytitle><phrase>add_marker_len</phrase></refentrytitle>
7350 <manvolnum>9</manvolnum>
7351 <refmiscinfo class="version">4.1.27</refmiscinfo>
7352</refmeta>
7353<refnamediv>
7354 <refname>add_marker_len</refname>
7355 <refpurpose>
7356     compute the length of the marker in data area
7357 </refpurpose>
7358</refnamediv>
7359<refsynopsisdiv>
7360 <title>Synopsis</title>
7361  <funcsynopsis><funcprototype>
7362   <funcdef>u32 <function>add_marker_len </function></funcdef>
7363   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
7364  </funcprototype></funcsynopsis>
7365</refsynopsisdiv>
7366<refsect1>
7367 <title>Arguments</title>
7368 <variablelist>
7369  <varlistentry>
7370   <term><parameter>td</parameter></term>
7371   <listitem>
7372    <para>
7373     BBT descriptor used for computation
7374    </para>
7375   </listitem>
7376  </varlistentry>
7377 </variablelist>
7378</refsect1>
7379<refsect1>
7380<title>Description</title>
7381<para>
7382   The length will be 0 if the marker is located in OOB area.
7383</para>
7384</refsect1>
7385</refentry>
7386
7387<refentry id="API-read-bbt">
7388<refentryinfo>
7389 <title>LINUX</title>
7390 <productname>Kernel Hackers Manual</productname>
7391 <date>July 2017</date>
7392</refentryinfo>
7393<refmeta>
7394 <refentrytitle><phrase>read_bbt</phrase></refentrytitle>
7395 <manvolnum>9</manvolnum>
7396 <refmiscinfo class="version">4.1.27</refmiscinfo>
7397</refmeta>
7398<refnamediv>
7399 <refname>read_bbt</refname>
7400 <refpurpose>
7401     [GENERIC] Read the bad block table starting from page
7402 </refpurpose>
7403</refnamediv>
7404<refsynopsisdiv>
7405 <title>Synopsis</title>
7406  <funcsynopsis><funcprototype>
7407   <funcdef>int <function>read_bbt </function></funcdef>
7408   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7409   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7410   <paramdef>int <parameter>page</parameter></paramdef>
7411   <paramdef>int <parameter>num</parameter></paramdef>
7412   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
7413   <paramdef>int <parameter>offs</parameter></paramdef>
7414  </funcprototype></funcsynopsis>
7415</refsynopsisdiv>
7416<refsect1>
7417 <title>Arguments</title>
7418 <variablelist>
7419  <varlistentry>
7420   <term><parameter>mtd</parameter></term>
7421   <listitem>
7422    <para>
7423     MTD device structure
7424    </para>
7425   </listitem>
7426  </varlistentry>
7427  <varlistentry>
7428   <term><parameter>buf</parameter></term>
7429   <listitem>
7430    <para>
7431     temporary buffer
7432    </para>
7433   </listitem>
7434  </varlistentry>
7435  <varlistentry>
7436   <term><parameter>page</parameter></term>
7437   <listitem>
7438    <para>
7439     the starting page
7440    </para>
7441   </listitem>
7442  </varlistentry>
7443  <varlistentry>
7444   <term><parameter>num</parameter></term>
7445   <listitem>
7446    <para>
7447     the number of bbt descriptors to read
7448    </para>
7449   </listitem>
7450  </varlistentry>
7451  <varlistentry>
7452   <term><parameter>td</parameter></term>
7453   <listitem>
7454    <para>
7455     the bbt describtion table
7456    </para>
7457   </listitem>
7458  </varlistentry>
7459  <varlistentry>
7460   <term><parameter>offs</parameter></term>
7461   <listitem>
7462    <para>
7463     block number offset in the table
7464    </para>
7465   </listitem>
7466  </varlistentry>
7467 </variablelist>
7468</refsect1>
7469<refsect1>
7470<title>Description</title>
7471<para>
7472   Read the bad block table starting from page.
7473</para>
7474</refsect1>
7475</refentry>
7476
7477<refentry id="API-read-abs-bbt">
7478<refentryinfo>
7479 <title>LINUX</title>
7480 <productname>Kernel Hackers Manual</productname>
7481 <date>July 2017</date>
7482</refentryinfo>
7483<refmeta>
7484 <refentrytitle><phrase>read_abs_bbt</phrase></refentrytitle>
7485 <manvolnum>9</manvolnum>
7486 <refmiscinfo class="version">4.1.27</refmiscinfo>
7487</refmeta>
7488<refnamediv>
7489 <refname>read_abs_bbt</refname>
7490 <refpurpose>
7491     [GENERIC] Read the bad block table starting at a given page
7492 </refpurpose>
7493</refnamediv>
7494<refsynopsisdiv>
7495 <title>Synopsis</title>
7496  <funcsynopsis><funcprototype>
7497   <funcdef>int <function>read_abs_bbt </function></funcdef>
7498   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7499   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7500   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
7501   <paramdef>int <parameter>chip</parameter></paramdef>
7502  </funcprototype></funcsynopsis>
7503</refsynopsisdiv>
7504<refsect1>
7505 <title>Arguments</title>
7506 <variablelist>
7507  <varlistentry>
7508   <term><parameter>mtd</parameter></term>
7509   <listitem>
7510    <para>
7511     MTD device structure
7512    </para>
7513   </listitem>
7514  </varlistentry>
7515  <varlistentry>
7516   <term><parameter>buf</parameter></term>
7517   <listitem>
7518    <para>
7519     temporary buffer
7520    </para>
7521   </listitem>
7522  </varlistentry>
7523  <varlistentry>
7524   <term><parameter>td</parameter></term>
7525   <listitem>
7526    <para>
7527     descriptor for the bad block table
7528    </para>
7529   </listitem>
7530  </varlistentry>
7531  <varlistentry>
7532   <term><parameter>chip</parameter></term>
7533   <listitem>
7534    <para>
7535     read the table for a specific chip, -1 read all chips; applies only if
7536     NAND_BBT_PERCHIP option is set
7537    </para>
7538   </listitem>
7539  </varlistentry>
7540 </variablelist>
7541</refsect1>
7542<refsect1>
7543<title>Description</title>
7544<para>
7545   Read the bad block table for all chips starting at a given page. We assume
7546   that the bbt bits are in consecutive order.
7547</para>
7548</refsect1>
7549</refentry>
7550
7551<refentry id="API-scan-read-oob">
7552<refentryinfo>
7553 <title>LINUX</title>
7554 <productname>Kernel Hackers Manual</productname>
7555 <date>July 2017</date>
7556</refentryinfo>
7557<refmeta>
7558 <refentrytitle><phrase>scan_read_oob</phrase></refentrytitle>
7559 <manvolnum>9</manvolnum>
7560 <refmiscinfo class="version">4.1.27</refmiscinfo>
7561</refmeta>
7562<refnamediv>
7563 <refname>scan_read_oob</refname>
7564 <refpurpose>
7565     [GENERIC] Scan data+OOB region to buffer
7566 </refpurpose>
7567</refnamediv>
7568<refsynopsisdiv>
7569 <title>Synopsis</title>
7570  <funcsynopsis><funcprototype>
7571   <funcdef>int <function>scan_read_oob </function></funcdef>
7572   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7573   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7574   <paramdef>loff_t <parameter>offs</parameter></paramdef>
7575   <paramdef>size_t <parameter>len</parameter></paramdef>
7576  </funcprototype></funcsynopsis>
7577</refsynopsisdiv>
7578<refsect1>
7579 <title>Arguments</title>
7580 <variablelist>
7581  <varlistentry>
7582   <term><parameter>mtd</parameter></term>
7583   <listitem>
7584    <para>
7585     MTD device structure
7586    </para>
7587   </listitem>
7588  </varlistentry>
7589  <varlistentry>
7590   <term><parameter>buf</parameter></term>
7591   <listitem>
7592    <para>
7593     temporary buffer
7594    </para>
7595   </listitem>
7596  </varlistentry>
7597  <varlistentry>
7598   <term><parameter>offs</parameter></term>
7599   <listitem>
7600    <para>
7601     offset at which to scan
7602    </para>
7603   </listitem>
7604  </varlistentry>
7605  <varlistentry>
7606   <term><parameter>len</parameter></term>
7607   <listitem>
7608    <para>
7609     length of data region to read
7610    </para>
7611   </listitem>
7612  </varlistentry>
7613 </variablelist>
7614</refsect1>
7615<refsect1>
7616<title>Description</title>
7617<para>
7618   Scan read data from data+OOB. May traverse multiple pages, interleaving
7619   page,OOB,page,OOB,... in buf. Completes transfer and returns the <quote>strongest</quote>
7620   ECC condition (error or bitflip). May quit on the first (non-ECC) error.
7621</para>
7622</refsect1>
7623</refentry>
7624
7625<refentry id="API-read-abs-bbts">
7626<refentryinfo>
7627 <title>LINUX</title>
7628 <productname>Kernel Hackers Manual</productname>
7629 <date>July 2017</date>
7630</refentryinfo>
7631<refmeta>
7632 <refentrytitle><phrase>read_abs_bbts</phrase></refentrytitle>
7633 <manvolnum>9</manvolnum>
7634 <refmiscinfo class="version">4.1.27</refmiscinfo>
7635</refmeta>
7636<refnamediv>
7637 <refname>read_abs_bbts</refname>
7638 <refpurpose>
7639     [GENERIC] Read the bad block table(s) for all chips starting at a given page
7640 </refpurpose>
7641</refnamediv>
7642<refsynopsisdiv>
7643 <title>Synopsis</title>
7644  <funcsynopsis><funcprototype>
7645   <funcdef>void <function>read_abs_bbts </function></funcdef>
7646   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7647   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7648   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
7649   <paramdef>struct nand_bbt_descr * <parameter>md</parameter></paramdef>
7650  </funcprototype></funcsynopsis>
7651</refsynopsisdiv>
7652<refsect1>
7653 <title>Arguments</title>
7654 <variablelist>
7655  <varlistentry>
7656   <term><parameter>mtd</parameter></term>
7657   <listitem>
7658    <para>
7659     MTD device structure
7660    </para>
7661   </listitem>
7662  </varlistentry>
7663  <varlistentry>
7664   <term><parameter>buf</parameter></term>
7665   <listitem>
7666    <para>
7667     temporary buffer
7668    </para>
7669   </listitem>
7670  </varlistentry>
7671  <varlistentry>
7672   <term><parameter>td</parameter></term>
7673   <listitem>
7674    <para>
7675     descriptor for the bad block table
7676    </para>
7677   </listitem>
7678  </varlistentry>
7679  <varlistentry>
7680   <term><parameter>md</parameter></term>
7681   <listitem>
7682    <para>
7683     descriptor for the bad block table mirror
7684    </para>
7685   </listitem>
7686  </varlistentry>
7687 </variablelist>
7688</refsect1>
7689<refsect1>
7690<title>Description</title>
7691<para>
7692   Read the bad block table(s) for all chips starting at a given page. We
7693   assume that the bbt bits are in consecutive order.
7694</para>
7695</refsect1>
7696</refentry>
7697
7698<refentry id="API-create-bbt">
7699<refentryinfo>
7700 <title>LINUX</title>
7701 <productname>Kernel Hackers Manual</productname>
7702 <date>July 2017</date>
7703</refentryinfo>
7704<refmeta>
7705 <refentrytitle><phrase>create_bbt</phrase></refentrytitle>
7706 <manvolnum>9</manvolnum>
7707 <refmiscinfo class="version">4.1.27</refmiscinfo>
7708</refmeta>
7709<refnamediv>
7710 <refname>create_bbt</refname>
7711 <refpurpose>
7712     [GENERIC] Create a bad block table by scanning the device
7713 </refpurpose>
7714</refnamediv>
7715<refsynopsisdiv>
7716 <title>Synopsis</title>
7717  <funcsynopsis><funcprototype>
7718   <funcdef>int <function>create_bbt </function></funcdef>
7719   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7720   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7721   <paramdef>struct nand_bbt_descr * <parameter>bd</parameter></paramdef>
7722   <paramdef>int <parameter>chip</parameter></paramdef>
7723  </funcprototype></funcsynopsis>
7724</refsynopsisdiv>
7725<refsect1>
7726 <title>Arguments</title>
7727 <variablelist>
7728  <varlistentry>
7729   <term><parameter>mtd</parameter></term>
7730   <listitem>
7731    <para>
7732     MTD device structure
7733    </para>
7734   </listitem>
7735  </varlistentry>
7736  <varlistentry>
7737   <term><parameter>buf</parameter></term>
7738   <listitem>
7739    <para>
7740     temporary buffer
7741    </para>
7742   </listitem>
7743  </varlistentry>
7744  <varlistentry>
7745   <term><parameter>bd</parameter></term>
7746   <listitem>
7747    <para>
7748     descriptor for the good/bad block search pattern
7749    </para>
7750   </listitem>
7751  </varlistentry>
7752  <varlistentry>
7753   <term><parameter>chip</parameter></term>
7754   <listitem>
7755    <para>
7756     create the table for a specific chip, -1 read all chips; applies only
7757     if NAND_BBT_PERCHIP option is set
7758    </para>
7759   </listitem>
7760  </varlistentry>
7761 </variablelist>
7762</refsect1>
7763<refsect1>
7764<title>Description</title>
7765<para>
7766   Create a bad block table by scanning the device for the given good/bad block
7767   identify pattern.
7768</para>
7769</refsect1>
7770</refentry>
7771
7772<refentry id="API-search-bbt">
7773<refentryinfo>
7774 <title>LINUX</title>
7775 <productname>Kernel Hackers Manual</productname>
7776 <date>July 2017</date>
7777</refentryinfo>
7778<refmeta>
7779 <refentrytitle><phrase>search_bbt</phrase></refentrytitle>
7780 <manvolnum>9</manvolnum>
7781 <refmiscinfo class="version">4.1.27</refmiscinfo>
7782</refmeta>
7783<refnamediv>
7784 <refname>search_bbt</refname>
7785 <refpurpose>
7786     [GENERIC] scan the device for a specific bad block table
7787 </refpurpose>
7788</refnamediv>
7789<refsynopsisdiv>
7790 <title>Synopsis</title>
7791  <funcsynopsis><funcprototype>
7792   <funcdef>int <function>search_bbt </function></funcdef>
7793   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7794   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7795   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
7796  </funcprototype></funcsynopsis>
7797</refsynopsisdiv>
7798<refsect1>
7799 <title>Arguments</title>
7800 <variablelist>
7801  <varlistentry>
7802   <term><parameter>mtd</parameter></term>
7803   <listitem>
7804    <para>
7805     MTD device structure
7806    </para>
7807   </listitem>
7808  </varlistentry>
7809  <varlistentry>
7810   <term><parameter>buf</parameter></term>
7811   <listitem>
7812    <para>
7813     temporary buffer
7814    </para>
7815   </listitem>
7816  </varlistentry>
7817  <varlistentry>
7818   <term><parameter>td</parameter></term>
7819   <listitem>
7820    <para>
7821     descriptor for the bad block table
7822    </para>
7823   </listitem>
7824  </varlistentry>
7825 </variablelist>
7826</refsect1>
7827<refsect1>
7828<title>Description</title>
7829<para>
7830   Read the bad block table by searching for a given ident pattern. Search is
7831   preformed either from the beginning up or from the end of the device
7832   downwards. The search starts always at the start of a block. If the option
7833   NAND_BBT_PERCHIP is given, each chip is searched for a bbt, which contains
7834   the bad block information of this chip. This is necessary to provide support
7835   for certain DOC devices.
7836   </para><para>
7837
7838   The bbt ident pattern resides in the oob area of the first page in a block.
7839</para>
7840</refsect1>
7841</refentry>
7842
7843<refentry id="API-search-read-bbts">
7844<refentryinfo>
7845 <title>LINUX</title>
7846 <productname>Kernel Hackers Manual</productname>
7847 <date>July 2017</date>
7848</refentryinfo>
7849<refmeta>
7850 <refentrytitle><phrase>search_read_bbts</phrase></refentrytitle>
7851 <manvolnum>9</manvolnum>
7852 <refmiscinfo class="version">4.1.27</refmiscinfo>
7853</refmeta>
7854<refnamediv>
7855 <refname>search_read_bbts</refname>
7856 <refpurpose>
7857     [GENERIC] scan the device for bad block table(s)
7858 </refpurpose>
7859</refnamediv>
7860<refsynopsisdiv>
7861 <title>Synopsis</title>
7862  <funcsynopsis><funcprototype>
7863   <funcdef>void <function>search_read_bbts </function></funcdef>
7864   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7865   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7866   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
7867   <paramdef>struct nand_bbt_descr * <parameter>md</parameter></paramdef>
7868  </funcprototype></funcsynopsis>
7869</refsynopsisdiv>
7870<refsect1>
7871 <title>Arguments</title>
7872 <variablelist>
7873  <varlistentry>
7874   <term><parameter>mtd</parameter></term>
7875   <listitem>
7876    <para>
7877     MTD device structure
7878    </para>
7879   </listitem>
7880  </varlistentry>
7881  <varlistentry>
7882   <term><parameter>buf</parameter></term>
7883   <listitem>
7884    <para>
7885     temporary buffer
7886    </para>
7887   </listitem>
7888  </varlistentry>
7889  <varlistentry>
7890   <term><parameter>td</parameter></term>
7891   <listitem>
7892    <para>
7893     descriptor for the bad block table
7894    </para>
7895   </listitem>
7896  </varlistentry>
7897  <varlistentry>
7898   <term><parameter>md</parameter></term>
7899   <listitem>
7900    <para>
7901     descriptor for the bad block table mirror
7902    </para>
7903   </listitem>
7904  </varlistentry>
7905 </variablelist>
7906</refsect1>
7907<refsect1>
7908<title>Description</title>
7909<para>
7910   Search and read the bad block table(s).
7911</para>
7912</refsect1>
7913</refentry>
7914
7915<refentry id="API-write-bbt">
7916<refentryinfo>
7917 <title>LINUX</title>
7918 <productname>Kernel Hackers Manual</productname>
7919 <date>July 2017</date>
7920</refentryinfo>
7921<refmeta>
7922 <refentrytitle><phrase>write_bbt</phrase></refentrytitle>
7923 <manvolnum>9</manvolnum>
7924 <refmiscinfo class="version">4.1.27</refmiscinfo>
7925</refmeta>
7926<refnamediv>
7927 <refname>write_bbt</refname>
7928 <refpurpose>
7929     [GENERIC] (Re)write the bad block table
7930 </refpurpose>
7931</refnamediv>
7932<refsynopsisdiv>
7933 <title>Synopsis</title>
7934  <funcsynopsis><funcprototype>
7935   <funcdef>int <function>write_bbt </function></funcdef>
7936   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
7937   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
7938   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
7939   <paramdef>struct nand_bbt_descr * <parameter>md</parameter></paramdef>
7940   <paramdef>int <parameter>chipsel</parameter></paramdef>
7941  </funcprototype></funcsynopsis>
7942</refsynopsisdiv>
7943<refsect1>
7944 <title>Arguments</title>
7945 <variablelist>
7946  <varlistentry>
7947   <term><parameter>mtd</parameter></term>
7948   <listitem>
7949    <para>
7950     MTD device structure
7951    </para>
7952   </listitem>
7953  </varlistentry>
7954  <varlistentry>
7955   <term><parameter>buf</parameter></term>
7956   <listitem>
7957    <para>
7958     temporary buffer
7959    </para>
7960   </listitem>
7961  </varlistentry>
7962  <varlistentry>
7963   <term><parameter>td</parameter></term>
7964   <listitem>
7965    <para>
7966     descriptor for the bad block table
7967    </para>
7968   </listitem>
7969  </varlistentry>
7970  <varlistentry>
7971   <term><parameter>md</parameter></term>
7972   <listitem>
7973    <para>
7974     descriptor for the bad block table mirror
7975    </para>
7976   </listitem>
7977  </varlistentry>
7978  <varlistentry>
7979   <term><parameter>chipsel</parameter></term>
7980   <listitem>
7981    <para>
7982     selector for a specific chip, -1 for all
7983    </para>
7984   </listitem>
7985  </varlistentry>
7986 </variablelist>
7987</refsect1>
7988<refsect1>
7989<title>Description</title>
7990<para>
7991   (Re)write the bad block table.
7992</para>
7993</refsect1>
7994</refentry>
7995
7996<refentry id="API-nand-memory-bbt">
7997<refentryinfo>
7998 <title>LINUX</title>
7999 <productname>Kernel Hackers Manual</productname>
8000 <date>July 2017</date>
8001</refentryinfo>
8002<refmeta>
8003 <refentrytitle><phrase>nand_memory_bbt</phrase></refentrytitle>
8004 <manvolnum>9</manvolnum>
8005 <refmiscinfo class="version">4.1.27</refmiscinfo>
8006</refmeta>
8007<refnamediv>
8008 <refname>nand_memory_bbt</refname>
8009 <refpurpose>
8010     [GENERIC] create a memory based bad block table
8011 </refpurpose>
8012</refnamediv>
8013<refsynopsisdiv>
8014 <title>Synopsis</title>
8015  <funcsynopsis><funcprototype>
8016   <funcdef>int <function>nand_memory_bbt </function></funcdef>
8017   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
8018   <paramdef>struct nand_bbt_descr * <parameter>bd</parameter></paramdef>
8019  </funcprototype></funcsynopsis>
8020</refsynopsisdiv>
8021<refsect1>
8022 <title>Arguments</title>
8023 <variablelist>
8024  <varlistentry>
8025   <term><parameter>mtd</parameter></term>
8026   <listitem>
8027    <para>
8028     MTD device structure
8029    </para>
8030   </listitem>
8031  </varlistentry>
8032  <varlistentry>
8033   <term><parameter>bd</parameter></term>
8034   <listitem>
8035    <para>
8036     descriptor for the good/bad block search pattern
8037    </para>
8038   </listitem>
8039  </varlistentry>
8040 </variablelist>
8041</refsect1>
8042<refsect1>
8043<title>Description</title>
8044<para>
8045   The function creates a memory based bbt by scanning the device for
8046   manufacturer / software marked good / bad blocks.
8047</para>
8048</refsect1>
8049</refentry>
8050
8051<refentry id="API-check-create">
8052<refentryinfo>
8053 <title>LINUX</title>
8054 <productname>Kernel Hackers Manual</productname>
8055 <date>July 2017</date>
8056</refentryinfo>
8057<refmeta>
8058 <refentrytitle><phrase>check_create</phrase></refentrytitle>
8059 <manvolnum>9</manvolnum>
8060 <refmiscinfo class="version">4.1.27</refmiscinfo>
8061</refmeta>
8062<refnamediv>
8063 <refname>check_create</refname>
8064 <refpurpose>
8065     [GENERIC] create and write bbt(s) if necessary
8066 </refpurpose>
8067</refnamediv>
8068<refsynopsisdiv>
8069 <title>Synopsis</title>
8070  <funcsynopsis><funcprototype>
8071   <funcdef>int <function>check_create </function></funcdef>
8072   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
8073   <paramdef>uint8_t * <parameter>buf</parameter></paramdef>
8074   <paramdef>struct nand_bbt_descr * <parameter>bd</parameter></paramdef>
8075  </funcprototype></funcsynopsis>
8076</refsynopsisdiv>
8077<refsect1>
8078 <title>Arguments</title>
8079 <variablelist>
8080  <varlistentry>
8081   <term><parameter>mtd</parameter></term>
8082   <listitem>
8083    <para>
8084     MTD device structure
8085    </para>
8086   </listitem>
8087  </varlistentry>
8088  <varlistentry>
8089   <term><parameter>buf</parameter></term>
8090   <listitem>
8091    <para>
8092     temporary buffer
8093    </para>
8094   </listitem>
8095  </varlistentry>
8096  <varlistentry>
8097   <term><parameter>bd</parameter></term>
8098   <listitem>
8099    <para>
8100     descriptor for the good/bad block search pattern
8101    </para>
8102   </listitem>
8103  </varlistentry>
8104 </variablelist>
8105</refsect1>
8106<refsect1>
8107<title>Description</title>
8108<para>
8109   The function checks the results of the previous call to read_bbt and creates
8110   / updates the bbt(s) if necessary. Creation is necessary if no bbt was found
8111   for the chip/device. Update is necessary if one of the tables is missing or
8112   the version nr. of one table is less than the other.
8113</para>
8114</refsect1>
8115</refentry>
8116
8117<refentry id="API-mark-bbt-region">
8118<refentryinfo>
8119 <title>LINUX</title>
8120 <productname>Kernel Hackers Manual</productname>
8121 <date>July 2017</date>
8122</refentryinfo>
8123<refmeta>
8124 <refentrytitle><phrase>mark_bbt_region</phrase></refentrytitle>
8125 <manvolnum>9</manvolnum>
8126 <refmiscinfo class="version">4.1.27</refmiscinfo>
8127</refmeta>
8128<refnamediv>
8129 <refname>mark_bbt_region</refname>
8130 <refpurpose>
8131     [GENERIC] mark the bad block table regions
8132 </refpurpose>
8133</refnamediv>
8134<refsynopsisdiv>
8135 <title>Synopsis</title>
8136  <funcsynopsis><funcprototype>
8137   <funcdef>void <function>mark_bbt_region </function></funcdef>
8138   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
8139   <paramdef>struct nand_bbt_descr * <parameter>td</parameter></paramdef>
8140  </funcprototype></funcsynopsis>
8141</refsynopsisdiv>
8142<refsect1>
8143 <title>Arguments</title>
8144 <variablelist>
8145  <varlistentry>
8146   <term><parameter>mtd</parameter></term>
8147   <listitem>
8148    <para>
8149     MTD device structure
8150    </para>
8151   </listitem>
8152  </varlistentry>
8153  <varlistentry>
8154   <term><parameter>td</parameter></term>
8155   <listitem>
8156    <para>
8157     bad block table descriptor
8158    </para>
8159   </listitem>
8160  </varlistentry>
8161 </variablelist>
8162</refsect1>
8163<refsect1>
8164<title>Description</title>
8165<para>
8166   The bad block table regions are marked as <quote>bad</quote> to prevent accidental
8167   erasures / writes. The regions are identified by the mark 0x02.
8168</para>
8169</refsect1>
8170</refentry>
8171
8172<refentry id="API-verify-bbt-descr">
8173<refentryinfo>
8174 <title>LINUX</title>
8175 <productname>Kernel Hackers Manual</productname>
8176 <date>July 2017</date>
8177</refentryinfo>
8178<refmeta>
8179 <refentrytitle><phrase>verify_bbt_descr</phrase></refentrytitle>
8180 <manvolnum>9</manvolnum>
8181 <refmiscinfo class="version">4.1.27</refmiscinfo>
8182</refmeta>
8183<refnamediv>
8184 <refname>verify_bbt_descr</refname>
8185 <refpurpose>
8186     verify the bad block description
8187 </refpurpose>
8188</refnamediv>
8189<refsynopsisdiv>
8190 <title>Synopsis</title>
8191  <funcsynopsis><funcprototype>
8192   <funcdef>void <function>verify_bbt_descr </function></funcdef>
8193   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
8194   <paramdef>struct nand_bbt_descr * <parameter>bd</parameter></paramdef>
8195  </funcprototype></funcsynopsis>
8196</refsynopsisdiv>
8197<refsect1>
8198 <title>Arguments</title>
8199 <variablelist>
8200  <varlistentry>
8201   <term><parameter>mtd</parameter></term>
8202   <listitem>
8203    <para>
8204     MTD device structure
8205    </para>
8206   </listitem>
8207  </varlistentry>
8208  <varlistentry>
8209   <term><parameter>bd</parameter></term>
8210   <listitem>
8211    <para>
8212     the table to verify
8213    </para>
8214   </listitem>
8215  </varlistentry>
8216 </variablelist>
8217</refsect1>
8218<refsect1>
8219<title>Description</title>
8220<para>
8221   This functions performs a few sanity checks on the bad block description
8222   table.
8223</para>
8224</refsect1>
8225</refentry>
8226
8227<refentry id="API-nand-update-bbt">
8228<refentryinfo>
8229 <title>LINUX</title>
8230 <productname>Kernel Hackers Manual</productname>
8231 <date>July 2017</date>
8232</refentryinfo>
8233<refmeta>
8234 <refentrytitle><phrase>nand_update_bbt</phrase></refentrytitle>
8235 <manvolnum>9</manvolnum>
8236 <refmiscinfo class="version">4.1.27</refmiscinfo>
8237</refmeta>
8238<refnamediv>
8239 <refname>nand_update_bbt</refname>
8240 <refpurpose>
8241     update bad block table(s)
8242 </refpurpose>
8243</refnamediv>
8244<refsynopsisdiv>
8245 <title>Synopsis</title>
8246  <funcsynopsis><funcprototype>
8247   <funcdef>int <function>nand_update_bbt </function></funcdef>
8248   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
8249   <paramdef>loff_t <parameter>offs</parameter></paramdef>
8250  </funcprototype></funcsynopsis>
8251</refsynopsisdiv>
8252<refsect1>
8253 <title>Arguments</title>
8254 <variablelist>
8255  <varlistentry>
8256   <term><parameter>mtd</parameter></term>
8257   <listitem>
8258    <para>
8259     MTD device structure
8260    </para>
8261   </listitem>
8262  </varlistentry>
8263  <varlistentry>
8264   <term><parameter>offs</parameter></term>
8265   <listitem>
8266    <para>
8267     the offset of the newly marked block
8268    </para>
8269   </listitem>
8270  </varlistentry>
8271 </variablelist>
8272</refsect1>
8273<refsect1>
8274<title>Description</title>
8275<para>
8276   The function updates the bad block table(s).
8277</para>
8278</refsect1>
8279</refentry>
8280
8281<refentry id="API-nand-create-badblock-pattern">
8282<refentryinfo>
8283 <title>LINUX</title>
8284 <productname>Kernel Hackers Manual</productname>
8285 <date>July 2017</date>
8286</refentryinfo>
8287<refmeta>
8288 <refentrytitle><phrase>nand_create_badblock_pattern</phrase></refentrytitle>
8289 <manvolnum>9</manvolnum>
8290 <refmiscinfo class="version">4.1.27</refmiscinfo>
8291</refmeta>
8292<refnamediv>
8293 <refname>nand_create_badblock_pattern</refname>
8294 <refpurpose>
8295     [INTERN] Creates a BBT descriptor structure
8296 </refpurpose>
8297</refnamediv>
8298<refsynopsisdiv>
8299 <title>Synopsis</title>
8300  <funcsynopsis><funcprototype>
8301   <funcdef>int <function>nand_create_badblock_pattern </function></funcdef>
8302   <paramdef>struct nand_chip * <parameter>this</parameter></paramdef>
8303  </funcprototype></funcsynopsis>
8304</refsynopsisdiv>
8305<refsect1>
8306 <title>Arguments</title>
8307 <variablelist>
8308  <varlistentry>
8309   <term><parameter>this</parameter></term>
8310   <listitem>
8311    <para>
8312     NAND chip to create descriptor for
8313    </para>
8314   </listitem>
8315  </varlistentry>
8316 </variablelist>
8317</refsect1>
8318<refsect1>
8319<title>Description</title>
8320<para>
8321   This function allocates and initializes a nand_bbt_descr for BBM detection
8322   based on the properties of <parameter>this</parameter>. The new descriptor is stored in
8323   this-&gt;badblock_pattern. Thus, this-&gt;badblock_pattern should be NULL when
8324   passed to this function.
8325</para>
8326</refsect1>
8327</refentry>
8328
8329<refentry id="API-nand-default-bbt">
8330<refentryinfo>
8331 <title>LINUX</title>
8332 <productname>Kernel Hackers Manual</productname>
8333 <date>July 2017</date>
8334</refentryinfo>
8335<refmeta>
8336 <refentrytitle><phrase>nand_default_bbt</phrase></refentrytitle>
8337 <manvolnum>9</manvolnum>
8338 <refmiscinfo class="version">4.1.27</refmiscinfo>
8339</refmeta>
8340<refnamediv>
8341 <refname>nand_default_bbt</refname>
8342 <refpurpose>
8343     [NAND Interface] Select a default bad block table for the device
8344 </refpurpose>
8345</refnamediv>
8346<refsynopsisdiv>
8347 <title>Synopsis</title>
8348  <funcsynopsis><funcprototype>
8349   <funcdef>int <function>nand_default_bbt </function></funcdef>
8350   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
8351  </funcprototype></funcsynopsis>
8352</refsynopsisdiv>
8353<refsect1>
8354 <title>Arguments</title>
8355 <variablelist>
8356  <varlistentry>
8357   <term><parameter>mtd</parameter></term>
8358   <listitem>
8359    <para>
8360     MTD device structure
8361    </para>
8362   </listitem>
8363  </varlistentry>
8364 </variablelist>
8365</refsect1>
8366<refsect1>
8367<title>Description</title>
8368<para>
8369   This function selects the default bad block table support for the device and
8370   calls the nand_scan_bbt function.
8371</para>
8372</refsect1>
8373</refentry>
8374
8375<refentry id="API-nand-isreserved-bbt">
8376<refentryinfo>
8377 <title>LINUX</title>
8378 <productname>Kernel Hackers Manual</productname>
8379 <date>July 2017</date>
8380</refentryinfo>
8381<refmeta>
8382 <refentrytitle><phrase>nand_isreserved_bbt</phrase></refentrytitle>
8383 <manvolnum>9</manvolnum>
8384 <refmiscinfo class="version">4.1.27</refmiscinfo>
8385</refmeta>
8386<refnamediv>
8387 <refname>nand_isreserved_bbt</refname>
8388 <refpurpose>
8389     [NAND Interface] Check if a block is reserved
8390 </refpurpose>
8391</refnamediv>
8392<refsynopsisdiv>
8393 <title>Synopsis</title>
8394  <funcsynopsis><funcprototype>
8395   <funcdef>int <function>nand_isreserved_bbt </function></funcdef>
8396   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
8397   <paramdef>loff_t <parameter>offs</parameter></paramdef>
8398  </funcprototype></funcsynopsis>
8399</refsynopsisdiv>
8400<refsect1>
8401 <title>Arguments</title>
8402 <variablelist>
8403  <varlistentry>
8404   <term><parameter>mtd</parameter></term>
8405   <listitem>
8406    <para>
8407     MTD device structure
8408    </para>
8409   </listitem>
8410  </varlistentry>
8411  <varlistentry>
8412   <term><parameter>offs</parameter></term>
8413   <listitem>
8414    <para>
8415     offset in the device
8416    </para>
8417   </listitem>
8418  </varlistentry>
8419 </variablelist>
8420</refsect1>
8421</refentry>
8422
8423<refentry id="API-nand-isbad-bbt">
8424<refentryinfo>
8425 <title>LINUX</title>
8426 <productname>Kernel Hackers Manual</productname>
8427 <date>July 2017</date>
8428</refentryinfo>
8429<refmeta>
8430 <refentrytitle><phrase>nand_isbad_bbt</phrase></refentrytitle>
8431 <manvolnum>9</manvolnum>
8432 <refmiscinfo class="version">4.1.27</refmiscinfo>
8433</refmeta>
8434<refnamediv>
8435 <refname>nand_isbad_bbt</refname>
8436 <refpurpose>
8437     [NAND Interface] Check if a block is bad
8438 </refpurpose>
8439</refnamediv>
8440<refsynopsisdiv>
8441 <title>Synopsis</title>
8442  <funcsynopsis><funcprototype>
8443   <funcdef>int <function>nand_isbad_bbt </function></funcdef>
8444   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
8445   <paramdef>loff_t <parameter>offs</parameter></paramdef>
8446   <paramdef>int <parameter>allowbbt</parameter></paramdef>
8447  </funcprototype></funcsynopsis>
8448</refsynopsisdiv>
8449<refsect1>
8450 <title>Arguments</title>
8451 <variablelist>
8452  <varlistentry>
8453   <term><parameter>mtd</parameter></term>
8454   <listitem>
8455    <para>
8456     MTD device structure
8457    </para>
8458   </listitem>
8459  </varlistentry>
8460  <varlistentry>
8461   <term><parameter>offs</parameter></term>
8462   <listitem>
8463    <para>
8464     offset in the device
8465    </para>
8466   </listitem>
8467  </varlistentry>
8468  <varlistentry>
8469   <term><parameter>allowbbt</parameter></term>
8470   <listitem>
8471    <para>
8472     allow access to bad block table region
8473    </para>
8474   </listitem>
8475  </varlistentry>
8476 </variablelist>
8477</refsect1>
8478</refentry>
8479
8480<refentry id="API-nand-markbad-bbt">
8481<refentryinfo>
8482 <title>LINUX</title>
8483 <productname>Kernel Hackers Manual</productname>
8484 <date>July 2017</date>
8485</refentryinfo>
8486<refmeta>
8487 <refentrytitle><phrase>nand_markbad_bbt</phrase></refentrytitle>
8488 <manvolnum>9</manvolnum>
8489 <refmiscinfo class="version">4.1.27</refmiscinfo>
8490</refmeta>
8491<refnamediv>
8492 <refname>nand_markbad_bbt</refname>
8493 <refpurpose>
8494     [NAND Interface] Mark a block bad in the BBT
8495 </refpurpose>
8496</refnamediv>
8497<refsynopsisdiv>
8498 <title>Synopsis</title>
8499  <funcsynopsis><funcprototype>
8500   <funcdef>int <function>nand_markbad_bbt </function></funcdef>
8501   <paramdef>struct mtd_info * <parameter>mtd</parameter></paramdef>
8502   <paramdef>loff_t <parameter>offs</parameter></paramdef>
8503  </funcprototype></funcsynopsis>
8504</refsynopsisdiv>
8505<refsect1>
8506 <title>Arguments</title>
8507 <variablelist>
8508  <varlistentry>
8509   <term><parameter>mtd</parameter></term>
8510   <listitem>
8511    <para>
8512     MTD device structure
8513    </para>
8514   </listitem>
8515  </varlistentry>
8516  <varlistentry>
8517   <term><parameter>offs</parameter></term>
8518   <listitem>
8519    <para>
8520     offset of the bad block
8521    </para>
8522   </listitem>
8523  </varlistentry>
8524 </variablelist>
8525</refsect1>
8526</refentry>
8527
8528<!-- No internal functions for kernel-doc:
8529X!Idrivers/mtd/nand/nand_ecc.c
8530-->
8531  </chapter>
8532
8533  <chapter id="credits">
8534     <title>Credits</title>
8535	<para>
8536		The following people have contributed to the NAND driver:
8537		<orderedlist>
8538			<listitem><para>Steven J. Hill<email>sjhill@realitydiluted.com</email></para></listitem>
8539			<listitem><para>David Woodhouse<email>dwmw2@infradead.org</email></para></listitem>
8540			<listitem><para>Thomas Gleixner<email>tglx@linutronix.de</email></para></listitem>
8541		</orderedlist>
8542		A lot of users have provided bugfixes, improvements and helping hands for testing.
8543		Thanks a lot.
8544	</para>
8545	<para>
8546		The following people have contributed to this document:
8547		<orderedlist>
8548			<listitem><para>Thomas Gleixner<email>tglx@linutronix.de</email></para></listitem>
8549		</orderedlist>
8550	</para>
8551  </chapter>
8552</book>
8553