mtd/drivers/mtd/nand nand_base.c, 1.88, 1.89 nand_bbt.c, 1.4, 1.5 nand_ecc.c, 1.11, 1.12

gleixner at infradead.org gleixner at infradead.org
Thu May 27 18:01:05 EDT 2004


Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv18795

Modified Files:
	nand_base.c nand_bbt.c nand_ecc.c 
Log Message:
Make function documentation docbook compatible. Signed-off-by: Thomas Gleixner <tglx at linutronix.de>

Index: nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- nand_base.c	26 May 2004 18:05:56 -0000	1.88
+++ nand_base.c	27 May 2004 22:01:02 -0000	1.89
@@ -131,7 +131,7 @@
 #define nand_verify_pages(...) (0)
 #endif
 		
-static void nand_get_chip (struct nand_chip *this, struct mtd_info *mtd, int new_state, int *erase_state);
+static void nand_get_chip (struct nand_chip *this, struct mtd_info *mtd, int new_state);
 
 /* Deselect and wake up anyone waiting on the device */
 static void nand_release_chip (struct mtd_info *mtd)
@@ -277,7 +277,7 @@
 		chipnr = (int)((unsigned long) ofs / this->chipsize);
 
 		/* Grab the lock and see if the device is available */
-		nand_get_chip (this, mtd, FL_READING, NULL);
+		nand_get_chip (this, mtd, FL_READING);
 
 		/* Select the NAND device */
 		this->select_chip(mtd, chipnr);
@@ -339,14 +339,15 @@
 	return (this->read_byte(mtd) & 0x80) ? 0 : 1; 
 }
 
-/* Check, if the block is already scanned in the bad block table.
- * If not, call the scan function and store the result in 
- * the table.
- *
+/**
+ * nand_block_checkbad - Check if a block is marked bad
  * @mtd:	MTD device structure
  * @ofs:	offset from device start
  * @getchip:	0, if the chip is already selected
  *
+ * Check, if the block is already scanned in the bad block table.
+ * If not, call the scan function and store the result in 
+ * the table.
  */
 static int nand_block_checkbad (struct mtd_info *mtd, loff_t ofs, int getchip)
 {
@@ -362,8 +363,15 @@
 	return this->bbt[block >> 3] & (1 << (block & 0x06)) ? 1 : 0;
 }
 
-/*
- * Send command to NAND device
+/**
+ * nand_command - Send command to NAND device
+ * @mtd:	MTD device structure
+ * @command:	the command to be sent
+ * @column:	the column address for this command, -1 if none
+ * @page_addr:	the page address for this command, -1 if none
+ *
+ * Send command to NAND device. This function is used for small page
+ * devices (256/512 Bytes per page)
  */
 static void nand_command (struct mtd_info *mtd, unsigned command, int column, int page_addr)
 {
@@ -455,10 +463,17 @@
 	while (!this->dev_ready(mtd));
 }
 
-/*
+/**
+ * nand_command_lp - Send command to NAND large page device
+ * @mtd:	MTD device structure
+ * @command:	the command to be sent
+ * @column:	the column address for this command, -1 if none
+ * @page_addr:	the page address for this command, -1 if none
+ *
  * Send command to NAND device. This is the version for the new large page devices
  * We dont have the seperate regions as we have in the small page devices.
- * We must emulate NAND_CMD_READOOB to keep the code compatible
+ * We must emulate NAND_CMD_READOOB to keep the code compatible.
+ *
  */
 static void nand_command_lp (struct mtd_info *mtd, unsigned command, int column, int page_addr)
 {
@@ -550,10 +565,15 @@
 	while (!this->dev_ready(mtd));
 }
 
-/*
- *	Get chip for selected access
+/**
+ * nand_get_chip - Get chip for selected access
+ * @this:	the nand chip descriptor
+ * @mtd:	MTD device structure
+ * @new_state:	the state which is requested 
+ *
+ * Get the device and lock it for exclusive access
  */
-static void nand_get_chip (struct nand_chip *this, struct mtd_info *mtd, int new_state, int *erase_state)
+static void nand_get_chip (struct nand_chip *this, struct mtd_info *mtd, int new_state)
 {
 
 	DECLARE_WAITQUEUE (wait, current);
@@ -578,15 +598,16 @@
 	goto retry;
 }
 
-/*
- * Wait for command done. This applies to erase and program only
- * Erase can take up to 400ms and program up to 20ms according to 
- * general NAND and SmartMedia specs
- *
+/**
+ * nand_wait - wait until the command is done
  * @mtd:	MTD device structure
  * @this:	NAND chip structure
  * @state:	state to select the max. timeout value
  *
+ * Wait for command done. This applies to erase and program only
+ * Erase can take up to 400ms and program up to 20ms according to 
+ * general NAND and SmartMedia specs
+ *
 */
 static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state)
 {
@@ -625,17 +646,20 @@
 	return status;
 }
 
-/*
- *	Nand_page_program function is used for write and writev !
- *	This function will always program a full page of data
- *	If you call it with a non page aligned buffer, you're lost :)
- *
+/**
+ * nand_write_page - write one page
  * @mtd:	MTD device structure
  * @this:	NAND chip structure
  * @page: 	startpage inside the chip, must be called with (page & this->pagemask)
  * @oob_buf:	out of band data buffer
  * @oobsel:	out of band selecttion structre
  * @cached:	1 = enable cached programming if supported by chip
+ *
+ * Nand_page_program function is used for write and writev !
+ * This function will always program a full page of data
+ * If you call it with a non page aligned buffer, you're lost :)
+ *
+ * Cached programming is not supported yet.
  */
 static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this, int page, 
 	u_char *oob_buf,  struct nand_oobinfo *oobsel, int cached)
@@ -725,15 +749,8 @@
 }
 
 #ifdef CONFIG_MTD_NAND_VERIFY_WRITE
-/*
- * The NAND device assumes that it is always writing to a cleanly erased page.
- * Hence, it performs its internal write verification only on bits that 
- * transitioned from 1 to 0. The device does NOT verify the whole page on a
- * byte by byte basis. It is possible that the page was not completely erased 
- * or the page is becoming unusable due to wear. The read with ECC would catch 
- * the error later when the ECC page check fails, but we would rather catch 
- * it early in the page write stage. Better to write no data than invalid data.
- *
+/**
+ * nand_verify_pages - verify the chip contents after a write
  * @mtd:	MTD device structure
  * @this:	NAND chip structure
  * @page: 	startpage inside the chip, must be called with (page & this->pagemask)
@@ -742,6 +759,14 @@
  * @oobsel:	out of band selecttion structre
  * @chipnr:	number of the current chip
  * @oobmode:	1 = full buffer verify, 0 = ecc only
+ *
+ * The NAND device assumes that it is always writing to a cleanly erased page.
+ * Hence, it performs its internal write verification only on bits that 
+ * transitioned from 1 to 0. The device does NOT verify the whole page on a
+ * byte by byte basis. It is possible that the page was not completely erased 
+ * or the page is becoming unusable due to wear. The read with ECC would catch 
+ * the error later when the ECC page check fails, but we would rather catch 
+ * it early in the page write stage. Better to write no data than invalid data.
  */
 static int nand_verify_pages (struct mtd_info *mtd, struct nand_chip *this, int page, int numpages, 
 	u_char *oob_buf, struct nand_oobinfo *oobsel, int chipnr, int oobmode)
@@ -819,14 +844,15 @@
 }
 #endif
 
-/*
- * This function simply calls nand_read_ecc with oob buffer and oobsel = NULL
- *
+/**
+ * nand_read - MTD compability function for nand_read_ecc
  * @mtd:	MTD device structure
  * @from:	offset to read from
  * @len:	number of bytes to read
  * @retlen:	pointer to variable to store the number of read bytes
  * @buf:	the databuffer to put data
+ *
+ * This function simply calls nand_read_ecc with oob buffer and oobsel = NULL
 */
 static int nand_read (struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf)
 {
@@ -834,9 +860,8 @@
 }			   
 
 
-/*
- * NAND read with ECC
- *
+/**
+ * nand_read_ecc - Read data with ECC
  * @mtd:	MTD device structure
  * @from:	offset to read from
  * @len:	number of bytes to read
@@ -844,12 +869,13 @@
  * @buf:	the databuffer to put data
  * @oob_buf:	filesystem supplied oob data buffer
  * @oobsel:	oob selection structure
+ *
+ * NAND read with ECC
  */
 static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
 			  size_t * retlen, u_char * buf, u_char * oob_buf, struct nand_oobinfo *oobsel)
 {
 	int i, j, col, realpage, page, end, ecc, chipnr, sndcmd = 1;
-	int erase_state = 0;
 	int read = 0, oob = 0, ecc_status = 0, ecc_failed = 0;
 	struct nand_chip *this = mtd->priv;
 	u_char *data_poi, *oob_data = oob_buf;
@@ -870,7 +896,7 @@
 	}
 
 	/* Grab the lock and see if the device is available */
-	nand_get_chip (this, mtd ,FL_READING, &erase_state);
+	nand_get_chip (this, mtd ,FL_READING);
 
 	/* use userspace supplied oobinfo, if zero */
 	if (oobsel == NULL)
@@ -1074,19 +1100,19 @@
 	return ecc_failed ? -EIO : 0;
 }
 
-/*
- * NAND read out-of-band
- *
+/**
+ * nand_read_oob - NAND read out-of-band
  * @mtd:	MTD device structure
  * @from:	offset to read from
  * @len:	number of bytes to read
  * @retlen:	pointer to variable to store the number of read bytes
  * @buf:	the databuffer to put data
+ *
+ * NAND read out-of-band data from the spare area
  */
 static int nand_read_oob (struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf)
 {
 	int i, col, page, chipnr;
-	int erase_state = 0;
 	struct nand_chip *this = mtd->priv;
 	int	blockcheck = (mtd->erasesize >> this->page_shift) - 1;
 
@@ -1110,7 +1136,7 @@
 	}
 
 	/* Grab the lock and see if the device is available */
-	nand_get_chip (this, mtd , FL_READING, &erase_state);
+	nand_get_chip (this, mtd , FL_READING);
 
 	/* Select the NAND device */
 	this->select_chip(mtd, chipnr);
@@ -1166,13 +1192,14 @@
 	return 0;
 }
 
-/* 
- * Read raw data including oob into buffer
- *
+/**
+ * nand_read_raw - Read raw data including oob into buffer
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @from:	offset to read from
  * @len:	number of bytes to read
+ *
+ * Read raw data including oob into buffer
  */
 int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_t len, size_t ooblen)
 {
@@ -1181,7 +1208,6 @@
 	int chipshift = ffs(this->chipsize) - 1;
 	int chip = (int) (from >> chipshift);
 	int sndcmd = 1;
-	int erase_state = 0;
 	int cnt = 0;
 	int pagesize = mtd->oobblock + mtd->oobsize;
 	int blockcheck = (mtd->erasesize >> this->page_shift) - 1;
@@ -1193,7 +1219,7 @@
 	}
 
 	/* Grab the lock and see if the device is available */
-	nand_get_chip (this, mtd , FL_READING, &erase_state);
+	nand_get_chip (this, mtd , FL_READING);
 
 	this->select_chip (mtd, chip);
 	
@@ -1227,7 +1253,13 @@
 }
 
 
-/* Prepare the out of band buffer 
+/** 
+ * nand_prepare_oobbuf - Prepare the out of band buffer 
+ * @mtd:	MTD device structure
+ * @fsbuf:	buffer given by fs driver
+ * @oobsel:	out of band selection structre
+ * @autoplace:	1 = place given buffer into the oob bytes
+ * @numpages:	number of pages to prepare
  *
  * Return:
  * 1. Filesystem buffer available and autoplacement is off,
@@ -1243,11 +1275,6 @@
  * Autoplacement sets the buffer dirty flag, which
  * forces the 0xff fill before using the buffer again.
  *
- * @mtd:	MTD device structure
- * @fsbuf:	buffer given by fs driver
- * @oobsel:	out of band selection structre
- * @autoplace:	1 = place given buffer into the oob bytes
- * @numpages:	number of pages to prepare
 */
 static u_char * nand_prepare_oobbuf (struct mtd_info *mtd, u_char *fsbuf, struct nand_oobinfo *oobsel,
 		int autoplace, int numpages)
@@ -1288,22 +1315,24 @@
 
 #define NOTALIGNED(x) (x & (mtd->oobblock-1)) != 0
 
-/*
- * This function simply calls nand_write_ecc with oob buffer and oobsel = NULL
- *
+/**
+ * nand_write - MTD compability function for nand_write_ecc
  * @mtd:	MTD device structure
  * @to:		offset to write to
  * @len:	number of bytes to write
  * @retlen:	pointer to variable to store the number of written bytes
  * @buf:	the data to write
+ *
+ * This function simply calls nand_write_ecc with oob buffer and oobsel = NULL
+ *
 */
 static int nand_write (struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char * buf)
 {
 	return (nand_write_ecc (mtd, to, len, retlen, buf, NULL, NULL));
-}			   
-/*
- * NAND write with ECC
- *
+}
+			   
+/**
+ * nand_write_ecc - NAND write with ECC
  * @mtd:	MTD device structure
  * @to:		offset to write to
  * @len:	number of bytes to write
@@ -1311,6 +1340,8 @@
  * @buf:	the data to write
  * @eccbuf:	filesystem supplied oob data buffer
  * @oobsel:	oob selection structure
+ *
+ * NAND write with ECC
  */
 static int nand_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
 			   size_t * retlen, const u_char * buf, u_char * eccbuf, struct nand_oobinfo *oobsel)
@@ -1339,7 +1370,7 @@
 	}
 
 	/* Grab the lock and see if the device is available */
-	nand_get_chip (this, mtd, FL_WRITING, NULL);
+	nand_get_chip (this, mtd, FL_WRITING);
 
 	/* Calculate chipnr */
 	chipnr = (int)((unsigned long) to / this->chipsize);
@@ -1450,14 +1481,15 @@
 }
 
 
-/*
- * NAND write out-of-band
- *
+/**
+ * nand_write_oob - NAND write out-of-band
  * @mtd:	MTD device structure
  * @to:		offset to write to
  * @len:	number of bytes to write
  * @retlen:	pointer to variable to store the number of written bytes
  * @buf:	the data to write
+ *
+ * NAND write out-of-band
  */
 static int nand_write_oob (struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char * buf)
 {
@@ -1483,7 +1515,7 @@
 	}
 
 	/* Grab the lock and see if the device is available */
-	nand_get_chip (this, mtd, FL_WRITING, NULL);
+	nand_get_chip (this, mtd, FL_WRITING);
 
 	/* Select the NAND device */
 	this->select_chip(mtd, chipnr);
@@ -1551,14 +1583,15 @@
 }
 
 
-/*
- * NAND write with iovec. This just calls the ecc function
- *
+/**
+ * nand_writev - MTD compabilty function for nand_writev_ecc
  * @mtd:	MTD device structure
  * @vecs:	the iovectors to write
  * @count:	number of vectors
  * @to:		offset to write to
  * @retlen:	pointer to variable to store the number of written bytes
+ *
+ * NAND write with iovec. This just calls the ecc function
  */
 static int nand_writev (struct mtd_info *mtd, const struct iovec *vecs, unsigned long count, 
 		loff_t to, size_t * retlen)
@@ -1566,9 +1599,8 @@
 	return (nand_writev_ecc (mtd, vecs, count, to, retlen, NULL, 0));	
 }
 
-/*
- * NAND write with iovec with ecc
- *
+/**
+ * nand_writev_ecc - NAND write with iovec with ecc
  * @mtd:	MTD device structure
  * @vecs:	the iovectors to write
  * @count:	number of vectors
@@ -1576,6 +1608,8 @@
  * @retlen:	pointer to variable to store the number of written bytes
  * @eccbuf:	filesystem supplied oob data buffer
  * @oobsel:	oob selection structure
+ *
+ * NAND write with iovec with ecc
  */
 static int nand_writev_ecc (struct mtd_info *mtd, const struct iovec *vecs, unsigned long count, 
 		loff_t to, size_t * retlen, u_char *eccbuf, struct nand_oobinfo *oobsel)
@@ -1610,7 +1644,7 @@
 	}
 
 	/* Grab the lock and see if the device is available */
-	nand_get_chip (this, mtd, FL_WRITING, NULL);
+	nand_get_chip (this, mtd, FL_WRITING);
 
 	/* Get the current chip-nr */
 	chipnr = (int)((unsigned long) to / this->chipsize);
@@ -1730,9 +1764,12 @@
 	return ret;
 }
 
-/* 
- * NAND standard block erase command function
- * 
+/**
+ * single_erease_cmd - NAND standard block erase command function
+ * @mtd:	MTD device structure
+ * @page:	the page address of the block which will be erased
+ *
+ * Standard erase command for NAND chips
  */
 static void single_erase_cmd (struct mtd_info *mtd, int page)
 {
@@ -1742,7 +1779,11 @@
 	this->cmdfunc (mtd, NAND_CMD_ERASE2, -1, -1);
 }
 
-/* 
+/**
+ * multi_erease_cmd - AND specific block erase command function
+ * @mtd:	MTD device structure
+ * @page:	the page address of the block which will be erased
+ *
  * AND multi block erase command function
  * Erase 4 consecutive blocks
  */
@@ -1757,11 +1798,12 @@
 	this->cmdfunc (mtd, NAND_CMD_ERASE2, -1, -1);
 }
  
-/*
- * NAND erase a block
- * 
+/**
+ * nand_erase - NAND erase block(s)
  * @mtd:	MTD device structure
  * @instr:	erase instruction
+ *
+ * Erase one ore more blocks
  */
 static int nand_erase (struct mtd_info *mtd, struct erase_info *instr)
 {
@@ -1790,7 +1832,7 @@
 	}
 
 	/* Grab the lock and see if the device is available */
-	nand_get_chip (this, mtd, FL_ERASING, NULL);
+	nand_get_chip (this, mtd, FL_ERASING);
 
 	/* Shift to get first page */
 	page = (int) (instr->addr >> this->page_shift);
@@ -1866,9 +1908,8 @@
 	return ret;
 }
 
-/*
- * NAND sync
- *
+/**
+ * nand_sync - NAND sync
  * @mtd:	MTD device structure
  */
 static void nand_sync (struct mtd_info *mtd)
@@ -1914,9 +1955,8 @@
 }
 
 
-/*
- * Check whether the block at the given offset is bad
- *
+/**
+ * nand_block_isbad - Check whether the block at the given offset is bad
  * @mtd:	MTD device structure
  * @ofs:	offset relative to mtd start
  */
@@ -1929,7 +1969,7 @@
 	return nand_block_checkbad (mtd, ofs, 1);
 }
 
-/*
+/**
  * Mark the block at the given offset as bad
  *
  * @mtd:	MTD device structure
@@ -1946,16 +1986,17 @@
 	return this->block_markbad(mtd, ofs);
 }
 
-/*
- * Scan for the NAND device
+/**
+ * nand_scan - Scan for the NAND device
+ * @mtd:	MTD device structure
+ * @maxchips:	Number of chips to scan for
  *
  * This fills out all the not initialized function pointers
  * with the defaults.
  * The flash ID is read and the mtd/chip structures are
- * filled with the appropriate values.
+ * filled with the appropriate values. Buffers are allocated if
+ * they are not provided by the board driver
  *
- * @mtd:	MTD device structure
- * @maxchips:	Number of chips to scan for
  */
 int nand_scan (struct mtd_info *mtd, int maxchips)
 {
@@ -2286,8 +2327,8 @@
 	return this->scan_bbt (mtd);
 }
 
-/* Free resources held by the NAND device 
- *
+/**
+ * nand_release - Free resources held by the NAND device 
  * @mtd:	MTD device structure
 */
 void nand_release (struct mtd_info *mtd)

Index: nand_bbt.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_bbt.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- nand_bbt.c	27 May 2004 10:37:11 -0000	1.4
+++ nand_bbt.c	27 May 2004 22:01:03 -0000	1.5
@@ -58,15 +58,18 @@
 #include <linux/delay.h>
 
 
-/* 
- * Check for a pattern at the given place. Used to search bad block
- * tables and good / bad block identifiers
- *
+/** 
+ * check_pattern - check if a pattern is in the buffer
  * @buf:	the buffer to search
  * @len:	the length of buffer to search
  * @paglen:	the pagelength
  * @td:		search pattern descriptor
  *
+ * Check for a pattern at the given place. Used to search bad block
+ * tables and good / bad block identifiers.
+ * If the SCAN_EMPTY option is set then check, if all bytes except the
+ * pattern area contain 0xff
+ *
 */
 static int check_pattern (uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td)
 {
@@ -99,15 +102,17 @@
 	return 0;
 }
 
-/* 
- * Read the bad block table starting from page.
- *
+/**
+ * read_bbt - Read the bad block table starting from page
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @page:	the starting page
  * @num:	the number of bbt descriptors to read
  * @bits:	number of bits per block
  * @offs:	offset in the memory table
+ *
+ * Read the bad block table starting from page.
+ *
  */
 static int read_bbt (struct mtd_info *mtd, uint8_t *buf, int page, int num, 
 	int bits, int offs)
@@ -154,13 +159,14 @@
 	return 0;
 }
 
-/* 
- * Read the bad block table for all chips starting at a given page
- * We assume that the bbt bits are in consecutive order.
- *
+/**
+ * read_abs_bbt - Read the bad block table starting at a given page
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @td:		descriptor for the bad block table 
+ *
+ * Read the bad block table for all chips starting at a given page
+ * We assume that the bbt bits are in consecutive order.
 */
 static int read_abs_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td)
 {
@@ -185,14 +191,16 @@
 	return 0;
 }
 
-/* 
- * Read the bad block table(s) for all chips starting at a given page
- * We assume that the bbt bits are in consecutive order.
- *
+/**
+ * read_abs_bbts - Read the bad block table(s) for all chips starting at a given page
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @td:		descriptor for the bad block table 
  * @md:		descriptor for the bad block table mirror
+ *
+ * Read the bad block table(s) for all chips starting at a given page
+ * We assume that the bbt bits are in consecutive order.
+ *
 */
 static int read_abs_bbts (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td,
 	struct nand_bbt_descr *md)
@@ -210,13 +218,14 @@
 	return  read_abs_bbt (mtd, buf, md);
 }
 
-/* 
- * Create a bad block table by scanning the device
- * for the given good/bad block identify pattern
- *
+/**
+ * create_bbt - Create a bad block table by scanning the device
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @bd:		descriptor for the good/bad block search pattern
+ *
+ * Create a bad block table by scanning the device
+ * for the given good/bad block identify pattern
  */
 static void create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd)
 {
@@ -253,7 +262,12 @@
 	}
 }
 
-/*
+/**
+ * search_bbt - scan the device for a specific bad block table
+ * @mtd:	MTD device structure
+ * @buf:	temporary buffer
+ * @td:		descriptor for the bad block table
+ *
  * Read the bad block table by searching for a given ident pattern.
  * Search is preformed either from the beginning up or from the end of 
  * the device downwards. The search starts always at the start of a
@@ -263,11 +277,7 @@
  * This is neccecary to provide support for certain DOC devices.
  *
  * The bbt ident pattern resides in the oob area of the first page 
- * in a block.
- * 
- * @mtd:	MTD device structure
- * @buf:	temporary buffer
- * @td:		descriptor for the bad block table
+ * in a block. 
  */
 static int search_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td)
 {
@@ -327,13 +337,14 @@
 	return 0;
 }
 
-/* 
- * Search and read the bad block table(s)
- *
+/**
+ * search_read_bbts - scan the device for bad block table(s)
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @td:		descriptor for the bad block table 
  * @md:		descriptor for the bad block table mirror
+ *
+ * Search and read the bad block table(s)
 */
 static int search_read_bbts (struct mtd_info *mtd, uint8_t *buf, 
 	struct nand_bbt_descr *td, struct nand_bbt_descr *md)
@@ -385,13 +396,16 @@
 }
 
 
-/* 
- * (Re)write the bad block table
+/** 
+ * write_bbt - (Re)write the bad block table
  *
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @td:		descriptor for the bad block table 
  * @md:		descriptor for the bad block table mirror
+ *
+ * (Re)write the bad block table
+ *
 */
 static int write_bbt (struct mtd_info *mtd, uint8_t *buf, 
 	struct nand_bbt_descr *td, struct nand_bbt_descr *md)
@@ -544,15 +558,16 @@
 	return 0;
 }
 
-/* 
+/**
+ * nand_memory_bbt - create a memory based bad block table
+ * @mtd:	MTD device structure
+ * @bd:		descriptor for the good/bad block search pattern
+ *
  * The function creates a memory based bbt by scanning the device 
  * for manufacturer / software marked good / bad blocks
  *
  * The bad block table memory is allocated here. It must be freed
  * by calling the nand_free_bbt function.
- *
- * @mtd:	MTD device structure
- * @bd:		descriptor for the good/bad block search pattern
 */
 static int nand_memory_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd)
 {
@@ -565,7 +580,11 @@
 }
 
 
-/* 
+/**
+ * nand_scan_bbt - scan, find, read and maybe create bad block table(s)
+ * @mtd:	MTD device structure
+ * @bd:		descriptor for the good/bad block search pattern
+ *
  * The function checks, if a bad block table(s) is/are already 
  * available. If not it scans the device for manufacturer
  * marked good / bad blocks and writes the bad block table(s) to
@@ -574,8 +593,6 @@
  * The bad block table memory is allocated here. It must be freed
  * by calling the nand_free_bbt function.
  *
- * @mtd:	MTD device structure
- * @bd:		descriptor for the good/bad block search pattern
 */
 int nand_scan_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd)
 {
@@ -667,10 +684,11 @@
 }
 
 
-/* 
- * The function updates the bad block table
- *
+/**
+ * nand_update_bbt - update bad block table(s) 
  * @mtd:	MTD device structure
+ *
+ * The function updates the bad block table(s)
 */
 int nand_update_bbt (struct mtd_info *mtd)
 {
@@ -794,12 +812,14 @@
 	.pattern = mirror_pattern
 };
 
-/* 
+/**
+ * nand_default_bbt - Select a default bad block table for the device 
+ * @mtd:	MTD device structure
+ *
  * This function tries to select the default bad block table
  * support for the device. If a default can be found then
  * if calls the scan function above.
  *
- * @mtd:	MTD device structure
 */
 int nand_default_bbt (struct mtd_info *mtd)
 {

Index: nand_ecc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_ecc.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- nand_ecc.c	5 May 2004 14:19:42 -0000	1.11
+++ nand_ecc.c	27 May 2004 22:01:03 -0000	1.12
@@ -63,7 +63,12 @@
 };
 
 
-/*
+/**
+ * nand_trans_result - create non-inverted ECC
+ * @reg2:	line parity reg 2
+ * @reg3:	line parity reg 3
+ * @ecc_code:	ecc 
+ *
  * Creates non-inverted ECC code from line parity
  */
 static void nand_trans_result(u_char reg2, u_char reg3,
@@ -103,8 +108,11 @@
 	ecc_code[1] = tmp2;
 }
 
-/*
- * Calculate 3 byte ECC code for 256 byte block
+/**
+ * nand_calculate_ecc - Calculate 3 byte ECC code for 256 byte block
+ * @mtd:	MTD block structure
+ * @dat:	raw data
+ * @ecc_code:	buffer for ECC
  */
 void nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
 {
@@ -138,7 +146,13 @@
 	ecc_code[2] = ((~reg1) << 2) | 0x03;
 }
 
-/*
+/**
+ * nand_correct_data - Detect and correct bit error(s)
+ * @mtd:	MTD block structure
+ * @dat:	raw data read from the chip
+ * @read_ecc:	ECC from the chip
+ * @calc_ecc:	the ECC calculated from raw data
+ *
  * Detect and correct a 1 bit error for 256 byte block
  */
 int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc)





More information about the linux-mtd-cvs mailing list