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 <[EMAIL PROTECTED]>

---

Index: ktrack/drivers/mtd/nand/s3c2410.c
===================================================================
--- ktrack.orig/drivers/mtd/nand/s3c2410.c      2008-11-01 19:25:11.000000000 
-0200
+++ ktrack/drivers/mtd/nand/s3c2410.c   2008-11-01 19:38:07.000000000 -0200
@@ -530,7 +530,12 @@
 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)

Reply via email to