mtd/drivers/mtd/nand nand_base.c,1.112,1.113
gleixner at infradead.org
gleixner at infradead.org
Wed Jul 14 12:31:34 EDT 2004
Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv1425
Modified Files:
nand_base.c
Log Message:
fix autoincrement delay problems
Index: nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- nand_base.c 13 Jul 2004 08:28:21 -0000 1.112
+++ nand_base.c 14 Jul 2004 16:31:31 -0000 1.113
@@ -964,34 +964,34 @@
oobofs += mtd->oobsize - hweccbytes * eccsteps;
page++;
numpages--;
- if (!numpages)
- break;
-
+
/* 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.
+ * Do this also before returning, so the chip is
+ * ready for the next command.
*/
if (!this->dev_ready)
udelay (this->chip_delay);
else
while (!this->dev_ready(mtd));
+
+ /* All done, return happy */
+ if (!numpages)
+ return 0;
+
/* Check, if the chip supports auto page increment */
if (!NAND_CANAUTOINCR(this))
this->cmdfunc (mtd, NAND_CMD_READ0, 0x00, page);
}
- res = 0;
/*
- * Terminate the read command. This is faster than sending a reset command or
- * applying a 20us delay before issuing the next programm sequence.
- * This is not a problem for all chips, but I have found a bunch of them.
- * FIXME, CHECKME: Does this work on systems, where CE is not driven
- * by an GPIO pin ?
+ * Terminate the read command. We come here in case of an error
+ * So we must issue a reset command.
*/
out:
- this->select_chip(mtd, -1);
- this->select_chip(mtd, chipnr);
+ this->cmdfunc (mtd, NAND_CMD_RESET, -1, -1);
return res;
}
#endif
@@ -1248,14 +1248,6 @@
} else
read += mtd->oobblock;
- if (read == len)
- break;
-
- /* For subsequent reads align to page boundary. */
- col = 0;
- /* Increment page address */
- realpage++;
-
/* 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
@@ -1266,6 +1258,14 @@
else
while (!this->dev_ready(mtd));
+ if (read == len)
+ break;
+
+ /* For subsequent reads align to page boundary. */
+ col = 0;
+ /* Increment page address */
+ realpage++;
+
page = realpage & this->pagemask;
/* Check, if we cross a chip boundary */
if (!page) {
@@ -1345,19 +1345,21 @@
thislen = min_t(int, thislen, len);
this->read_buf(mtd, &buf[i], thislen);
i += thislen;
+
+ /* 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));
+
/* Read more ? */
if (i < len) {
page++;
col = 0;
- /* 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 we cross a chip boundary */
if (!(page & this->pagemask)) {
More information about the linux-mtd-cvs
mailing list