Root/target/linux/xburst/patches-2.6.37/902-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch

1--- a/drivers/mtd/nand/nand_base.c
2+++ b/drivers/mtd/nand/nand_base.c
3@@ -1313,9 +1313,15 @@ static int nand_read_page_hwecc_oob_firs
4     uint8_t *ecc_calc = chip->buffers->ecccalc;
5 
6     /* Read the OOB area first */
7- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
8- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
9- chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
10+ if (mtd->writesize > 512) {
11+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
12+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
13+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1);
14+ } else {
15+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
16+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
17+ chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
18+ }
19 
20     for (i = 0; i < chip->ecc.total; i++)
21         ecc_code[i] = chip->oob_poi[eccpos[i]];
22@@ -1485,7 +1491,7 @@ static int nand_do_read_ops(struct mtd_i
23         if (realpage != chip->pagebuf || oob) {
24             bufpoi = aligned ? buf : chip->buffers->databuf;
25 
26- if (likely(sndcmd)) {
27+ if (likely(sndcmd) && chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) {
28                 chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
29                 sndcmd = 0;
30             }
31

Archive Download this file



interactive