From: Matt Reimer <mattjreimer@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Matt Reimer <mreimer@vpop.net>
Subject: [PATCH] MTD: fix s3c2410 error correction
Date: Thu, 18 Oct 2007 18:02:43 -0700 [thread overview]
Message-ID: <1192755764-26269-1-git-send-email-mattjreimer@gmail.com> (raw)
From: Matt Reimer <mreimer@vpop.net>
The single-bit error correction was, well, incorrect. For determing which
bit to correct it was using P1' P2' P4' P8' instead of P1 P2 P4 P8, and
it was using P16' P32' P64' P128' P256' P512' P1024' P2048' instead of
P16 P32 P64 P128 P256 P512 P1024 P2048.
Signed-off-by: Matt Reimer <mreimer@vpop.net>
---
drivers/mtd/nand/s3c2410.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 903db18..077fdcc 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);
--
1.5.3.2
next reply other threads:[~2007-10-19 1:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-19 1:02 Matt Reimer [this message]
2007-10-19 1:02 ` [PATCH] MTD: make s3c2410's correct_data indicate an error for multi-bit read errors Matt Reimer
2007-10-25 18:16 ` [PATCH] MTD: fix s3c2410 error correction Matt Reimer
2007-11-06 17:09 ` Matt Reimer
2007-11-06 18:11 ` Jörn Engel
2007-11-06 22:34 ` Matt Reimer
2007-11-06 23:26 ` Jörn Engel
2007-11-21 8:17 ` Matthieu CASTET
2007-11-29 19:10 ` Matt Reimer
2007-12-03 15:20 ` Jörn Engel
2007-12-10 19:09 ` Matt Reimer
2008-01-25 22:07 ` Matt Reimer
[not found] <20080117182634.GX14041@almesberger.net>
2008-01-19 0:45 ` Matt Reimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1192755764-26269-1-git-send-email-mattjreimer@gmail.com \
--to=mattjreimer@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=mreimer@vpop.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox