From: Feng Kan <fkan@amcc.com>
To: linux-mtd@lists.infradead.org
Cc: Feng Kan <fkan@amcc.com>
Subject: [PATCH 1/1] Fix ECC Correction bug for SMC ordering for NDFC driver.
Date: Tue, 25 Aug 2009 11:00:45 -0700 [thread overview]
Message-ID: <1251223245-17059-1-git-send-email-fkan@amcc.com> (raw)
Fix ECC Correction bug where the byte offset location were double
fliped causing correction routine to toggle the wrong byte location
in the ECC segment. The ndfc_calculate_ecc routine change the order
of getting the ECC code.
/* The NDFC uses Smart Media (SMC) bytes order */
ecc_code[0] = p[2];
ecc_code[1] = p[1];
ecc_code[2] = p[3];
But in the Correction algorithm when calculating the byte offset
location, the b1 is used as the upper part of the address. Which
again reverse the order making the final byte offset address
location incorrect.
byte_addr = (addressbits[b1] << 4) + addressbits[b0];
The order is change to read it in straight and let the correction
function to revert it to SMC order.
Signed-off-by: Feng Kan <fkan@amcc.com>
Acked-by: Victor Gallardo <vgallardo@amcc.com>
Acked-by: Prodyut Hazarika <phazarika@amcc.com>
---
drivers/mtd/nand/ndfc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 5906c40..d9d3e6e 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -101,8 +101,8 @@ static int ndfc_calculate_ecc(struct mtd_info *mtd,
wmb();
ecc = in_be32(ndfc->ndfcbase + NDFC_ECC);
/* The NDFC uses Smart Media (SMC) bytes order */
- ecc_code[0] = p[2];
- ecc_code[1] = p[1];
+ ecc_code[0] = p[1];
+ ecc_code[1] = p[2];
ecc_code[2] = p[3];
return 0;
--
1.5.5
next reply other threads:[~2009-08-25 18:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-25 18:00 Feng Kan [this message]
[not found] <12718.41111.qm@web39803.mail.mud.yahoo.com>
2009-08-28 14:11 ` [PATCH 1/1] Fix ECC Correction bug for SMC ordering for NDFC driver Victor Gallardo
-- strict thread matches above, loose matches on Subject: below --
2009-08-25 18:27 Feng Kan
2009-08-25 17:49 Feng Kan
2009-08-21 0:19 Feng Kan
2009-08-21 8:02 ` Stefan Roese
2009-08-21 18:55 ` Sean MacLennan
2009-08-21 20:35 ` Victor Gallardo
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=1251223245-17059-1-git-send-email-fkan@amcc.com \
--to=fkan@amcc.com \
--cc=linux-mtd@lists.infradead.org \
/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