mtd/drivers/mtd/nand nand_base.c,1.164,1.165
Vitaly Wool
vwool at ru.mvista.com
Fri Dec 16 10:41:35 EST 2005
Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv5884/drivers/mtd/nand
Modified Files:
nand_base.c
Log Message:
[MTD] NAND: do not write the whole page in nand_write_oob by default
Added NAND_COMPLEX_OOB_WRITE option that specifies if a whole NAND page is
to be written in nand_write_oob routine. This may be necessary for some HW
ECC generators that need a whole page to be written to generate ECC properly.
This option is to be set by NAND chip driver. it's not set by default.
Accordingly, nand_write_oob was modified to not write the whole page is
NAND_COMPLEX_OOB_WRITE option is not set.
Index: nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -r1.164 -r1.165
--- nand_base.c 15 Dec 2005 02:16:17 -0000 1.164
+++ nand_base.c 16 Dec 2005 15:41:31 -0000 1.165
@@ -1948,7 +1948,7 @@
}
} else {
int i = 0, j = 0;
- int fflen = 0, ooblen = 0;
+ int fflen = 0, old_fflen = 0, ooblen = 0;
/* Write out desired data */
this->cmdfunc (mtd, NAND_CMD_SEQIN, 0, page & this->pagemask);
@@ -1957,9 +1957,27 @@
for (j = 0; this->layout[j].length; j++) {
switch (this->layout[j].type) {
case ITEM_TYPE_DATA:
- this->enable_hwecc(mtd, NAND_ECC_WRITE);
- this->write_buf(mtd, ffchars, this->layout[j].length);
- fflen += this->layout[j].length;
+ if (this->options & NAND_COMPLEX_OOB_WRITE) {
+ this->enable_hwecc(mtd, NAND_ECC_WRITE);
+ this->write_buf(mtd, ffchars, this->layout[j].length);
+ fflen += this->layout[j].length;
+ } else {
+ if (old_fflen < fflen) {
+ this->cmdfunc (mtd, NAND_CMD_PAGEPROG, -1, -1);
+ status = this->waitfunc (mtd, this, FL_WRITING);
+ if (status & NAND_STATUS_FAIL) {
+ DEBUG (MTD_DEBUG_LEVEL0, "%s: Failed write, page 0x%08x\n", __FUNCTION__, page);
+ ret = -EIO;
+ goto out;
+ }
+ }
+ fflen += this->layout[j].length;
+ if (this->options & NAND_BUSWIDTH_16 && (fflen + ooblen) & 1)
+ this->cmdfunc (mtd, NAND_CMD_SEQIN, fflen + ooblen - 1, page & this->pagemask);
+ else
+ this->cmdfunc (mtd, NAND_CMD_SEQIN, fflen + ooblen, page & this->pagemask);
+ old_fflen = fflen;
+ }
break;
case ITEM_TYPE_ECC:
More information about the linux-mtd-cvs
mailing list