mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-25 09:20:16 +02:00
10b1e8ca0c
there is repeat code in platform.c file and 050-nand.patch make 200-qi_lb60.patch no warning. Signed-off-by: Xiangfu Liu <xiangfu.z@gmail.com>
102 lines
3.2 KiB
Diff
102 lines
3.2 KiB
Diff
From 3558f77fbc178030cf2991dddd678847a35ef98e Mon Sep 17 00:00:00 2001
|
|
From: Xiangfu Liu <xiangfu.z@gmail.com>
|
|
Date: Thu, 20 Aug 2009 18:35:54 +0800
|
|
Subject: [PATCH] nand
|
|
|
|
---
|
|
arch/mips/jz4740/platform.c | 1 +
|
|
drivers/mtd/nand/Kconfig | 6 ++++++
|
|
drivers/mtd/nand/Makefile | 1 +
|
|
drivers/mtd/nand/nand_base.c | 19 +++++++------------
|
|
4 files changed, 15 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c
|
|
index a02aec1..bac37ee 100644
|
|
--- a/arch/mips/jz4740/platform.c
|
|
+++ b/arch/mips/jz4740/platform.c
|
|
@@ -15,6 +15,7 @@
|
|
#include <linux/resource.h>
|
|
#include <linux/mtd/jz4740_nand.h>
|
|
#include <linux/input/matrix_keypad.h>
|
|
+#include <linux/mtd/jz4740_nand.h>
|
|
|
|
#include <asm/jzsoc.h>
|
|
|
|
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
|
|
index ce96c09..818bce0 100644
|
|
--- a/drivers/mtd/nand/Kconfig
|
|
+++ b/drivers/mtd/nand/Kconfig
|
|
@@ -452,4 +452,10 @@ config MTD_NAND_SOCRATES
|
|
help
|
|
Enables support for NAND Flash chips wired onto Socrates board.
|
|
|
|
+config MTD_NAND_JZ4740
|
|
+ tristate "Support NAND Flash device on Jz4740 board"
|
|
+ depends on SOC_JZ4740
|
|
+ help
|
|
+ Support NAND Flash device on Jz4740 board
|
|
+
|
|
endif # MTD_NAND
|
|
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
|
|
index f3a786b..ef4590b 100644
|
|
--- a/drivers/mtd/nand/Makefile
|
|
+++ b/drivers/mtd/nand/Makefile
|
|
@@ -40,5 +40,6 @@ obj-$(CONFIG_MTD_NAND_SH_FLCTL) += sh_flctl.o
|
|
obj-$(CONFIG_MTD_NAND_MXC) += mxc_nand.o
|
|
obj-$(CONFIG_MTD_NAND_SOCRATES) += socrates_nand.o
|
|
obj-$(CONFIG_MTD_NAND_TXX9NDFMC) += txx9ndfmc.o
|
|
+obj-$(CONFIG_MTD_NAND_JZ4740) += jz4740_nand.o
|
|
|
|
nand-objs := nand_base.o nand_bbt.o
|
|
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
|
|
index 8c21b89..1749f31 100644
|
|
--- a/drivers/mtd/nand/nand_base.c
|
|
+++ b/drivers/mtd/nand/nand_base.c
|
|
@@ -953,29 +953,22 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
|
|
uint8_t *ecc_calc = chip->buffers->ecccalc;
|
|
uint8_t *ecc_code = chip->buffers->ecccode;
|
|
uint32_t *eccpos = chip->ecc.layout->eccpos;
|
|
-
|
|
- for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
|
- chip->ecc.hwctl(mtd, NAND_ECC_READ);
|
|
- chip->read_buf(mtd, p, eccsize);
|
|
- chip->ecc.calculate(mtd, p, &ecc_calc[i]);
|
|
- }
|
|
- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
|
|
+ int stat;
|
|
|
|
for (i = 0; i < chip->ecc.total; i++)
|
|
ecc_code[i] = chip->oob_poi[eccpos[i]];
|
|
|
|
- eccsteps = chip->ecc.steps;
|
|
- p = buf;
|
|
-
|
|
- for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
|
- int stat;
|
|
|
|
+ for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
|
+ chip->ecc.hwctl(mtd, NAND_ECC_READ);
|
|
+ chip->read_buf(mtd, p, eccsize);
|
|
stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
|
|
if (stat < 0)
|
|
mtd->ecc_stats.failed++;
|
|
else
|
|
mtd->ecc_stats.corrected += stat;
|
|
}
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -1125,6 +1118,8 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
|
|
bufpoi = aligned ? buf : chip->buffers->databuf;
|
|
|
|
if (likely(sndcmd)) {
|
|
+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0x00, page);
|
|
+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
|
|
chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
|
|
sndcmd = 0;
|
|
}
|
|
--
|
|
1.6.0.4
|
|
|