mtd/drivers/mtd/nand nand.c,1.53,1.54

David Woodhouse dwmw2 at infradead.org
Fri Jul 11 11:11:27 EDT 2003


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

Modified Files:
	nand.c 
Log Message:
Slight cleanup of read command selection in nand_command(). Untested.


Index: nand.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- nand.c	11 Jul 2003 15:09:50 -0000	1.53
+++ nand.c	11 Jul 2003 15:11:25 -0000	1.54
@@ -249,28 +249,23 @@
 	/*
 	 * Write out the command to the device.
 	 */
-	if (command != NAND_CMD_SEQIN)
-		this->write_byte(mtd, command);
-	else {
-		if (mtd->oobblock == 256 && column >= 256) {
-			column -= 256;
-			this->write_byte(mtd, NAND_CMD_READOOB);
-			this->write_byte(mtd, NAND_CMD_SEQIN);
-		} else if (mtd->oobblock == 512 && column >= 256) {
-			if (column < 512) {
-				column -= 256;
-				this->write_byte(mtd, NAND_CMD_READ1);
-				this->write_byte(mtd, NAND_CMD_SEQIN);
-			} else {
-				column -= 512;
-				this->write_byte(mtd, NAND_CMD_READOOB);
-				this->write_byte(mtd, NAND_CMD_SEQIN);
-			}
+	if (command == NAND_CMD_SEQIN) {
+		int readcmd;
+
+		if (column >= mtd->oobblock) {
+			/* OOB area */
+			column -= mtd->oobblock;
+			readcmd = NAND_CMD_READOOB;
+		} else if (column < 256) {
+			/* First 256 bytes --> READ0 */
+			readcmd = NAND_CMD_READ0;
 		} else {
-			this->write_byte(mtd, NAND_CMD_READ0);
-			this->write_byte(mtd, NAND_CMD_SEQIN);
+			column -= 256;
+			readcmd = NAND_CMD_READ1;
 		}
+		this->write_byte(mtd, readcmd);
 	}
+	this->write_byte(mtd, command);
 
 	/* Set ALE and clear CLE to start address cycle */
 	this->hwcontrol(mtd, NAND_CTL_CLRCLE);




More information about the linux-mtd-cvs mailing list