aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorWerner Almesberger <werner@openmoko.org>2008-11-19 17:11:18 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:11:18 +0000
commitce8e0e9b8df08d67a268d82f886ef6dc439940e6 (patch)
treec540f2b1b0f5bd3e29547db521208f64f614e4ec /drivers/mtd
parent324efdc2952b09c2f1191ab93ded6726366b2e8b (diff)
Re: [PATCH] fix root cause of NAND trouble
Ben Dooks wrote: > My only comment would be > that a slightly better solution would be to do: Oh, that's much better, thanks ! I hadn't realized at first that once could read the FIFO one byte at a time. The revised patch is below. - Werner ---------------------------------- cut here ----------------------------------- fix-s3c-nand-read-bytes.patch With the introduction of optimized OOB reads in nand_read_subpage, the length of the data requested may not be a multiple of four bytes. This caused a partial read on the 2440, leading to false ECC errors and, worse, attempts to "correct" them. Note that there is a similar issue in s3c2440_nand_write_buf, which doesn't seem to cause trouble yet. Signed-off-by: Werner Almesberger <werner@openmoko.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/s3c2410.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 7f68d8c59bb..04750ee2d0f 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -530,7 +530,12 @@ static void s3c2410_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
static void s3c2440_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
{
struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
+ u8 *ptr = buf + (len & ~3);
+ int i;
+
readsl(info->regs + S3C2440_NFDATA, buf, len / 4);
+ for (i = 0; i != (len & 3); i++)
+ ptr[i] = readb(info->regs + S3C2440_NFDATA);
}
static void s3c2410_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)