All of lore.kernel.org
 help / color / mirror / Atom feed
* A question about how to send a page program command to NAND flash
@ 2003-06-09 11:07 Kevin Liao
  2003-06-09 20:55 ` Charles Manning
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Liao @ 2003-06-09 11:07 UTC (permalink / raw)
  To: linux-mtd

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: A question about how to send a page program command to NAND flash
  2003-06-09 11:07 A question about how to send a page program command to NAND flash Kevin Liao
@ 2003-06-09 20:55 ` Charles Manning
  0 siblings, 0 replies; 2+ messages in thread
From: Charles Manning @ 2003-06-09 20:55 UTC (permalink / raw)
  To: Kevin Liao, linux-mtd

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-09 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-09 11:07 A question about how to send a page program command to NAND flash Kevin Liao
2003-06-09 20:55 ` Charles Manning

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.