Root/target/linux/xburst/patches-2.6.32/904-NAND-Optimize-reading-the-eec-data-for-the-JZ4740-ev.patch

1From 3eeeee7302a9b25de1eeabd901d3bb678d9983d9 Mon Sep 17 00:00:00 2001
2From: Lars-Peter Clausen <lars@metafoo.de>
3Date: Sat, 26 Feb 2011 15:32:30 +0100
4Subject: [PATCH 4/4] NAND: Optimize reading the eec data for the JZ4740 (evil hack)
5
6We know that the ecc data is continuous, this allows us to only read the ecc
7data instead of the whole oob section, which slightly improves performance.
8
9Note that this is an evil hack, which will break platforms where the ecc data is
10non-continuous.
11---
12 drivers/mtd/nand/nand_base.c | 16 +++++-----------
13 1 files changed, 5 insertions(+), 11 deletions(-)
14
15--- a/drivers/mtd/nand/nand_base.c
16+++ b/drivers/mtd/nand/nand_base.c
17@@ -1011,8 +1011,8 @@ static int nand_read_page_hwecc_oob_firs
18     /* Read the OOB area first */
19     /* Read the OOB area first */
20     if (mtd->writesize > 512) {
21- chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
22- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
23+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize + eccpos[0], page);
24+ chip->read_buf(mtd, ecc_code, chip->ecc.total);
25         chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1);
26     } else {
27         chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
28@@ -1020,9 +1020,6 @@ static int nand_read_page_hwecc_oob_firs
29         chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
30     }
31 
32- for (i = 0; i < chip->ecc.total; i++)
33- ecc_code[i] = chip->oob_poi[eccpos[i]];
34-
35     for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
36         int stat;
37 
38@@ -1077,8 +1074,8 @@ static int nand_read_subpage_hwecc_oob_f
39 
40     /* Read the OOB area first */
41     if (mtd->writesize > 512) {
42- chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
43- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
44+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize + eccpos[0], page);
45+ chip->read_buf(mtd, ecc_code, chip->ecc.total);
46         chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1);
47     } else {
48         chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
49@@ -1086,9 +1083,6 @@ static int nand_read_subpage_hwecc_oob_f
50         chip->cmdfunc(mtd, NAND_CMD_READ0, data_col_addr, page);
51     }
52 
53- for (i = 0; i < chip->ecc.total; i++)
54- ecc_code[i] = chip->oob_poi[eccpos[i]];
55-
56     p = bufpoi + data_col_addr;
57 
58     for (i = eccbytes * start_step; num_steps; num_steps--, i += eccbytes, p += eccsize) {
59

Archive Download this file



interactive