mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-05 05:01:32 +02:00
c389527669
This patchset optimizes nand read access and reduces the ubi attach time by ~2/3 Credits go to dvdk for having the idea.
45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
--- a/drivers/mtd/nand/nand_base.c
|
|
+++ b/drivers/mtd/nand/nand_base.c
|
|
@@ -1314,8 +1314,8 @@ static int nand_read_page_hwecc_oob_firs
|
|
|
|
/* Read the OOB area first */
|
|
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_READ0, mtd->writesize + eccpos[0], page);
|
|
+ chip->read_buf(mtd, ecc_code, chip->ecc.total);
|
|
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1);
|
|
} else {
|
|
chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
|
|
@@ -1323,9 +1323,6 @@ static int nand_read_page_hwecc_oob_firs
|
|
chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
|
|
}
|
|
|
|
- for (i = 0; i < chip->ecc.total; i++)
|
|
- ecc_code[i] = chip->oob_poi[eccpos[i]];
|
|
-
|
|
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
|
int stat;
|
|
|
|
@@ -1380,8 +1377,8 @@ static int nand_read_subpage_hwecc_oob_f
|
|
|
|
/* Read the OOB area first */
|
|
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_READ0, mtd->writesize + eccpos[0], page);
|
|
+ chip->read_buf(mtd, ecc_code, chip->ecc.total);
|
|
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1);
|
|
} else {
|
|
chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
|
|
@@ -1389,9 +1386,6 @@ static int nand_read_subpage_hwecc_oob_f
|
|
chip->cmdfunc(mtd, NAND_CMD_READ0, data_col_addr, page);
|
|
}
|
|
|
|
- for (i = 0; i < chip->ecc.total; i++)
|
|
- ecc_code[i] = chip->oob_poi[eccpos[i]];
|
|
-
|
|
p = bufpoi + data_col_addr;
|
|
|
|
for (i = eccbytes * start_step; num_steps; num_steps--, i += eccbytes, p += eccsize) {
|