mtd/drivers/mtd/nand nand_base.c, 1.89, 1.90 nand_bbt.c, 1.7, 1.8 nand_ecc.c, 1.12, 1.13

gleixner at infradead.org gleixner at infradead.org
Fri May 28 06:58:22 EDT 2004


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

Modified Files:
	nand_base.c nand_bbt.c nand_ecc.c 
Log Message:
More documentation changes. 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.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- nand_base.c	27 May 2004 22:01:02 -0000	1.89
+++ nand_base.c	28 May 2004 10:58:18 -0000	1.90
@@ -133,7 +133,12 @@
 		
 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 */
+/**
+ * nand_release_chip - [GENERIC] release chip
+ * @mtd:	MTD device structure
+ * 
+ * Deselect, release chip lock and wake up anyone waiting on the device 
+ */
 static void nand_release_chip (struct mtd_info *mtd)
 {
 	struct nand_chip *this = mtd->priv;
@@ -147,42 +152,92 @@
 	spin_unlock_bh (&this->chip_lock);
 }
 
+/**
+ * nand_read_byte - [DEFAULT] read one byte from the chip
+ * @mtd:	MTD device structure
+ *
+ * Default read function for 8bit buswith
+ */
 static u_char nand_read_byte(struct mtd_info *mtd)
 {
 	struct nand_chip *this = mtd->priv;
 	return readb(this->IO_ADDR_R);
 }
 
+/**
+ * nand_write_byte - [DEFAULT] write one byte to the chip
+ * @mtd:	MTD device structure
+ * @byte:	pointer to data byte to write
+ *
+ * Default write function for 8it buswith
+ */
 static void nand_write_byte(struct mtd_info *mtd, u_char byte)
 {
 	struct nand_chip *this = mtd->priv;
 	writeb(byte, this->IO_ADDR_W);
 }
 
+/**
+ * nand_read_byte16 - [DEFAULT] read one byte endianess aware from the chip
+ * @mtd:	MTD device structure
+ *
+ * Default read function for 16bit buswith with 
+ * endianess conversion
+ */
 static u_char nand_read_byte16(struct mtd_info *mtd)
 {
 	struct nand_chip *this = mtd->priv;
 	return (u_char) cpu_to_le16(readw(this->IO_ADDR_R));
 }
 
+/**
+ * nand_write_byte16 - [DEFAULT] write one byte endianess aware to the chip
+ * @mtd:	MTD device structure
+ * @byte:	pointer to data byte to write
+ *
+ * Default write function for 16bit buswith with
+ * endianess conversion
+ */
 static void nand_write_byte16(struct mtd_info *mtd, u_char byte)
 {
 	struct nand_chip *this = mtd->priv;
 	writew(le16_to_cpu((u16) byte), this->IO_ADDR_W);
 }
 
+/**
+ * nand_read_word - [DEFAULT] read one word from the chip
+ * @mtd:	MTD device structure
+ *
+ * Default read function for 16bit buswith without 
+ * endianess conversion
+ */
 static u16 nand_read_word(struct mtd_info *mtd)
 {
 	struct nand_chip *this = mtd->priv;
 	return readw(this->IO_ADDR_R);
 }
 
+/**
+ * nand_write_word - [DEFAULT] write one word to the chip
+ * @mtd:	MTD device structure
+ * @word:	data word to write
+ *
+ * Default write function for 16bit buswith without 
+ * endianess conversion
+ */
 static void nand_write_word(struct mtd_info *mtd, u16 word)
 {
 	struct nand_chip *this = mtd->priv;
 	writew(word, this->IO_ADDR_W);
 }
 
+/**
+ * nand_select_chip - [DEFAULT] control CE line
+ * @mtd:	MTD device structure
+ * @chip:	chipnumber to select, -1 for deselect
+ *
+ * Default select function for 1 chip devices.
+ */
 static void nand_select_chip(struct mtd_info *mtd, int chip)
 {
 	struct nand_chip *this = mtd->priv;
@@ -199,6 +254,14 @@
 	}
 }
 
+/**
+ * nand_write_buf - [DEFAULT] write buffer to chip
+ * @mtd:	MTD device structure
+ * @buf:	data buffer
+ * @len:	number of bytes to write
+ *
+ * Default write function for 8bit buswith
+ */
 static void nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	int i;
@@ -208,6 +271,14 @@
 		writeb(buf[i], this->IO_ADDR_W);
 }
 
+/**
+ * nand_read_buf - [DEFAULT] read chip data into buffer 
+ * @mtd:	MTD device structure
+ * @buf:	buffer to store date
+ * @len:	number of bytes to read
+ *
+ * Default read function for 8bit buswith
+ */
 static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 {
 	int i;
@@ -217,6 +288,14 @@
 		buf[i] = readb(this->IO_ADDR_R);
 }
 
+/**
+ * nand_verify_buf - [DEFAULT] Verify chip data against buffer 
+ * @mtd:	MTD device structure
+ * @buf:	buffer containing the data to compare
+ * @len:	number of bytes to compare
+ *
+ * Default verify function for 8bit buswith
+ */
 static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	int i;
@@ -229,6 +308,14 @@
 	return 0;
 }
 
+/**
+ * nand_write_buf16 - [DEFAULT] write buffer to chip
+ * @mtd:	MTD device structure
+ * @buf:	data buffer
+ * @len:	number of bytes to write
+ *
+ * Default write function for 16bit buswith
+ */
 static void nand_write_buf16(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	int i;
@@ -241,6 +328,14 @@
 		
 }
 
+/**
+ * nand_read_buf16 - [DEFAULT] read chip data into buffer 
+ * @mtd:	MTD device structure
+ * @buf:	buffer to store date
+ * @len:	number of bytes to read
+ *
+ * Default read function for 16bit buswith
+ */
 static void nand_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
 {
 	int i;
@@ -252,6 +347,14 @@
 		p[i] = readw(this->IO_ADDR_R);
 }
 
+/**
+ * nand_verify_buf16 - [DEFAULT] Verify chip data against buffer 
+ * @mtd:	MTD device structure
+ * @buf:	buffer containing the data to compare
+ * @len:	number of bytes to compare
+ *
+ * Default verify function for 16bit buswith
+ */
 static int nand_verify_buf16(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	int i;
@@ -266,6 +369,14 @@
 	return 0;
 }
 
+/**
+ * nand_block_bad - [DEFAULT] Read bad block marker from the chip
+ * @mtd:	MTD device structure
+ * @ofs:	offset from device start
+ * @getchip:	0, if the chip is already selected
+ *
+ * Check, if the block is bad. 
+ */
 static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
 {
 	int page, chipnr, res = 0;
@@ -305,7 +416,12 @@
 	return res;
 }
 
-/* This is the default implementation, which can be overridden by
+/**
+ * nand_default_block_markbad - [DEFAULT] mark a block bad
+ * @mtd:	MTD device structure
+ * @ofs:	offset from device start
+ *
+ * This is the default implementation, which can be overridden by
  * a hardware specific driver.
 */
 static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
@@ -328,7 +444,11 @@
 	return nand_write_oob (mtd, ofs , 2, &retlen, buf);
 }
 
-/* Check, if the device is write protected 
+/** 
+ * nand_check_wp - [GENERIC] check if the chip is write protected
+ * @mtd:	MTD device structure
+ * Check, if the device is write protected 
+ *
  * The function expects, that the device is already selected 
  */
 static int nand_check_wp (struct mtd_info *mtd)
@@ -340,14 +460,13 @@
 }
 
 /**
- * nand_block_checkbad - Check if a block is marked bad
+ * nand_block_checkbad - [GENERIC] 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.
+ * Check, if the block is bad. Either by reading the bad block table or
+ * calling of the scan function.
  */
 static int nand_block_checkbad (struct mtd_info *mtd, loff_t ofs, int getchip)
 {
@@ -364,7 +483,7 @@
 }
 
 /**
- * nand_command - Send command to NAND device
+ * nand_command - [DEFAULT] 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
@@ -464,7 +583,7 @@
 }
 
 /**
- * nand_command_lp - Send command to NAND large page device
+ * nand_command_lp - [DEFAULT] 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
@@ -566,7 +685,7 @@
 }
 
 /**
- * nand_get_chip - Get chip for selected access
+ * nand_get_chip - [GENERIC] Get chip for selected access
  * @this:	the nand chip descriptor
  * @mtd:	MTD device structure
  * @new_state:	the state which is requested 
@@ -599,7 +718,7 @@
 }
 
 /**
- * nand_wait - wait until the command is done
+ * nand_wait - [DEFAULT]  wait until the command is done
  * @mtd:	MTD device structure
  * @this:	NAND chip structure
  * @state:	state to select the max. timeout value
@@ -647,7 +766,7 @@
 }
 
 /**
- * nand_write_page - write one page
+ * nand_write_page - [GENERIC] write one page
  * @mtd:	MTD device structure
  * @this:	NAND chip structure
  * @page: 	startpage inside the chip, must be called with (page & this->pagemask)
@@ -750,7 +869,7 @@
 
 #ifdef CONFIG_MTD_NAND_VERIFY_WRITE
 /**
- * nand_verify_pages - verify the chip contents after a write
+ * nand_verify_pages - [GENERIC] 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)
@@ -845,7 +964,7 @@
 #endif
 
 /**
- * nand_read - MTD compability function for nand_read_ecc
+ * nand_read - [MTD Interface] MTD compability function for nand_read_ecc
  * @mtd:	MTD device structure
  * @from:	offset to read from
  * @len:	number of bytes to read
@@ -861,7 +980,7 @@
 
 
 /**
- * nand_read_ecc - Read data with ECC
+ * nand_read_ecc - [MTD Interface] Read data with ECC
  * @mtd:	MTD device structure
  * @from:	offset to read from
  * @len:	number of bytes to read
@@ -1101,7 +1220,7 @@
 }
 
 /**
- * nand_read_oob - NAND read out-of-band
+ * nand_read_oob - [MTD Interface] NAND read out-of-band
  * @mtd:	MTD device structure
  * @from:	offset to read from
  * @len:	number of bytes to read
@@ -1193,11 +1312,12 @@
 }
 
 /**
- * nand_read_raw - Read raw data including oob into buffer
+ * nand_read_raw - [GENERIC] 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
+ * @ooblen:	number of oob data bytes to read
  *
  * Read raw data including oob into buffer
  */
@@ -1254,7 +1374,7 @@
 
 
 /** 
- * nand_prepare_oobbuf - Prepare the out of band buffer 
+ * nand_prepare_oobbuf - [GENERIC] Prepare the out of band buffer 
  * @mtd:	MTD device structure
  * @fsbuf:	buffer given by fs driver
  * @oobsel:	out of band selection structre
@@ -1316,7 +1436,7 @@
 #define NOTALIGNED(x) (x & (mtd->oobblock-1)) != 0
 
 /**
- * nand_write - MTD compability function for nand_write_ecc
+ * nand_write - [MTD Interface] compability function for nand_write_ecc
  * @mtd:	MTD device structure
  * @to:		offset to write to
  * @len:	number of bytes to write
@@ -1332,7 +1452,7 @@
 }
 			   
 /**
- * nand_write_ecc - NAND write with ECC
+ * nand_write_ecc - [MTD Interface] NAND write with ECC
  * @mtd:	MTD device structure
  * @to:		offset to write to
  * @len:	number of bytes to write
@@ -1482,7 +1602,7 @@
 
 
 /**
- * nand_write_oob - NAND write out-of-band
+ * nand_write_oob - [MTD Interface] NAND write out-of-band
  * @mtd:	MTD device structure
  * @to:		offset to write to
  * @len:	number of bytes to write
@@ -1584,7 +1704,7 @@
 
 
 /**
- * nand_writev - MTD compabilty function for nand_writev_ecc
+ * nand_writev - [MTD Interface] compabilty function for nand_writev_ecc
  * @mtd:	MTD device structure
  * @vecs:	the iovectors to write
  * @count:	number of vectors
@@ -1600,7 +1720,7 @@
 }
 
 /**
- * nand_writev_ecc - NAND write with iovec with ecc
+ * nand_writev_ecc - [MTD Interface] write with iovec with ecc
  * @mtd:	MTD device structure
  * @vecs:	the iovectors to write
  * @count:	number of vectors
@@ -1765,7 +1885,7 @@
 }
 
 /**
- * single_erease_cmd - NAND standard block erase command function
+ * single_erease_cmd - [GENERIC] NAND standard block erase command function
  * @mtd:	MTD device structure
  * @page:	the page address of the block which will be erased
  *
@@ -1780,7 +1900,7 @@
 }
 
 /**
- * multi_erease_cmd - AND specific block erase command function
+ * multi_erease_cmd - [GENERIC] AND specific block erase command function
  * @mtd:	MTD device structure
  * @page:	the page address of the block which will be erased
  *
@@ -1799,7 +1919,7 @@
 }
  
 /**
- * nand_erase - NAND erase block(s)
+ * nand_erase - [MTD Interface] erase block(s)
  * @mtd:	MTD device structure
  * @instr:	erase instruction
  *
@@ -1909,8 +2029,10 @@
 }
 
 /**
- * nand_sync - NAND sync
+ * nand_sync - [MTD Interface] sync
  * @mtd:	MTD device structure
+ *
+ * Sync is actually a wait for chip ready function
  */
 static void nand_sync (struct mtd_info *mtd)
 {
@@ -1956,7 +2078,7 @@
 
 
 /**
- * nand_block_isbad - Check whether the block at the given offset is bad
+ * nand_block_isbad - [MTD Interface] Check whether the block at the given offset is bad
  * @mtd:	MTD device structure
  * @ofs:	offset relative to mtd start
  */
@@ -1970,8 +2092,7 @@
 }
 
 /**
- * Mark the block at the given offset as bad
- *
+ * nand_block_markbad - [MTD Interface] Mark the block at the given offset as bad
  * @mtd:	MTD device structure
  * @ofs:	offset relative to mtd start
  */
@@ -1987,7 +2108,7 @@
 }
 
 /**
- * nand_scan - Scan for the NAND device
+ * nand_scan - [NAND Interface] Scan for the NAND device
  * @mtd:	MTD device structure
  * @maxchips:	Number of chips to scan for
  *
@@ -2328,7 +2449,7 @@
 }
 
 /**
- * nand_release - Free resources held by the NAND device 
+ * nand_release - [NAND Interface] 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- nand_bbt.c	27 May 2004 22:27:33 -0000	1.7
+++ nand_bbt.c	28 May 2004 10:58:19 -0000	1.8
@@ -59,7 +59,7 @@
 
 
 /** 
- * check_pattern - check if a pattern is in the buffer
+ * check_pattern - [GENERIC] check if a pattern is in the buffer
  * @buf:	the buffer to search
  * @len:	the length of buffer to search
  * @paglen:	the pagelength
@@ -103,7 +103,7 @@
 }
 
 /**
- * read_bbt - Read the bad block table starting from page
+ * read_bbt - [GENERIC] Read the bad block table starting from page
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @page:	the starting page
@@ -160,7 +160,7 @@
 }
 
 /**
- * read_abs_bbt - Read the bad block table starting at a given page
+ * read_abs_bbt - [GENERIC] Read the bad block table starting at a given page
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @td:		descriptor for the bad block table 
@@ -192,7 +192,7 @@
 }
 
 /**
- * read_abs_bbts - Read the bad block table(s) for all chips starting at a given page
+ * read_abs_bbts - [GENERIC] 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 
@@ -219,7 +219,7 @@
 }
 
 /**
- * create_bbt - Create a bad block table by scanning the device
+ * create_bbt - [GENERIC] 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
@@ -263,7 +263,7 @@
 }
 
 /**
- * search_bbt - scan the device for a specific bad block table
+ * search_bbt - [GENERIC] scan the device for a specific bad block table
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @td:		descriptor for the bad block table
@@ -341,7 +341,7 @@
 }
 
 /**
- * search_read_bbts - scan the device for bad block table(s)
+ * search_read_bbts - [GENERIC] scan the device for bad block table(s)
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
  * @td:		descriptor for the bad block table 
@@ -400,7 +400,7 @@
 
 
 /** 
- * write_bbt - (Re)write the bad block table
+ * write_bbt - [GENERIC] (Re)write the bad block table
  *
  * @mtd:	MTD device structure
  * @buf:	temporary buffer
@@ -562,7 +562,7 @@
 }
 
 /**
- * nand_memory_bbt - create a memory based bad block table
+ * nand_memory_bbt - [GENERIC] create a memory based bad block table
  * @mtd:	MTD device structure
  * @bd:		descriptor for the good/bad block search pattern
  *
@@ -584,7 +584,7 @@
 
 
 /**
- * nand_scan_bbt - scan, find, read and maybe create bad block table(s)
+ * nand_scan_bbt - [NAND Interface] scan, find, read and maybe create bad block table(s)
  * @mtd:	MTD device structure
  * @bd:		descriptor for the good/bad block search pattern
  *
@@ -688,7 +688,7 @@
 
 
 /**
- * nand_update_bbt - update bad block table(s) 
+ * nand_update_bbt - [NAND Interface] update bad block table(s) 
  * @mtd:	MTD device structure
  *
  * The function updates the bad block table(s)
@@ -816,12 +816,11 @@
 };
 
 /**
- * nand_default_bbt - Select a default bad block table for the device 
+ * nand_default_bbt - [NAND Interface] 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.
+ * This function tries selects the default bad block table
+ * support for the device and calls the nand_scan_bbt function
  *
 */
 int nand_default_bbt (struct mtd_info *mtd)
@@ -836,7 +835,7 @@
 	 * startup
 	*/
 	if (this->options & NAND_IS_AND) {
-		/* Use the default pattern descriptors */	
+		/* Use the default pattern descriptors */
 		this->bbt_td = &bbt_main_descr;
 		this->bbt_md = &bbt_mirror_descr;
 		this->options |= NAND_USE_FLASH_BBT;

Index: nand_ecc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_ecc.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- nand_ecc.c	27 May 2004 22:01:03 -0000	1.12
+++ nand_ecc.c	28 May 2004 10:58:19 -0000	1.13
@@ -64,7 +64,7 @@
 
 
 /**
- * nand_trans_result - create non-inverted ECC
+ * nand_trans_result - [GENERIC] create non-inverted ECC
  * @reg2:	line parity reg 2
  * @reg3:	line parity reg 3
  * @ecc_code:	ecc 
@@ -109,7 +109,7 @@
 }
 
 /**
- * nand_calculate_ecc - Calculate 3 byte ECC code for 256 byte block
+ * nand_calculate_ecc - [NAND Interface] Calculate 3 byte ECC code for 256 byte block
  * @mtd:	MTD block structure
  * @dat:	raw data
  * @ecc_code:	buffer for ECC
@@ -147,7 +147,7 @@
 }
 
 /**
- * nand_correct_data - Detect and correct bit error(s)
+ * nand_correct_data - [NAND Interface] Detect and correct bit error(s)
  * @mtd:	MTD block structure
  * @dat:	raw data read from the chip
  * @read_ecc:	ECC from the chip





More information about the linux-mtd-cvs mailing list