summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx/patches-2.6.24/1066-fix-hwecc-2410.patch.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/s3c24xx/patches-2.6.24/1066-fix-hwecc-2410.patch.patch')
-rw-r--r--target/linux/s3c24xx/patches-2.6.24/1066-fix-hwecc-2410.patch.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/patches-2.6.24/1066-fix-hwecc-2410.patch.patch b/target/linux/s3c24xx/patches-2.6.24/1066-fix-hwecc-2410.patch.patch
new file mode 100644
index 0000000..d75b2ec
--- /dev/null
+++ b/target/linux/s3c24xx/patches-2.6.24/1066-fix-hwecc-2410.patch.patch
@@ -0,0 +1,66 @@
+From b6817bed9516a65276ee92437697cb46136df882 Mon Sep 17 00:00:00 2001
+From: mokopatches <mokopatches@openmoko.org>
+Date: Sun, 13 Apr 2008 07:23:57 +0100
+Subject: [PATCH] fix-hwecc-2410.patch
+ S3C24xx ECC mis-calculates the bit to flip:
+ http://lists.infradead.org/pipermail/linux-mtd/2007-October/019586.html
+ If the error couldn't be corrected, we returned "no problem" :-(
+ http://lists.infradead.org/pipermail/linux-mtd/2007-October/019615.html
+
+Signed-off-by: Werner Almesberger <werner@openmoko.org>
+---
+ drivers/mtd/nand/s3c2410.c | 28 +++++++++++++---------------
+ 1 files changed, 13 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
+index f83bed9..f7dd4e0 100644
+--- a/drivers/mtd/nand/s3c2410.c
++++ b/drivers/mtd/nand/s3c2410.c
+@@ -364,23 +364,21 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
+ ((diff2 ^ (diff2 >> 1)) & 0x55) == 0x55) {
+ /* calculate the bit position of the error */
+
+- bit = (diff2 >> 2) & 1;
+- bit |= (diff2 >> 3) & 2;
+- bit |= (diff2 >> 4) & 4;
++ bit = ((diff2 >> 3) & 1) |
++ ((diff2 >> 4) & 2) |
++ ((diff2 >> 5) & 4);
+
+ /* calculate the byte position of the error */
+
+- byte = (diff1 << 1) & 0x80;
+- byte |= (diff1 << 2) & 0x40;
+- byte |= (diff1 << 3) & 0x20;
+- byte |= (diff1 << 4) & 0x10;
+-
+- byte |= (diff0 >> 3) & 0x08;
+- byte |= (diff0 >> 2) & 0x04;
+- byte |= (diff0 >> 1) & 0x02;
+- byte |= (diff0 >> 0) & 0x01;
+-
+- byte |= (diff2 << 8) & 0x100;
++ byte = ((diff2 << 7) & 0x100) |
++ ((diff1 << 0) & 0x80) |
++ ((diff1 << 1) & 0x40) |
++ ((diff1 << 2) & 0x20) |
++ ((diff1 << 3) & 0x10) |
++ ((diff0 >> 4) & 0x08) |
++ ((diff0 >> 3) & 0x04) |
++ ((diff0 >> 2) & 0x02) |
++ ((diff0 >> 1) & 0x01);
+
+ dev_dbg(info->device, "correcting error bit %d, byte %d\n",
+ bit, byte);
+@@ -399,7 +397,7 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
+ if ((diff0 & ~(1<<fls(diff0))) == 0)
+ return 1;
+
+- return 0;
++ return -EBADMSG;
+ }
+
+ /* ECC functions
+--
+1.5.6.5
+