A question about how to send a page program command to NAND flash

Kevin Liao kevinliao at iei.com.tw
Mon Jun 9 07:07:04 EDT 2003


In nand.c, I found that there was a piece of code in nand_command(...) as below:

...
if (command != NAND_CMD_SEQIN)
  writeb (command, NAND_IO_ADDR);
 else {
  if (mtd->oobblock == 256 && column >= 256) {
   column -= 256;
   writeb (NAND_CMD_READOOB, NAND_IO_ADDR);
   writeb (NAND_CMD_SEQIN, NAND_IO_ADDR);
  } else if (mtd->oobblock == 512 && column >= 256) {
   if (column < 512) {
    column -= 256;
    writeb (NAND_CMD_READ1, NAND_IO_ADDR);
    writeb (NAND_CMD_SEQIN, NAND_IO_ADDR);
   } else {
    column -= 512;
    writeb (NAND_CMD_READOOB, NAND_IO_ADDR);
    writeb (NAND_CMD_SEQIN, NAND_IO_ADDR);
   }
  } else {
   writeb (NAND_CMD_READ0, NAND_IO_ADDR);
   writeb (NAND_CMD_SEQIN, NAND_IO_ADDR);
  }
 }
...

My question is why we need to send some kind of read command first before issuing the real page program command? Thanks a lot.

Regards,
Kevin





More information about the linux-mtd mailing list