From: Josh Wu <josh.wu@atmel.com>
To: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: mikedunn@newsguy.com, plagnioj@jcrosoft.com,
linux-mtd@lists.infradead.org,
linux-arm-kernel@lists.infradead.org, dedekind1@gmail.com
Subject: Re: [PATCH] MTD: at91: atmel_nand: return bit flips for the PMECC read_page()
Date: Thu, 22 Nov 2012 11:39:58 +0800 [thread overview]
Message-ID: <50AD9E8E.7050402@atmel.com> (raw)
In-Reply-To: <50ACA764.3030002@atmel.com>
Hi, Nicolas
On 11/21/2012 6:05 PM, Nicolas Ferre wrote:
> On 11/21/2012 06:14 AM, Josh Wu :
>>
> Can we have more comment to figure out why it is needed please?
I will add following comment in the commit message in the v2 version.
Since the commit: 3f91e94f7f511de74c0d2abe08672ccdbdd1961c ("mtd: nand:
read_page() returns max_bitflips ()")
The ecc.read_page() method for nand drivers is changed to return the
maximum number of bitflips instead of just returning 0.
And the nand.h is also explain that. I would like to adapt to it.
Best Regards,
Josh Wu
>
> Best regards,
>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>> drivers/mtd/nand/atmel_nand.c | 13 +++++++++----
>> 1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
>> index 9144557..860dd36 100644
>> --- a/drivers/mtd/nand/atmel_nand.c
>> +++ b/drivers/mtd/nand/atmel_nand.c
>> @@ -723,6 +723,7 @@ static int pmecc_correction(struct mtd_info *mtd, u32 pmecc_stat, uint8_t *buf,
>> struct atmel_nand_host *host = nand_chip->priv;
>> int i, err_nbr, eccbytes;
>> uint8_t *buf_pos;
>> + int total_err = 0;
>>
>> eccbytes = nand_chip->ecc.bytes;
>> for (i = 0; i < eccbytes; i++)
>> @@ -750,12 +751,13 @@ normal_check:
>> pmecc_correct_data(mtd, buf_pos, ecc, i,
>> host->pmecc_bytes_per_sector, err_nbr);
>> mtd->ecc_stats.corrected += err_nbr;
>> + total_err += err_nbr;
>> }
>> }
>> pmecc_stat >>= 1;
>> }
>>
>> - return 0;
>> + return total_err;
>> }
>>
>> static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
>> @@ -767,6 +769,7 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
>> uint32_t *eccpos = chip->ecc.layout->eccpos;
>> uint32_t stat;
>> unsigned long end_time;
>> + int bitflips = 0;
>>
>> pmecc_writel(host->ecc, CTRL, PMECC_CTRL_RST);
>> pmecc_writel(host->ecc, CTRL, PMECC_CTRL_DISABLE);
>> @@ -789,11 +792,13 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
>> }
>>
>> stat = pmecc_readl_relaxed(host->ecc, ISR);
>> - if (stat != 0)
>> - if (pmecc_correction(mtd, stat, buf, &oob[eccpos[0]]) != 0)
>> + if (stat != 0) {
>> + bitflips = pmecc_correction(mtd, stat, buf, &oob[eccpos[0]]);
>> + if (bitflips < 0)
>> return -EIO;
>> + }
>>
>> - return 0;
>> + return bitflips;
>> }
>>
>> static int atmel_nand_pmecc_write_page(struct mtd_info *mtd,
>>
>
WARNING: multiple messages have this Message-ID (diff)
From: josh.wu@atmel.com (Josh Wu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] MTD: at91: atmel_nand: return bit flips for the PMECC read_page()
Date: Thu, 22 Nov 2012 11:39:58 +0800 [thread overview]
Message-ID: <50AD9E8E.7050402@atmel.com> (raw)
In-Reply-To: <50ACA764.3030002@atmel.com>
Hi, Nicolas
On 11/21/2012 6:05 PM, Nicolas Ferre wrote:
> On 11/21/2012 06:14 AM, Josh Wu :
>>
> Can we have more comment to figure out why it is needed please?
I will add following comment in the commit message in the v2 version.
Since the commit: 3f91e94f7f511de74c0d2abe08672ccdbdd1961c ("mtd: nand:
read_page() returns max_bitflips ()")
The ecc.read_page() method for nand drivers is changed to return the
maximum number of bitflips instead of just returning 0.
And the nand.h is also explain that. I would like to adapt to it.
Best Regards,
Josh Wu
>
> Best regards,
>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>> drivers/mtd/nand/atmel_nand.c | 13 +++++++++----
>> 1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
>> index 9144557..860dd36 100644
>> --- a/drivers/mtd/nand/atmel_nand.c
>> +++ b/drivers/mtd/nand/atmel_nand.c
>> @@ -723,6 +723,7 @@ static int pmecc_correction(struct mtd_info *mtd, u32 pmecc_stat, uint8_t *buf,
>> struct atmel_nand_host *host = nand_chip->priv;
>> int i, err_nbr, eccbytes;
>> uint8_t *buf_pos;
>> + int total_err = 0;
>>
>> eccbytes = nand_chip->ecc.bytes;
>> for (i = 0; i < eccbytes; i++)
>> @@ -750,12 +751,13 @@ normal_check:
>> pmecc_correct_data(mtd, buf_pos, ecc, i,
>> host->pmecc_bytes_per_sector, err_nbr);
>> mtd->ecc_stats.corrected += err_nbr;
>> + total_err += err_nbr;
>> }
>> }
>> pmecc_stat >>= 1;
>> }
>>
>> - return 0;
>> + return total_err;
>> }
>>
>> static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
>> @@ -767,6 +769,7 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
>> uint32_t *eccpos = chip->ecc.layout->eccpos;
>> uint32_t stat;
>> unsigned long end_time;
>> + int bitflips = 0;
>>
>> pmecc_writel(host->ecc, CTRL, PMECC_CTRL_RST);
>> pmecc_writel(host->ecc, CTRL, PMECC_CTRL_DISABLE);
>> @@ -789,11 +792,13 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
>> }
>>
>> stat = pmecc_readl_relaxed(host->ecc, ISR);
>> - if (stat != 0)
>> - if (pmecc_correction(mtd, stat, buf, &oob[eccpos[0]]) != 0)
>> + if (stat != 0) {
>> + bitflips = pmecc_correction(mtd, stat, buf, &oob[eccpos[0]]);
>> + if (bitflips < 0)
>> return -EIO;
>> + }
>>
>> - return 0;
>> + return bitflips;
>> }
>>
>> static int atmel_nand_pmecc_write_page(struct mtd_info *mtd,
>>
>
next prev parent reply other threads:[~2012-11-22 3:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-21 5:14 [PATCH] MTD: at91: atmel_nand: return bit flips for the PMECC read_page() Josh Wu
2012-11-21 5:14 ` Josh Wu
2012-11-21 10:05 ` Nicolas Ferre
2012-11-21 10:05 ` Nicolas Ferre
2012-11-22 3:39 ` Josh Wu [this message]
2012-11-22 3:39 ` Josh Wu
2012-11-27 18:06 ` Mike Dunn
2012-11-27 18:06 ` Mike Dunn
2012-11-26 20:38 ` Mike Dunn
2012-11-26 20:38 ` Mike Dunn
2012-11-27 2:31 ` Josh Wu
2012-11-27 2:31 ` Josh Wu
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=50AD9E8E.7050402@atmel.com \
--to=josh.wu@atmel.com \
--cc=dedekind1@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mikedunn@newsguy.com \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.