NAND programming bug in Linux 2.6.8?

Mikael Starvik mikael.starvik at axis.com
Fri Oct 15 06:53:06 EDT 2004


In nand_base.c:nand_command() the following happens (stripped pseudo-code):

if (NAND_CMD_SEQIN) {
  if (column > OOB) {
    column -= OOB;
    use READ_OOB;
  }
  else if (column < 256)
    use READ0;
  else {
    column -= 256;
    use READ1;
  }
  send_command();
}
if (16bit)
  column >>= 1;
write_column();

The problem is that for a 16-bit device the READ1 command will be issued
even though the column address fits in 8 bits. Suggested patch below.

Comments?

/Mikael (not a member of this list)

Index: nand_base.c
===================================================================
RCS file: /usr/local/cvs/linux/os/lx25/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 nand_base.c
--- nand_base.c	16 Aug 2004 08:14:36 -0000	1.1.1.1
+++ nand_base.c	15 Oct 2004 10:46:16 -0000
@@ -506,8 +506,8 @@
 			/* OOB area */
 			column -= mtd->oobblock;
 			readcmd = NAND_CMD_READOOB;
-		} else if (column < 256) {
-			/* First 256 bytes --> READ0 */
+		} else if ((column < 256) || (this->options &
NAND_BUSWIDTH_16)) {
+			/* First 256 bytes/words --> READ0 */
 			readcmd = NAND_CMD_READ0;
 		} else {
 			column -= 256;






More information about the linux-mtd mailing list