mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-29 16:22:26 +02:00
06082c3b5a
This patchset optimizes nand read access and reduces the ubi attach time by ~2/3 Credits go to dvdk for having the idea.
31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
--- a/drivers/mtd/nand/nand_base.c
|
|
+++ b/drivers/mtd/nand/nand_base.c
|
|
@@ -1313,9 +1313,15 @@ static int nand_read_page_hwecc_oob_firs
|
|
uint8_t *ecc_calc = chip->buffers->ecccalc;
|
|
|
|
/* Read the OOB area first */
|
|
- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
|
|
- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
|
|
- chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
|
|
+ if (mtd->writesize > 512) {
|
|
+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
|
|
+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
|
|
+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1);
|
|
+ } else {
|
|
+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
|
|
+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
|
|
+ chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
|
|
+ }
|
|
|
|
for (i = 0; i < chip->ecc.total; i++)
|
|
ecc_code[i] = chip->oob_poi[eccpos[i]];
|
|
@@ -1485,7 +1491,7 @@ static int nand_do_read_ops(struct mtd_i
|
|
if (realpage != chip->pagebuf || oob) {
|
|
bufpoi = aligned ? buf : chip->buffers->databuf;
|
|
|
|
- if (likely(sndcmd)) {
|
|
+ if (likely(sndcmd) && chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) {
|
|
chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
|
|
sndcmd = 0;
|
|
}
|