mtd/drivers/mtd/nand nand.c,1.61,1.62

gleixner at infradead.org gleixner at infradead.org
Wed Mar 17 11:53:14 EST 2004


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

Modified Files:
	nand.c 
Log Message:
Check ready before read command for auto increment capable chips marked as NOAUTOINCR. Make read over block boundaries work

Index: nand.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- nand.c	8 Feb 2004 23:06:11 -0000	1.61
+++ nand.c	17 Mar 2004 16:53:10 -0000	1.62
@@ -605,6 +605,7 @@
 	u_char ecc_code[6];
 	int 	eccmode;
 	int	*oob_config;
+	int	blockcheck = (this->erasesize >> this->page_shift) - 1;
 
 	// use chip default if zero
 	if (oobsel == NULL)
@@ -748,16 +749,20 @@
 		page++;
 		/* Read another page ? */
 		if (read < len ) {
-			/* Check, if the chip supports auto page increment */
-			if (!NAND_CANAUTOINCR(this)) {
+			/* Apply delay or wait for ready/busy pin 
+			 * Do this before the AUTOINCR check, so no problems
+			 * arise if a chip which does auto increment
+			 * is marked as NOAUTOINCR by the board driver.
+			*/
+			if (!this->dev_ready) 
+				udelay (this->chip_delay);
+			else
+				while (!this->dev_ready(mtd));	
+			/* Check, if the chip supports auto page increment 
+			 * or if we have hit a block boundary. 
+			*/ 
+			if (unlikely (!NAND_CANAUTOINCR(this) || !(page & blockcheck)))
 				this->cmdfunc (mtd, NAND_CMD_READ0, 0x00, page);
-			} else {
-				/* Apply delay or wait for ready/busy pin */
-				if (!this->dev_ready) 
-					udelay (this->chip_delay);
-				else
-					while (!this->dev_ready(mtd));	
-			}
 		}
 	}
 




More information about the linux-mtd-cvs mailing list