* [PATCH 1/1] omap3: nand: report corrected ecc errors @ 2011-02-22 10:50 John Ogness 2011-02-25 10:59 ` Artem Bityutskiy 0 siblings, 1 reply; 4+ messages in thread From: John Ogness @ 2011-02-22 10:50 UTC (permalink / raw) To: David Woodhouse; +Cc: linux-mtd, linux-kernel From: John Ogness <john.ogness@linutronix.de> The number of corrected ECC errors should be reported since other MTD systems make use of this information (such as UBI data scrubbing). Signed-off-by: John Ogness <john.ogness@linutronix.de> --- Patch against linux-next-20110221. drivers/mtd/nand/omap2.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 4e33972..a58465c 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -773,7 +773,7 @@ static int omap_compare_ecc(u8 *ecc_data1, /* read from NAND memory */ page_data[find_byte] ^= (1 << find_bit); - return 0; + return 1; default: if (isEccFF) { if (ecc_data2[0] == 0 && @@ -803,6 +803,7 @@ static int omap_correct_data(struct mtd_info *mtd, u_char *dat, struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, mtd); int blockCnt = 0, i = 0, ret = 0; + int stat = 0; /* Ex NAND_ECC_HW12_2048 */ if ((info->nand.ecc.mode == NAND_ECC_HW) && @@ -816,12 +817,13 @@ static int omap_correct_data(struct mtd_info *mtd, u_char *dat, ret = omap_compare_ecc(read_ecc, calc_ecc, dat); if (ret < 0) return ret; + stat += ret; } read_ecc += 3; calc_ecc += 3; dat += 512; } - return 0; + return stat; } /** -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] omap3: nand: report corrected ecc errors 2011-02-22 10:50 [PATCH 1/1] omap3: nand: report corrected ecc errors John Ogness @ 2011-02-25 10:59 ` Artem Bityutskiy 2011-02-28 12:12 ` [PATCH v2 " John Ogness 0 siblings, 1 reply; 4+ messages in thread From: Artem Bityutskiy @ 2011-02-25 10:59 UTC (permalink / raw) To: John Ogness; +Cc: David Woodhouse, linux-mtd, linux-kernel On Tue, 2011-02-22 at 11:50 +0100, John Ogness wrote: > From: John Ogness <john.ogness@linutronix.de> > > The number of corrected ECC errors should be reported since other MTD > systems make use of this information (such as UBI data scrubbing). > > Signed-off-by: John Ogness <john.ogness@linutronix.de> Hi, could you please CC the OMAP mailing List (linux-omap@vger.kernel.org) and probably TI people who seem to take care about the NAND driver nowadays, like "Sukumar Ghorai <s-ghorai@ti.com>" > diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c > index 4e33972..a58465c 100644 > --- a/drivers/mtd/nand/omap2.c > +++ b/drivers/mtd/nand/omap2.c > @@ -773,7 +773,7 @@ static int omap_compare_ecc(u8 *ecc_data1, /* read from NAND memory */ > > page_data[find_byte] ^= (1 << find_bit); > > - return 0; > + return 1; Could you please also improve the comment of this function and document the error codes - it was obvious when the codes were 0 and -1, and becomes less obvious when they are -1, 0, and 1. Thanks! -- Best Regards, Artem Bityutskiy (Артём Битюцкий) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/1] omap3: nand: report corrected ecc errors 2011-02-25 10:59 ` Artem Bityutskiy @ 2011-02-28 12:12 ` John Ogness 2011-03-07 8:48 ` Artem Bityutskiy 0 siblings, 1 reply; 4+ messages in thread From: John Ogness @ 2011-02-28 12:12 UTC (permalink / raw) To: dedekind1; +Cc: linux-omap, s-ghorai, David Woodhouse, linux-mtd, linux-kernel From: John Ogness <john.ogness@linutronix.de> The number of corrected ECC errors should be reported since other MTD systems make use of this information (such as UBI data scrubbing). Signed-off-by: John Ogness <john.ogness@linutronix.de> --- Patch v2: o Patch against linux-next-20110225. o Added comments explaining return codes. drivers/mtd/nand/omap2.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 4e33972..6324230 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -668,6 +668,8 @@ static void gen_true_ecc(u8 *ecc_buf) * * This function compares two ECC's and indicates if there is an error. * If the error can be corrected it will be corrected to the buffer. + * If there is no error, %0 is returned. If there is an error but it + * was corrected, %1 is returned. Otherwise, %-1 is returned. */ static int omap_compare_ecc(u8 *ecc_data1, /* read from NAND memory */ u8 *ecc_data2, /* read from register */ @@ -773,7 +775,7 @@ static int omap_compare_ecc(u8 *ecc_data1, /* read from NAND memory */ page_data[find_byte] ^= (1 << find_bit); - return 0; + return 1; default: if (isEccFF) { if (ecc_data2[0] == 0 && @@ -794,8 +796,11 @@ static int omap_compare_ecc(u8 *ecc_data1, /* read from NAND memory */ * @calc_ecc: ecc read from HW ECC registers * * Compares the ecc read from nand spare area with ECC registers values - * and if ECC's mismached, it will call 'omap_compare_ecc' for error detection - * and correction. + * and if ECC's mismatched, it will call 'omap_compare_ecc' for error + * detection and correction. If there are no errors, %0 is returned. If + * there were errors and all of the errors were corrected, the number of + * corrected errors is returned. If uncorrectable errors exist, %-1 is + * returned. */ static int omap_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc) @@ -803,6 +808,7 @@ static int omap_correct_data(struct mtd_info *mtd, u_char *dat, struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, mtd); int blockCnt = 0, i = 0, ret = 0; + int stat = 0; /* Ex NAND_ECC_HW12_2048 */ if ((info->nand.ecc.mode == NAND_ECC_HW) && @@ -816,12 +822,14 @@ static int omap_correct_data(struct mtd_info *mtd, u_char *dat, ret = omap_compare_ecc(read_ecc, calc_ecc, dat); if (ret < 0) return ret; + /* keep track of the number of corrected errors */ + stat += ret; } read_ecc += 3; calc_ecc += 3; dat += 512; } - return 0; + return stat; } /** -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] omap3: nand: report corrected ecc errors 2011-02-28 12:12 ` [PATCH v2 " John Ogness @ 2011-03-07 8:48 ` Artem Bityutskiy 0 siblings, 0 replies; 4+ messages in thread From: Artem Bityutskiy @ 2011-03-07 8:48 UTC (permalink / raw) To: John Ogness Cc: linux-omap, s-ghorai, David Woodhouse, linux-mtd, linux-kernel On Mon, 2011-02-28 at 13:12 +0100, John Ogness wrote: > From: John Ogness <john.ogness@linutronix.de> > > The number of corrected ECC errors should be reported since other MTD > systems make use of this information (such as UBI data scrubbing). > > Signed-off-by: John Ogness <john.ogness@linutronix.de> > --- > Patch v2: > o Patch against linux-next-20110225. > o Added comments explaining return codes. Pushed to l2-mtd-2.6.git, thanks. -- Best Regards, Artem Bityutskiy (Артём Битюцкий) ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-07 8:50 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-02-22 10:50 [PATCH 1/1] omap3: nand: report corrected ecc errors John Ogness 2011-02-25 10:59 ` Artem Bityutskiy 2011-02-28 12:12 ` [PATCH v2 " John Ogness 2011-03-07 8:48 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox