Date:2011-02-26 15:32:30 (9 years 4 months ago)
Author:Lars C.
Commit:b05a5adf03613de371c77c3235f7d970d7cd0c71
Message:NAND: Optimize reading the eec data for the JZ4740 (evil hack)

We know that the ecc data is continuous, this allows us to only read the ecc
data instead of the whole oob section, which slightly improves performance.

Note that this is an evil hack, which will break platforms where the ecc data is
non-continuous.
Files: drivers/mtd/nand/nand_base.c (4 diffs)

Change Details

drivers/mtd/nand/nand_base.c
13161316    /* Read the OOB area first */
13171317    /* Read the OOB area first */
13181318    if (mtd->writesize > 512) {
1319        chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
1320        chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
1319        chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize + eccpos[0], page);
1320        chip->read_buf(mtd, ecc_code, chip->ecc.total);
13211321        chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1);
13221322    } else {
13231323        chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
...... 
13251325        chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
13261326    }
13271327
1328    for (i = 0; i < chip->ecc.total; i++)
1329        ecc_code[i] = chip->oob_poi[eccpos[i]];
1330
13311328    for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
13321329        int stat;
13331330
...... 
13821379
13831380    /* Read the OOB area first */
13841381    if (mtd->writesize > 512) {
1385        chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
1386        chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
1382        chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize + eccpos[0], page);
1383        chip->read_buf(mtd, ecc_code, chip->ecc.total);
13871384        chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1);
13881385    } else {
13891386        chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
...... 
13911388        chip->cmdfunc(mtd, NAND_CMD_READ0, data_col_addr, page);
13921389    }
13931390
1394    for (i = 0; i < chip->ecc.total; i++)
1395        ecc_code[i] = chip->oob_poi[eccpos[i]];
1396
13971391    p = bufpoi + data_col_addr;
13981392
13991393    for (i = eccbytes * start_step; num_steps; num_steps--, i += eccbytes, p += eccsize) {

Archive Download the corresponding diff file



interactive