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

Charles Manning manningc2 at actrix.gen.nz
Mon Jun 9 16:55:33 EDT 2003


On Monday 09 June 2003 23:07, Kevin Liao wrote:
> 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.

This is required to adjust the "pointer" to the correct part of a page.
This is explained in the NAND datasheets (available from the vendors' 
websites).

-- CHarles



More information about the linux-mtd mailing list