mac80211: make it work with 3.18.12+
[openwrt/openwrt.git] / target / linux / xburst / patches-3.18 / 002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch
1 From 98d33db1c87e2447b9b203399d2f995e05ecdb52 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Sat, 26 Feb 2011 15:30:07 +0100
4 Subject: [PATCH 2/7] NAND: Optimize NAND_ECC_HW_OOB_FIRST read
5
6 Avoid sending unnecessary READ commands to the chip.
7 ---
8 drivers/mtd/nand/nand_base.c | 17 +++++++++++++----
9 1 file changed, 13 insertions(+), 4 deletions(-)
10
11 diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
12 index 5b5c627..4c8d646 100644
13 --- a/drivers/mtd/nand/nand_base.c
14 +++ b/drivers/mtd/nand/nand_base.c
15 @@ -1360,9 +1360,16 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
16 unsigned int max_bitflips = 0;
17
18 /* Read the OOB area first */
19 - chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
20 - chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
21 - chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
22 + /* Read the OOB area first */
23 + if (mtd->writesize > 512) {
24 + chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
25 + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
26 + chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1);
27 + } else {
28 + chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
29 + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
30 + chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
31 + }
32
33 for (i = 0; i < chip->ecc.total; i++)
34 ecc_code[i] = chip->oob_poi[eccpos[i]];
35 @@ -1575,7 +1582,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
36 __func__, buf);
37
38 read_retry:
39 - chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
40 + if (chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) {
41 + chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
42 + }
43
44 /*
45 * Now read the page into the buffer. Absent an error,
46 --
47 1.7.10.4
48