[ar71xx] preliminary support for the Ubiquiti RouterStation Pro
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1066-fix-hwecc-2410.patch.patch
1 From b6817bed9516a65276ee92437697cb46136df882 Mon Sep 17 00:00:00 2001
2 From: mokopatches <mokopatches@openmoko.org>
3 Date: Sun, 13 Apr 2008 07:23:57 +0100
4 Subject: [PATCH] fix-hwecc-2410.patch
5 S3C24xx ECC mis-calculates the bit to flip:
6 http://lists.infradead.org/pipermail/linux-mtd/2007-October/019586.html
7 If the error couldn't be corrected, we returned "no problem" :-(
8 http://lists.infradead.org/pipermail/linux-mtd/2007-October/019615.html
9
10 Signed-off-by: Werner Almesberger <werner@openmoko.org>
11 ---
12 drivers/mtd/nand/s3c2410.c | 28 +++++++++++++---------------
13 1 files changed, 13 insertions(+), 15 deletions(-)
14
15 diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
16 index f83bed9..f7dd4e0 100644
17 --- a/drivers/mtd/nand/s3c2410.c
18 +++ b/drivers/mtd/nand/s3c2410.c
19 @@ -364,23 +364,21 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
20 ((diff2 ^ (diff2 >> 1)) & 0x55) == 0x55) {
21 /* calculate the bit position of the error */
22
23 - bit = (diff2 >> 2) & 1;
24 - bit |= (diff2 >> 3) & 2;
25 - bit |= (diff2 >> 4) & 4;
26 + bit = ((diff2 >> 3) & 1) |
27 + ((diff2 >> 4) & 2) |
28 + ((diff2 >> 5) & 4);
29
30 /* calculate the byte position of the error */
31
32 - byte = (diff1 << 1) & 0x80;
33 - byte |= (diff1 << 2) & 0x40;
34 - byte |= (diff1 << 3) & 0x20;
35 - byte |= (diff1 << 4) & 0x10;
36 -
37 - byte |= (diff0 >> 3) & 0x08;
38 - byte |= (diff0 >> 2) & 0x04;
39 - byte |= (diff0 >> 1) & 0x02;
40 - byte |= (diff0 >> 0) & 0x01;
41 -
42 - byte |= (diff2 << 8) & 0x100;
43 + byte = ((diff2 << 7) & 0x100) |
44 + ((diff1 << 0) & 0x80) |
45 + ((diff1 << 1) & 0x40) |
46 + ((diff1 << 2) & 0x20) |
47 + ((diff1 << 3) & 0x10) |
48 + ((diff0 >> 4) & 0x08) |
49 + ((diff0 >> 3) & 0x04) |
50 + ((diff0 >> 2) & 0x02) |
51 + ((diff0 >> 1) & 0x01);
52
53 dev_dbg(info->device, "correcting error bit %d, byte %d\n",
54 bit, byte);
55 @@ -399,7 +397,7 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
56 if ((diff0 & ~(1<<fls(diff0))) == 0)
57 return 1;
58
59 - return 0;
60 + return -EBADMSG;
61 }
62
63 /* ECC functions
64 --
65 1.5.6.5
66
This page took 0.042481 seconds and 5 git commands to generate.