All of lore.kernel.org
 help / color / mirror / Atom feed
* nand_command
@ 2004-09-22 11:13 Artem B. Bityuckiy
  2004-09-23  6:25 ` nand_command Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Artem B. Bityuckiy @ 2004-09-22 11:13 UTC (permalink / raw)
  To: tglx; +Cc: linux-mtd

Hello.

Thomas, as you sad, "only the ones with 512byte pagesize" NAND chips 
support operations like this:

1. NAND_CND_READ0, NAND_CMD_SEQIN, <addr>, <data>, NAND_CMD_PAGEPRG
2. NAND_CND_READ1, NAND_CMD_SEQIN, <addr>, <data>, NAND_CMD_PAGEPRG
3. NAND_CND_READOOB, NAND_CMD_SEQIN, <addr>, <data>, NAND_CMD_PAGEPRG

The first chain - programm page starting from the beginning
The second chain - programm page starting from the second half
The third chain - programm starting from OOB area.

Chips with 256-byte page support only one programm operation like this:
NAND_CMD_SEQIN, <addr>, <data>, NAND_CMD_PAGEPRG

Correct? (I can't find any 256-byte page Flash manual to check)

If I'm correct, I propose to change a little the default command 
function for "small page" devices (nand_base.c, nand_command). The code 
is like this:


static void nand_command (struct mtd_info *mtd, unsigned command, int 
column, int page_addr)
{
         register struct nand_chip *this = mtd->priv;

         /* Begin command latch cycle */
         this->hwcontrol(mtd, NAND_CTL_SETCLE);
         /*
          * Write out the command to the device.
          */
         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 {
                         column -= 256;
                         readcmd = NAND_CMD_READ1;
                 }
                 this->write_byte(mtd, readcmd);
         }
         this->write_byte(mtd, command);

.............


It can be seen that for "small page" devices the NAND_CMD_READ0 command 
is also input before NAND_CMD_SEQIN. This is not big error, but if to be 
pedantic, this isn't needed.

I propose to change this code the following way:

static void nand_command (struct mtd_info *mtd, unsigned command, int 
column, int page_addr)
{
         register struct nand_chip *this = mtd->priv;

         /* Begin command latch cycle */
         this->hwcontrol(mtd, NAND_CTL_SETCLE);
         /*
          * Write out the command to the device.
          */
         if (mtd->oobblock > 256 && command == NAND_CMD_SEQIN) { /* 
<----- here */
                 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 {
                         column -= 256;
                         readcmd = NAND_CMD_READ1;
                 }
                 this->write_byte(mtd, readcmd);
         }
         this->write_byte(mtd, command);

.............


Comments?

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

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

* Re: nand_command
  2004-09-22 11:13 nand_command Artem B. Bityuckiy
@ 2004-09-23  6:25 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2004-09-23  6:25 UTC (permalink / raw)
  To: Artem B. Bityuckiy; +Cc: linux-mtd

Hello Artem,

On Wed, 2004-09-22 at 13:13, Artem B. Bityuckiy wrote:

> Chips with 256-byte page support only one programm operation like this:
> NAND_CMD_SEQIN, <addr>, <data>, NAND_CMD_PAGEPRG
> Correct? (I can't find any 256-byte page Flash manual to check)

Yes, those chips are out of production.

> If I'm correct, I propose to change a little the default command 
> function for "small page" devices (nand_base.c, nand_command). The code 
> is like this:

As this is legacy only and it does not influence the functionality, why
bother to have an additional check for something which isnt available
anyway.

tglx

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

end of thread, other threads:[~2004-09-23  6:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-22 11:13 nand_command Artem B. Bityuckiy
2004-09-23  6:25 ` nand_command Thomas Gleixner

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.