* [PATCH] nand_omap_bch_decoder: Fix up error detection
@ 2011-12-09 10:00 Teresa Gámez
2011-12-21 13:18 ` Teresa Gamez
0 siblings, 1 reply; 3+ messages in thread
From: Teresa Gámez @ 2011-12-09 10:00 UTC (permalink / raw)
To: barebox; +Cc: Steve Schefter
From: Steve Schefter <steve@scheftech.com>
Bit errors in the ECC itself are not beeing taken into account.
In this cases the number of detected errors != number of corrected errors and
chien search returns an error.
This patch adds detection of bit errors in the ECC.
Signed-off-by: Steve Schefter <steve@scheftech.com>
Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
---
drivers/mtd/nand/nand_omap_bch_decoder.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/nand_omap_bch_decoder.c b/drivers/mtd/nand/nand_omap_bch_decoder.c
index 356f71f..d1455e4 100644
--- a/drivers/mtd/nand/nand_omap_bch_decoder.c
+++ b/drivers/mtd/nand/nand_omap_bch_decoder.c
@@ -64,6 +64,7 @@ static int chien(unsigned int select_4_8, int err_nums,
unsigned int err[], unsigned int *location)
{
int i, count; /* Number of dectected errors */
+ int errorsinecc; /* Number of detected errors in ECC bits */
/* Contains accumulation of evaluation at x^i (i:1->8) */
unsigned int gammas[8] = {0};
unsigned int alpha;
@@ -77,7 +78,8 @@ static int chien(unsigned int select_4_8, int err_nums,
gammas[i] = err[i];
count = 0;
- for (i = 1; (i <= nn) && (count < err_nums); i++) {
+ errorsinecc = 0;
+ for (i = 1; (i <= nn) && ((count + errorsinecc) < err_nums); i++) {
/* Result of evaluation at root */
elp_sum = 1 ^ gammas[0] ^ gammas[1] ^
@@ -108,11 +110,13 @@ static int chien(unsigned int select_4_8, int err_nums,
if (i >= 2 * ecc_bits)
location[count++] =
kk_shorten - (bit - 2 * ecc_bits) - 1;
+ else
+ errorsinecc++;
}
}
/* Failure: No. of detected errors != No. or corrected errors */
- if (count != err_nums) {
+ if ((count + errorsinecc) != err_nums) {
count = -1;
printk(KERN_ERR "BCH decoding failed\n");
}
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nand_omap_bch_decoder: Fix up error detection
2011-12-09 10:00 [PATCH] nand_omap_bch_decoder: Fix up error detection Teresa Gámez
@ 2011-12-21 13:18 ` Teresa Gamez
2012-01-02 11:45 ` Sascha Hauer
0 siblings, 1 reply; 3+ messages in thread
From: Teresa Gamez @ 2011-12-21 13:18 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Steve Schefter, barebox
Am Freitag, den 09.12.2011, 11:00 +0100 schrieb Teresa Gámez:
> From: Steve Schefter <steve@scheftech.com>
>
> Bit errors in the ECC itself are not beeing taken into account.
> In this cases the number of detected errors != number of corrected errors and
> chien search returns an error.
> This patch adds detection of bit errors in the ECC.
>
> Signed-off-by: Steve Schefter <steve@scheftech.com>
> Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Ping?
Regards
Teresa
> ---
> drivers/mtd/nand/nand_omap_bch_decoder.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_omap_bch_decoder.c b/drivers/mtd/nand/nand_omap_bch_decoder.c
> index 356f71f..d1455e4 100644
> --- a/drivers/mtd/nand/nand_omap_bch_decoder.c
> +++ b/drivers/mtd/nand/nand_omap_bch_decoder.c
> @@ -64,6 +64,7 @@ static int chien(unsigned int select_4_8, int err_nums,
> unsigned int err[], unsigned int *location)
> {
> int i, count; /* Number of dectected errors */
> + int errorsinecc; /* Number of detected errors in ECC bits */
> /* Contains accumulation of evaluation at x^i (i:1->8) */
> unsigned int gammas[8] = {0};
> unsigned int alpha;
> @@ -77,7 +78,8 @@ static int chien(unsigned int select_4_8, int err_nums,
> gammas[i] = err[i];
>
> count = 0;
> - for (i = 1; (i <= nn) && (count < err_nums); i++) {
> + errorsinecc = 0;
> + for (i = 1; (i <= nn) && ((count + errorsinecc) < err_nums); i++) {
>
> /* Result of evaluation at root */
> elp_sum = 1 ^ gammas[0] ^ gammas[1] ^
> @@ -108,11 +110,13 @@ static int chien(unsigned int select_4_8, int err_nums,
> if (i >= 2 * ecc_bits)
> location[count++] =
> kk_shorten - (bit - 2 * ecc_bits) - 1;
> + else
> + errorsinecc++;
> }
> }
>
> /* Failure: No. of detected errors != No. or corrected errors */
> - if (count != err_nums) {
> + if ((count + errorsinecc) != err_nums) {
> count = -1;
> printk(KERN_ERR "BCH decoding failed\n");
> }
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nand_omap_bch_decoder: Fix up error detection
2011-12-21 13:18 ` Teresa Gamez
@ 2012-01-02 11:45 ` Sascha Hauer
0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2012-01-02 11:45 UTC (permalink / raw)
To: Teresa Gamez; +Cc: Steve Schefter, barebox
On Wed, Dec 21, 2011 at 02:18:38PM +0100, Teresa Gamez wrote:
> Am Freitag, den 09.12.2011, 11:00 +0100 schrieb Teresa Gámez:
> > From: Steve Schefter <steve@scheftech.com>
> >
> > Bit errors in the ECC itself are not beeing taken into account.
> > In this cases the number of detected errors != number of corrected errors and
> > chien search returns an error.
> > This patch adds detection of bit errors in the ECC.
> >
> > Signed-off-by: Steve Schefter <steve@scheftech.com>
> > Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
>
> Ping?
Applied now.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-02 11:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09 10:00 [PATCH] nand_omap_bch_decoder: Fix up error detection Teresa Gámez
2011-12-21 13:18 ` Teresa Gamez
2012-01-02 11:45 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox