Root/target/linux/xburst/patches-2.6.32/902-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch

1From 93ad1a19872dfa2f4b9aa7b8d20581bda3057622 Mon Sep 17 00:00:00 2001
2From: Lars-Peter Clausen <lars@metafoo.de>
3Date: Sat, 26 Feb 2011 15:30:07 +0100
4Subject: [PATCH 2/4] NAND: Optimize NAND_ECC_HW_OOB_FIRST read
5
6Avoid sending unnecessary READ commands to the chip.
7---
8 drivers/mtd/nand/nand_base.c | 15 +++++++++++----
9 1 files changed, 11 insertions(+), 4 deletions(-)
10
11--- a/drivers/mtd/nand/nand_base.c
12+++ b/drivers/mtd/nand/nand_base.c
13@@ -1008,9 +1008,16 @@ static int nand_read_page_hwecc_oob_firs
14     uint8_t *ecc_calc = chip->buffers->ecccalc;
15 
16     /* Read the OOB area first */
17- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
18- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
19- chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
20+ /* Read the OOB area first */
21+ if (mtd->writesize > 512) {
22+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
23+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
24+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1);
25+ } else {
26+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
27+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
28+ chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
29+ }
30 
31     for (i = 0; i < chip->ecc.total; i++)
32         ecc_code[i] = chip->oob_poi[eccpos[i]];
33@@ -1177,7 +1184,7 @@ static int nand_do_read_ops(struct mtd_i
34         if (realpage != chip->pagebuf || oob) {
35             bufpoi = aligned ? buf : chip->buffers->databuf;
36 
37- if (likely(sndcmd)) {
38+ if (likely(sndcmd) && chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) {
39                 chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
40                 sndcmd = 0;
41             }
42

Archive Download this file



interactive