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

gleixner at infradead.org gleixner at infradead.org
Sun Feb 8 18:06:14 EST 2004


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

Modified Files:
	nand.c 
Log Message:
support for chips which doe not support page autoincrement

Index: nand.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- nand.c	23 Oct 2003 08:28:43 -0000	1.60
+++ nand.c	8 Feb 2004 23:06:11 -0000	1.61
@@ -131,6 +131,9 @@
  *		and the next write command or have the CE removed. The
  *		CE disable/enable is much faster than a 20us delay and
  *		it should work on all available chips.
+ *
+ *  02-08-2004  tglx: support for strange chips, which cannot auto increment 
+ *		pages on read / read_oob
  *	
  * $Id$
  *
@@ -639,15 +642,6 @@
 	
 	/* Loop until all data read */
 	while (read < len) {
-		
-		/* If we have consequent page reads, apply delay or wait for ready/busy pin */
-		if (read) {
-			if (!this->dev_ready) 
-				udelay (this->chip_delay);
-			else
-				while (!this->dev_ready(mtd));	
-		}
-
 		/* 
 		 * If the read is not page aligned, we have to read into data buffer
 		 * due to ecc, else we read into return buffer direct
@@ -752,6 +746,19 @@
 		col = 0;
 		/* Increment page address */
 		page++;
+		/* Read another page ? */
+		if (read < len ) {
+			/* Check, if the chip supports auto page increment */
+			if (!NAND_CANAUTOINCR(this)) {
+				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));	
+			}
+		}
 	}
 
 	/* De-select the NAND device */
@@ -820,8 +827,20 @@
 		this->read_buf(mtd, &buf[i], thislen);
 		i += thislen;
 		col += thislen;
-		/* Delay between pages */
-		udelay (this->chip_delay);
+		/* Read more ? */
+		if (i < len) {
+			/* Check, if the chip supports autoincrement */
+			if (!NAND_CANAUTOINCR(this)) {
+				/* For subsequent page reads set offset to 0 */
+			        this->cmdfunc (mtd, NAND_CMD_READOOB, 0x0, ++page);
+			} else {
+				/* Delay between pages */
+				if (!this->dev_ready) 
+					udelay (this->chip_delay);
+				else
+					while (!this->dev_ready(mtd));
+			}		
+		}
 	}
 	/* De-select the NAND device */
 	this->select_chip(mtd, -1);




More information about the linux-mtd-cvs mailing list