mtd/drivers/mtd/nand nand.c,1.78,1.79

gleixner at infradead.org gleixner at infradead.org
Thu Apr 15 07:53:42 EDT 2004


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

Modified Files:
	nand.c 
Log Message:
add some more function comments

Index: nand.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- nand.c	15 Apr 2004 08:40:47 -0000	1.78
+++ nand.c	15 Apr 2004 11:53:39 -0000	1.79
@@ -587,6 +587,13 @@
  *	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 :)
+ *
+ * @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
  */
 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)
@@ -652,7 +659,7 @@
 		printk (KERN_WARNING "Invalid NAND_ECC_MODE %d\n", this->eccmode);
 		BUG();	
 	}
-	
+										
 	/* Write out OOB data */
 	this->write_buf(mtd, oob_buf, mtd->oobsize);
 
@@ -771,7 +778,13 @@
 #endif
 
 /*
-*	Use NAND read ECC
+ * This function simply calls nand_read_ecc with oob buffer and oobsel = NULL
+ *
+ * @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
 */
 static int nand_read (struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf)
 {
@@ -781,6 +794,14 @@
 
 /*
  * NAND read with 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
+ * @oob_buf:	filesystem supplied oob data buffer
+ * @oobsel:	oob selection structure
  */
 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)
@@ -837,7 +858,7 @@
 	/* Send the read command 
 	 * If we read not page aligned we can start at ecc
 	 * boundary.
-	 * FIXME: Implement this !
+	 * FIXME: Implement it
 	*/
 	this->cmdfunc (mtd, NAND_CMD_READ0, 0x00, page);
 	
@@ -847,7 +868,7 @@
 		 * If the read is not page aligned, we have to read into data buffer
 		 * due to ecc, else we read into return buffer direct
 		 */
-		if (!col && (len - read) >= end)  
+		if (!col && (len - read) >= end)
 			data_poi = &buf[read];
 		else 
 			data_poi = this->data_buf;
@@ -855,7 +876,7 @@
 		/* get oob area, if we have no oob buffer from fs-driver */
 		if (!oob_buf || oobsel->useecc == MTD_NANDECC_AUTOPLACE)
 			oob_data = &this->data_buf[end];
-		
+
 		eccsteps = this->eccsteps;
 		
 		switch (eccmode) {
@@ -997,6 +1018,12 @@
 
 /*
  * 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
  */
 static int nand_read_oob (struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf)
 {
@@ -1304,6 +1331,12 @@
 
 /*
  * 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
  */
 static int nand_write_oob (struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char * buf)
 {
@@ -1394,7 +1427,13 @@
 
 
 /*
- * NAND write with iovec
+ * NAND write with iovec. This just calls the ecc function
+ *
+ * @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
  */
 static int nand_writev (struct mtd_info *mtd, const struct iovec *vecs, unsigned long count, 
 		loff_t to, size_t * retlen)
@@ -1402,6 +1441,17 @@
 	return (nand_writev_ecc (mtd, vecs, count, to, retlen, NULL, 0));	
 }
 
+/*
+ * NAND write with iovec with 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
+ * @eccbuf:	filesystem supplied oob data buffer
+ * @oobsel:	oob selection structure
+ */
 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)
 {
@@ -1553,6 +1603,9 @@
 
 /*
  * NAND erase a block
+ * 
+ * @mtd:	MTD device structure
+ * @instr:	erase instruction
  */
 static int nand_erase (struct mtd_info *mtd, struct erase_info *instr)
 {
@@ -1656,6 +1709,8 @@
 
 /*
  * NAND sync
+ *
+ * @mtd:	MTD device structure
  */
 static void nand_sync (struct mtd_info *mtd)
 {
@@ -1701,6 +1756,9 @@
 
 /*
  * Check whether the block at the given offset is bad
+ *
+ * @mtd:	MTD device structure
+ * @ofs:	offset relative to mtd start
  */
 static int nand_block_isbad (struct mtd_info *mtd, loff_t ofs)
 {
@@ -1715,6 +1773,9 @@
 
 /*
  * Mark the block at the given offset as bad
+ *
+ * @mtd:	MTD device structure
+ * @ofs:	offset relative to mtd start
  */
 static int nand_block_markbad (struct mtd_info *mtd, loff_t ofs)
 {
@@ -1729,6 +1790,14 @@
 
 /*
  * Scan for the NAND device
+ *
+ * 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.
+ *
+ * @mtd:	MTD device structure
+ * @maxchips:	Number of chips to scan for
  */
 int nand_scan (struct mtd_info *mtd, int maxchips)
 {




More information about the linux-mtd-cvs mailing list