1 From 436aee004fda70b654698aff99427abdebf6bdb9 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Mon, 11 Jan 2010 04:29:37 +0100
4 Subject: [PATCH] /opt/Projects/openwrt/target/linux/xburst/patches-2.6.31/050-nand.patch
7 drivers/mtd/nand/Kconfig | 6 ++++++
8 drivers/mtd/nand/Makefile | 1 +
9 drivers/mtd/nand/nand_base.c | 19 +++++++------------
10 3 files changed, 14 insertions(+), 12 deletions(-)
12 diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
13 index 2fda0b6..8b28828 100644
14 --- a/drivers/mtd/nand/Kconfig
15 +++ b/drivers/mtd/nand/Kconfig
16 @@ -482,4 +482,10 @@ config MTD_NAND_W90P910
17 This enables the driver for the NAND Flash on evaluation board based
20 +config MTD_NAND_JZ4740
21 + tristate "Support NAND Flash device on Jz4740 board"
22 + depends on SOC_JZ4740
24 + Support NAND Flash device on Jz4740 board
27 diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
28 index 6950d3d..1661534 100644
29 --- a/drivers/mtd/nand/Makefile
30 +++ b/drivers/mtd/nand/Makefile
31 @@ -42,5 +42,6 @@ obj-$(CONFIG_MTD_NAND_SOCRATES) += socrates_nand.o
32 obj-$(CONFIG_MTD_NAND_TXX9NDFMC) += txx9ndfmc.o
33 obj-$(CONFIG_MTD_NAND_W90P910) += w90p910_nand.o
34 obj-$(CONFIG_MTD_NAND_NOMADIK) += nomadik_nand.o
35 +obj-$(CONFIG_MTD_NAND_JZ4740) += jz4740_nand.o
37 nand-objs := nand_base.o nand_bbt.o
38 diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
39 index 2957cc7..33ed710 100644
40 --- a/drivers/mtd/nand/nand_base.c
41 +++ b/drivers/mtd/nand/nand_base.c
42 @@ -956,29 +956,22 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
43 uint8_t *ecc_calc = chip->buffers->ecccalc;
44 uint8_t *ecc_code = chip->buffers->ecccode;
45 uint32_t *eccpos = chip->ecc.layout->eccpos;
47 - for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
48 - chip->ecc.hwctl(mtd, NAND_ECC_READ);
49 - chip->read_buf(mtd, p, eccsize);
50 - chip->ecc.calculate(mtd, p, &ecc_calc[i]);
52 - chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
55 for (i = 0; i < chip->ecc.total; i++)
56 ecc_code[i] = chip->oob_poi[eccpos[i]];
58 - eccsteps = chip->ecc.steps;
61 - for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
64 + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
65 + chip->ecc.hwctl(mtd, NAND_ECC_READ);
66 + chip->read_buf(mtd, p, eccsize);
67 stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
69 mtd->ecc_stats.failed++;
71 mtd->ecc_stats.corrected += stat;
77 @@ -1178,6 +1171,8 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
78 bufpoi = aligned ? buf : chip->buffers->databuf;
81 + chip->cmdfunc(mtd, NAND_CMD_READOOB, 0x00, page);
82 + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
83 chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);