From 5fa159fe903240a78136ba90bfefc91d899fcfe3 Mon Sep 17 00:00:00 2001 From: Xiangfu Liu Date: Fri, 19 Aug 2011 15:46:14 +0800 Subject: [PATCH 21/32] 904-NAND-Optimize-reading-the-eec-data-for-the-JZ4740-ev.patch --- drivers/mtd/nand/nand_base.c | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index f1214af..37c0cfb 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -1306,8 +1306,8 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd, /* 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); @@ -1315,9 +1315,6 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd, 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; @@ -1372,8 +1369,8 @@ static int nand_read_subpage_hwecc_oob_first(struct mtd_info *mtd, struct nand_c /* 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); @@ -1381,9 +1378,6 @@ static int nand_read_subpage_hwecc_oob_first(struct mtd_info *mtd, struct nand_c 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) { -- 1.7.4.1