Skip to contentSkip to conversation

nand_command

DISCUSSION Artem B. Bityuckiy 2 participants 2 messages Sep 22, 2004 – Sep 23, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

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?

Signature · 3 lines
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
#1 lore raw

Hello Artem,

Quoted 3 lines · Artem B. Bityuckiy

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.

Quoted 3 lines

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