* [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
@ 2012-12-03 19:48 Zach Sadecki
2012-12-04 3:34 ` Huang Shijie
2012-12-10 13:44 ` Artem Bityutskiy
0 siblings, 2 replies; 17+ messages in thread
From: Zach Sadecki @ 2012-12-03 19:48 UTC (permalink / raw)
To: linux-mtd
Always report corrected and failed ECC stats back up to the MTD layer. Also
return max_bitflips from read_page() as is expected from NAND drivers now.
Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index d79696b..fe10c53 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -914,8 +914,7 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
dma_addr_t auxiliary_phys;
unsigned int i;
unsigned char *status;
- unsigned int failed;
- unsigned int corrected;
+ unsigned int max_bitflips = 0;
int ret;
pr_debug("page number is : %d\n", page);
@@ -939,35 +938,25 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
payload_virt, payload_phys);
if (ret) {
pr_err("Error in ECC-based read: %d\n", ret);
- goto exit_nfc;
+ return ret;
}
/* handle the block mark swapping */
block_mark_swapping(this, payload_virt, auxiliary_virt);
/* Loop over status bytes, accumulating ECC status. */
- failed = 0;
- corrected = 0;
- status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
+ status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
if ((*status == STATUS_GOOD) || (*status == STATUS_ERASED))
continue;
if (*status == STATUS_UNCORRECTABLE) {
- failed++;
+ mtd->ecc_stats.failed++;
continue;
}
- corrected += *status;
- }
-
- /*
- * Propagate ECC status to the owning MTD only when failed or
- * corrected times nearly reaches our ECC correction threshold.
- */
- if (failed || corrected >= (nfc_geo->ecc_strength - 1)) {
- mtd->ecc_stats.failed += failed;
- mtd->ecc_stats.corrected += corrected;
+ mtd->ecc_stats.corrected += *status;
+ max_bitflips = max_t(unsigned int, max_bitflips, *status);
}
if (oob_required) {
@@ -989,8 +978,8 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
this->payload_virt, this->payload_phys,
nfc_geo->payload_size,
payload_virt, payload_phys);
-exit_nfc:
- return ret;
+
+ return max_bitflips;
}
static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-03 19:48 [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips Zach Sadecki
@ 2012-12-04 3:34 ` Huang Shijie
2012-12-04 14:40 ` Zach Sadecki
2012-12-10 13:44 ` Artem Bityutskiy
1 sibling, 1 reply; 17+ messages in thread
From: Huang Shijie @ 2012-12-04 3:34 UTC (permalink / raw)
To: Zach Sadecki; +Cc: linux-mtd, dedekind1@gmail.com
于 2012年12月04日 03:48, Zach Sadecki 写道:
> Always report corrected and failed ECC stats back up to the MTD layer.
> Also
> return max_bitflips from read_page() as is expected from NAND drivers
> now.
>
> Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
> ---
> drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 ++++++++-------------------
> 1 file changed, 8 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index d79696b..fe10c53 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -914,8 +914,7 @@ static int gpmi_ecc_read_page(struct mtd_info
> *mtd, struct nand_chip *chip,
> dma_addr_t auxiliary_phys;
> unsigned int i;
> unsigned char *status;
> - unsigned int failed;
> - unsigned int corrected;
> + unsigned int max_bitflips = 0;
> int ret;
> pr_debug("page number is : %d\n", page);
> @@ -939,35 +938,25 @@ static int gpmi_ecc_read_page(struct mtd_info
> *mtd, struct nand_chip *chip,
> payload_virt, payload_phys);
> if (ret) {
> pr_err("Error in ECC-based read: %d\n", ret);
> - goto exit_nfc;
> + return ret;
> }
> /* handle the block mark swapping */
> block_mark_swapping(this, payload_virt, auxiliary_virt);
> /* Loop over status bytes, accumulating ECC status. */
> - failed = 0;
> - corrected = 0;
> - status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
> + status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
> for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
> if ((*status == STATUS_GOOD) || (*status == STATUS_ERASED))
> continue;
> if (*status == STATUS_UNCORRECTABLE) {
> - failed++;
> + mtd->ecc_stats.failed++;
> continue;
> }
> - corrected += *status;
> - }
> -
> - /*
> - * Propagate ECC status to the owning MTD only when failed or
> - * corrected times nearly reaches our ECC correction threshold.
> - */
> - if (failed || corrected >= (nfc_geo->ecc_strength - 1)) {
> - mtd->ecc_stats.failed += failed;
> - mtd->ecc_stats.corrected += corrected;
> + mtd->ecc_stats.corrected += *status;
> + max_bitflips = max_t(unsigned int, max_bitflips, *status);
Does the max_bitflips stand for the whole page's bitfips ? or just the
bitfips of one part of the page?
The gpmi driver splits a page into several parts when it does the ECC.
thanks
Huang Shijie
> }
> if (oob_required) {
> @@ -989,8 +978,8 @@ static int gpmi_ecc_read_page(struct mtd_info
> *mtd, struct nand_chip *chip,
> this->payload_virt, this->payload_phys,
> nfc_geo->payload_size,
> payload_virt, payload_phys);
> -exit_nfc:
> - return ret;
> +
> + return max_bitflips;
> }
> static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip
> *chip,
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-04 3:34 ` Huang Shijie
@ 2012-12-04 14:40 ` Zach Sadecki
2012-12-05 3:04 ` Huang Shijie
0 siblings, 1 reply; 17+ messages in thread
From: Zach Sadecki @ 2012-12-04 14:40 UTC (permalink / raw)
To: Huang Shijie; +Cc: linux-mtd, dedekind1@gmail.com
On 12/03/2012 09:34 PM, Huang Shijie wrote:
> 于 2012年12月04日 03:48, Zach Sadecki 写道:
>> Always report corrected and failed ECC stats back up to the MTD
>> layer. Also
>> return max_bitflips from read_page() as is expected from NAND drivers
>> now.
>>
>> Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
>> ---
>> drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 ++++++++-------------------
>> 1 file changed, 8 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
>> b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
>> index d79696b..fe10c53 100644
>> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
>> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
>> @@ -914,8 +914,7 @@ static int gpmi_ecc_read_page(struct mtd_info
>> *mtd, struct nand_chip *chip,
>> dma_addr_t auxiliary_phys;
>> unsigned int i;
>> unsigned char *status;
>> - unsigned int failed;
>> - unsigned int corrected;
>> + unsigned int max_bitflips = 0;
>> int ret;
>> pr_debug("page number is : %d\n", page);
>> @@ -939,35 +938,25 @@ static int gpmi_ecc_read_page(struct mtd_info
>> *mtd, struct nand_chip *chip,
>> payload_virt, payload_phys);
>> if (ret) {
>> pr_err("Error in ECC-based read: %d\n", ret);
>> - goto exit_nfc;
>> + return ret;
>> }
>> /* handle the block mark swapping */
>> block_mark_swapping(this, payload_virt, auxiliary_virt);
>> /* Loop over status bytes, accumulating ECC status. */
>> - failed = 0;
>> - corrected = 0;
>> - status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
>> + status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
>> for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
>> if ((*status == STATUS_GOOD) || (*status == STATUS_ERASED))
>> continue;
>> if (*status == STATUS_UNCORRECTABLE) {
>> - failed++;
>> + mtd->ecc_stats.failed++;
>> continue;
>> }
>> - corrected += *status;
>> - }
>> -
>> - /*
>> - * Propagate ECC status to the owning MTD only when failed or
>> - * corrected times nearly reaches our ECC correction threshold.
>> - */
>> - if (failed || corrected >= (nfc_geo->ecc_strength - 1)) {
>> - mtd->ecc_stats.failed += failed;
>> - mtd->ecc_stats.corrected += corrected;
>> + mtd->ecc_stats.corrected += *status;
>> + max_bitflips = max_t(unsigned int, max_bitflips, *status);
>
> Does the max_bitflips stand for the whole page's bitfips ? or just the
> bitfips of one part of the page?
> The gpmi driver splits a page into several parts when it does the ECC.
>
> thanks
> Huang Shijie
>
max_bitflips represents the maximum number of bitflips per ECC corrected
region in a page. The MTD layer needs it to compare to
bitflip_threshold to know when to return -EUCLEAN to upper layers (like
UBI) so a nearly corrupt page can be copied elsewhere. This is pretty
much identical to the way other drivers do this as I copied it from
those. Here's where it was added in the other drivers:
http://git.infradead.org/linux-mtd.git/commit/3f91e94f7f511de74c0d2abe08672ccdbdd1961c
Zach
>
>> }
>> if (oob_required) {
>> @@ -989,8 +978,8 @@ static int gpmi_ecc_read_page(struct mtd_info
>> *mtd, struct nand_chip *chip,
>> this->payload_virt, this->payload_phys,
>> nfc_geo->payload_size,
>> payload_virt, payload_phys);
>> -exit_nfc:
>> - return ret;
>> +
>> + return max_bitflips;
>> }
>> static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip
>> *chip,
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-04 14:40 ` Zach Sadecki
@ 2012-12-05 3:04 ` Huang Shijie
0 siblings, 0 replies; 17+ messages in thread
From: Huang Shijie @ 2012-12-05 3:04 UTC (permalink / raw)
To: Zach Sadecki; +Cc: linux-mtd, dedekind1@gmail.com
于 2012年12月04日 22:40, Zach Sadecki 写道:
> max_bitflips represents the maximum number of bitflips per ECC
> corrected region in a page.
got it.
I also tested this patch in the mx6q-arm2 board. it runned well.
thanks.
Acked-by: Huang Shijie <b32955@freescale.com>
Huang Shijie
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-03 19:48 [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips Zach Sadecki
2012-12-04 3:34 ` Huang Shijie
@ 2012-12-10 13:44 ` Artem Bityutskiy
2012-12-10 15:10 ` Zach Sadecki
2012-12-10 15:18 ` Zach Sadecki
1 sibling, 2 replies; 17+ messages in thread
From: Artem Bityutskiy @ 2012-12-10 13:44 UTC (permalink / raw)
To: Zach Sadecki; +Cc: linux-mtd
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
On Mon, 2012-12-03 at 13:48 -0600, Zach Sadecki wrote:
> Always report corrected and failed ECC stats back up to the MTD layer. Also
> return max_bitflips from read_page() as is expected from NAND drivers now.
>
> Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
Could you please send a version which applies cleanly to the l2-mtd.git
tree? Thanks!
git://git.infradead.org/users/dedekind/l2-mtd.git
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-10 13:44 ` Artem Bityutskiy
@ 2012-12-10 15:10 ` Zach Sadecki
2012-12-10 15:18 ` Zach Sadecki
1 sibling, 0 replies; 17+ messages in thread
From: Zach Sadecki @ 2012-12-10 15:10 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
Always report corrected and failed ECC stats back up to the MTD layer. Also
return max_bitflips from read_page() as is expected from NAND drivers now.
Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
Acked-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 5cd141f..1535bd5 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -921,8 +921,7 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd,
struct nand_chip *chip,
dma_addr_t auxiliary_phys;
unsigned int i;
unsigned char *status;
- unsigned int failed;
- unsigned int corrected;
+ unsigned int max_bitflips = 0;
int ret;
pr_debug("page number is : %d\n", page);
@@ -946,35 +945,25 @@ static int gpmi_ecc_read_page(struct mtd_info
*mtd, struct nand_chip *chip,
payload_virt, payload_phys);
if (ret) {
pr_err("Error in ECC-based read: %d\n", ret);
- goto exit_nfc;
+ return ret;
}
/* handle the block mark swapping */
block_mark_swapping(this, payload_virt, auxiliary_virt);
/* Loop over status bytes, accumulating ECC status. */
- failed = 0;
- corrected = 0;
- status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
+ status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
if ((*status == STATUS_GOOD) || (*status == STATUS_ERASED))
continue;
if (*status == STATUS_UNCORRECTABLE) {
- failed++;
+ mtd->ecc_stats.failed++;
continue;
}
- corrected += *status;
- }
-
- /*
- * Propagate ECC status to the owning MTD only when failed or
- * corrected times nearly reaches our ECC correction threshold.
- */
- if (failed || corrected >= (nfc_geo->ecc_strength - 1)) {
- mtd->ecc_stats.failed += failed;
- mtd->ecc_stats.corrected += corrected;
+ mtd->ecc_stats.corrected += *status;
+ max_bitflips = max_t(unsigned int, max_bitflips, *status);
}
if (oob_required) {
@@ -996,8 +985,8 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd,
struct nand_chip *chip,
this->payload_virt, this->payload_phys,
nfc_geo->payload_size,
payload_virt, payload_phys);
-exit_nfc:
- return ret;
+
+ return max_bitflips;
}
static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip
*chip,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-10 13:44 ` Artem Bityutskiy
2012-12-10 15:10 ` Zach Sadecki
@ 2012-12-10 15:18 ` Zach Sadecki
2012-12-12 15:17 ` Artem Bityutskiy
2012-12-13 11:27 ` Artem Bityutskiy
1 sibling, 2 replies; 17+ messages in thread
From: Zach Sadecki @ 2012-12-10 15:18 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
Always report corrected and failed ECC stats back up to the MTD layer. Also
return max_bitflips from read_page() as is expected from NAND drivers now.
Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
Acked-by: Huang Shijie <b32955 at freescale.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 5cd141f..1535bd5 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -921,8 +921,7 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
dma_addr_t auxiliary_phys;
unsigned int i;
unsigned char *status;
- unsigned int failed;
- unsigned int corrected;
+ unsigned int max_bitflips = 0;
int ret;
pr_debug("page number is : %d\n", page);
@@ -946,35 +945,25 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
payload_virt, payload_phys);
if (ret) {
pr_err("Error in ECC-based read: %d\n", ret);
- goto exit_nfc;
+ return ret;
}
/* handle the block mark swapping */
block_mark_swapping(this, payload_virt, auxiliary_virt);
/* Loop over status bytes, accumulating ECC status. */
- failed = 0;
- corrected = 0;
- status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
+ status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
if ((*status == STATUS_GOOD) || (*status == STATUS_ERASED))
continue;
if (*status == STATUS_UNCORRECTABLE) {
- failed++;
+ mtd->ecc_stats.failed++;
continue;
}
- corrected += *status;
- }
-
- /*
- * Propagate ECC status to the owning MTD only when failed or
- * corrected times nearly reaches our ECC correction threshold.
- */
- if (failed || corrected >= (nfc_geo->ecc_strength - 1)) {
- mtd->ecc_stats.failed += failed;
- mtd->ecc_stats.corrected += corrected;
+ mtd->ecc_stats.corrected += *status;
+ max_bitflips = max_t(unsigned int, max_bitflips, *status);
}
if (oob_required) {
@@ -996,8 +985,8 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
this->payload_virt, this->payload_phys,
nfc_geo->payload_size,
payload_virt, payload_phys);
-exit_nfc:
- return ret;
+
+ return max_bitflips;
}
static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-10 15:18 ` Zach Sadecki
@ 2012-12-12 15:17 ` Artem Bityutskiy
2012-12-12 16:57 ` Zach Sadecki
2012-12-13 11:27 ` Artem Bityutskiy
1 sibling, 1 reply; 17+ messages in thread
From: Artem Bityutskiy @ 2012-12-12 15:17 UTC (permalink / raw)
To: Zach Sadecki; +Cc: linux-mtd
[-- Attachment #1: Type: text/plain, Size: 730 bytes --]
On Mon, 2012-12-10 at 09:18 -0600, Zach Sadecki wrote:
> Always report corrected and failed ECC stats back up to the MTD layer. Also
> return max_bitflips from read_page() as is expected from NAND drivers now.
>
> Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
> Acked-by: Huang Shijie <b32955 at freescale.com>
> ---
> drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 ++++++++-------------------
> 1 file changed, 8 insertions(+), 19 deletions(-)
patching file drivers/mtd/nand/gpmi-nand/gpmi-nand.c
Hunk #1 FAILED at 921.
Hunk #2 FAILED at 946.
Hunk #3 FAILED at 996.
3 out of 3 hunks FAILED -- saving rejects to file drivers/mtd/nand/gpmi-nand/gpmi-nand.c.rej
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-12 15:17 ` Artem Bityutskiy
@ 2012-12-12 16:57 ` Zach Sadecki
0 siblings, 0 replies; 17+ messages in thread
From: Zach Sadecki @ 2012-12-12 16:57 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
On 12/12/2012 09:17 AM, Artem Bityutskiy wrote:
> patching file drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> Hunk #1 FAILED at 921.
> Hunk #2 FAILED at 946.
> Hunk #3 FAILED at 996.
> 3 out of 3 hunks FAILED -- saving rejects to file drivers/mtd/nand/gpmi-nand/gpmi-nand.c.rej
>
Odd. I used git format-patch on a freshly cloned l2-mtd repo... I
don't know what could be wrong. I did a fresh pull, and another git
format-patch and it generated the exact same patch file. Any ideas?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-10 15:18 ` Zach Sadecki
2012-12-12 15:17 ` Artem Bityutskiy
@ 2012-12-13 11:27 ` Artem Bityutskiy
2012-12-14 2:36 ` Zach Sadecki
` (2 more replies)
1 sibling, 3 replies; 17+ messages in thread
From: Artem Bityutskiy @ 2012-12-13 11:27 UTC (permalink / raw)
To: Zach Sadecki; +Cc: linux-mtd
[-- Attachment #1.1: Type: text/plain, Size: 802 bytes --]
On Mon, 2012-12-10 at 09:18 -0600, Zach Sadecki wrote:
> Always report corrected and failed ECC stats back up to the MTD layer. Also
> return max_bitflips from read_page() as is expected from NAND drivers now.
>
> Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
> Acked-by: Huang Shijie <b32955 at freescale.com>
> ---
Dunno, may be your patch is corrupted or something. Try to save it and
apply. This is what I get:
$ git apply --check ~/tmp/zach.mbox
error: patch failed: drivers/mtd/nand/gpmi-nand/gpmi-nand.c:921
error: drivers/mtd/nand/gpmi-nand/gpmi-nand.c: patch does not apply
$ git log -1 --oneline
70df8b3 mtd: nand: gpmi: reset BCH earlier, too, to avoid NAND startup problems
I've attached the zach.mbox file for you.
--
Best Regards,
Artem Bityutskiy
[-- Attachment #1.2: zach.mbox.gz --]
[-- Type: application/x-gzip, Size: 1814 bytes --]
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-13 11:27 ` Artem Bityutskiy
@ 2012-12-14 2:36 ` Zach Sadecki
2012-12-14 2:36 ` Zach Sadecki
2012-12-14 2:39 ` Zach Sadecki
2 siblings, 0 replies; 17+ messages in thread
From: Zach Sadecki @ 2012-12-14 2:36 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
Always report corrected and failed ECC stats back up to the MTD layer. Also
return max_bitflips from read_page() as is expected from NAND drivers now.
Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
Acked-by: Huang Shijie <b32955 at freescale.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 5cd141f..1535bd5 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -921,8 +921,7 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
dma_addr_t auxiliary_phys;
unsigned int i;
unsigned char *status;
- unsigned int failed;
- unsigned int corrected;
+ unsigned int max_bitflips = 0;
int ret;
pr_debug("page number is : %d\n", page);
@@ -946,35 +945,25 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
payload_virt, payload_phys);
if (ret) {
pr_err("Error in ECC-based read: %d\n", ret);
- goto exit_nfc;
+ return ret;
}
/* handle the block mark swapping */
block_mark_swapping(this, payload_virt, auxiliary_virt);
/* Loop over status bytes, accumulating ECC status. */
- failed = 0;
- corrected = 0;
- status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
+ status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
if ((*status == STATUS_GOOD) || (*status == STATUS_ERASED))
continue;
if (*status == STATUS_UNCORRECTABLE) {
- failed++;
+ mtd->ecc_stats.failed++;
continue;
}
- corrected += *status;
- }
-
- /*
- * Propagate ECC status to the owning MTD only when failed or
- * corrected times nearly reaches our ECC correction threshold.
- */
- if (failed || corrected >= (nfc_geo->ecc_strength - 1)) {
- mtd->ecc_stats.failed += failed;
- mtd->ecc_stats.corrected += corrected;
+ mtd->ecc_stats.corrected += *status;
+ max_bitflips = max_t(unsigned int, max_bitflips, *status);
}
if (oob_required) {
@@ -996,8 +985,8 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
this->payload_virt, this->payload_phys,
nfc_geo->payload_size,
payload_virt, payload_phys);
-exit_nfc:
- return ret;
+
+ return max_bitflips;
}
static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-13 11:27 ` Artem Bityutskiy
2012-12-14 2:36 ` Zach Sadecki
@ 2012-12-14 2:36 ` Zach Sadecki
2013-01-10 3:01 ` Huang Shijie
2013-01-15 9:30 ` Artem Bityutskiy
2012-12-14 2:39 ` Zach Sadecki
2 siblings, 2 replies; 17+ messages in thread
From: Zach Sadecki @ 2012-12-14 2:36 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
Always report corrected and failed ECC stats back up to the MTD layer. Also
return max_bitflips from read_page() as is expected from NAND drivers now.
Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
Acked-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 5cd141f..1535bd5 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -921,8 +921,7 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
dma_addr_t auxiliary_phys;
unsigned int i;
unsigned char *status;
- unsigned int failed;
- unsigned int corrected;
+ unsigned int max_bitflips = 0;
int ret;
pr_debug("page number is : %d\n", page);
@@ -946,35 +945,25 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
payload_virt, payload_phys);
if (ret) {
pr_err("Error in ECC-based read: %d\n", ret);
- goto exit_nfc;
+ return ret;
}
/* handle the block mark swapping */
block_mark_swapping(this, payload_virt, auxiliary_virt);
/* Loop over status bytes, accumulating ECC status. */
- failed = 0;
- corrected = 0;
- status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
+ status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
if ((*status == STATUS_GOOD) || (*status == STATUS_ERASED))
continue;
if (*status == STATUS_UNCORRECTABLE) {
- failed++;
+ mtd->ecc_stats.failed++;
continue;
}
- corrected += *status;
- }
-
- /*
- * Propagate ECC status to the owning MTD only when failed or
- * corrected times nearly reaches our ECC correction threshold.
- */
- if (failed || corrected >= (nfc_geo->ecc_strength - 1)) {
- mtd->ecc_stats.failed += failed;
- mtd->ecc_stats.corrected += corrected;
+ mtd->ecc_stats.corrected += *status;
+ max_bitflips = max_t(unsigned int, max_bitflips, *status);
}
if (oob_required) {
@@ -996,8 +985,8 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
this->payload_virt, this->payload_phys,
nfc_geo->payload_size,
payload_virt, payload_phys);
-exit_nfc:
- return ret;
+
+ return max_bitflips;
}
static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-13 11:27 ` Artem Bityutskiy
2012-12-14 2:36 ` Zach Sadecki
2012-12-14 2:36 ` Zach Sadecki
@ 2012-12-14 2:39 ` Zach Sadecki
2013-01-10 3:28 ` Huang Shijie
2 siblings, 1 reply; 17+ messages in thread
From: Zach Sadecki @ 2012-12-14 2:39 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
On 12/13/2012 05:27 AM, Artem Bityutskiy wrote:
> On Mon, 2012-12-10 at 09:18 -0600, Zach Sadecki wrote:
>> Always report corrected and failed ECC stats back up to the MTD layer. Also
>> return max_bitflips from read_page() as is expected from NAND drivers now.
>>
>> Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
>> Acked-by: Huang Shijie <b32955 at freescale.com>
>> ---
> Dunno, may be your patch is corrupted or something. Try to save it and
> apply. This is what I get:
>
> $ git apply --check ~/tmp/zach.mbox
> error: patch failed: drivers/mtd/nand/gpmi-nand/gpmi-nand.c:921
> error: drivers/mtd/nand/gpmi-nand/gpmi-nand.c: patch does not apply
>
> $ git log -1 --oneline
> 70df8b3 mtd: nand: gpmi: reset BCH earlier, too, to avoid NAND startup problems
>
> I've attached the zach.mbox file for you.
>
OK. I rebased the patch on the latest l2-mtd and I tested it with git
apply, so this one should work...
Sent as a separate reply with only the patch in it.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-14 2:36 ` Zach Sadecki
@ 2013-01-10 3:01 ` Huang Shijie
2013-01-15 9:30 ` Artem Bityutskiy
1 sibling, 0 replies; 17+ messages in thread
From: Huang Shijie @ 2013-01-10 3:01 UTC (permalink / raw)
To: Zach Sadecki; +Cc: linux-mtd, dedekind1
于 2012年12月14日 10:36, Zach Sadecki 写道:
> Always report corrected and failed ECC stats back up to the MTD layer.
> Also
> return max_bitflips from read_page() as is expected from NAND drivers
> now.
>
> Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
> Acked-by: Huang Shijie <b32955@freescale.com>
> ---
> drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 ++++++++-------------------
> 1 file changed, 8 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 5cd141f..1535bd5 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -921,8 +921,7 @@ static int gpmi_ecc_read_page(struct mtd_info
> *mtd, struct nand_chip *chip,
> dma_addr_t auxiliary_phys;
> unsigned int i;
> unsigned char *status;
> - unsigned int failed;
> - unsigned int corrected;
> + unsigned int max_bitflips = 0;
> int ret;
>
> pr_debug("page number is : %d\n", page);
> @@ -946,35 +945,25 @@ static int gpmi_ecc_read_page(struct mtd_info
> *mtd, struct nand_chip *chip,
> payload_virt, payload_phys);
> if (ret) {
> pr_err("Error in ECC-based read: %d\n", ret);
> - goto exit_nfc;
> + return ret;
> }
>
> /* handle the block mark swapping */
> block_mark_swapping(this, payload_virt, auxiliary_virt);
>
> /* Loop over status bytes, accumulating ECC status. */
> - failed = 0;
> - corrected = 0;
> - status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
> + status = auxiliary_virt + nfc_geo->auxiliary_status_offset;
>
> for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
> if ((*status == STATUS_GOOD) || (*status == STATUS_ERASED))
> continue;
>
> if (*status == STATUS_UNCORRECTABLE) {
> - failed++;
> + mtd->ecc_stats.failed++;
> continue;
> }
> - corrected += *status;
> - }
> -
> - /*
> - * Propagate ECC status to the owning MTD only when failed or
> - * corrected times nearly reaches our ECC correction threshold.
> - */
> - if (failed || corrected >= (nfc_geo->ecc_strength - 1)) {
> - mtd->ecc_stats.failed += failed;
> - mtd->ecc_stats.corrected += corrected;
> + mtd->ecc_stats.corrected += *status;
> + max_bitflips = max_t(unsigned int, max_bitflips, *status);
> }
>
> if (oob_required) {
> @@ -996,8 +985,8 @@ static int gpmi_ecc_read_page(struct mtd_info
> *mtd, struct nand_chip *chip,
> this->payload_virt, this->payload_phys,
> nfc_geo->payload_size,
> payload_virt, payload_phys);
> -exit_nfc:
> - return ret;
> +
> + return max_bitflips;
> }
>
> static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip
> *chip,
just a ping.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-14 2:39 ` Zach Sadecki
@ 2013-01-10 3:28 ` Huang Shijie
2013-01-10 15:40 ` Zach Sadecki
0 siblings, 1 reply; 17+ messages in thread
From: Huang Shijie @ 2013-01-10 3:28 UTC (permalink / raw)
To: Zach Sadecki; +Cc: linux-mtd, dedekind1
于 2012年12月14日 10:39, Zach Sadecki 写道:
> On 12/13/2012 05:27 AM, Artem Bityutskiy wrote:
>> On Mon, 2012-12-10 at 09:18 -0600, Zach Sadecki wrote:
>>> Always report corrected and failed ECC stats back up to the MTD
>>> layer. Also
>>> return max_bitflips from read_page() as is expected from NAND
>>> drivers now.
>>>
>>> Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
>>> Acked-by: Huang Shijie <b32955 at freescale.com>
>>> ---
>> Dunno, may be your patch is corrupted or something. Try to save it and
>> apply. This is what I get:
>>
>> $ git apply --check ~/tmp/zach.mbox
>> error: patch failed: drivers/mtd/nand/gpmi-nand/gpmi-nand.c:921
>> error: drivers/mtd/nand/gpmi-nand/gpmi-nand.c: patch does not apply
>>
>> $ git log -1 --oneline
>> 70df8b3 mtd: nand: gpmi: reset BCH earlier, too, to avoid NAND
>> startup problems
>>
>> I've attached the zach.mbox file for you.
>>
> OK. I rebased the patch on the latest l2-mtd and I tested it with git
> apply, so this one should work...
>
> Sent as a separate reply with only the patch in it.
Dear Zach,
I think you'd better check the patch with /scripts/checkpatch.pl before
you send out the patch.
I saw many "trailing whitespace" in your patch.
thanks.
Huang Shijie
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2013-01-10 3:28 ` Huang Shijie
@ 2013-01-10 15:40 ` Zach Sadecki
0 siblings, 0 replies; 17+ messages in thread
From: Zach Sadecki @ 2013-01-10 15:40 UTC (permalink / raw)
To: Huang Shijie; +Cc: linux-mtd, dedekind1
On 01/09/2013 09:28 PM, Huang Shijie wrote:
> Dear Zach,
> I think you'd better check the patch with /scripts/checkpatch.pl
> before you send out the patch.
> I saw many "trailing whitespace" in your patch.
>
> thanks.
>
> Huang Shijie
I just checked it:
zach@zpc:~/git/l2-mtd$ scripts/checkpatch.pl
0001-mtd-gpmi-Always-report-ECC-stats-and-return-max_bitf.patch
total: 0 errors, 0 warnings, 59 lines checked
0001-mtd-gpmi-Always-report-ECC-stats-and-return-max_bitf.patch has no
obvious style problems and is ready for submission.
---
The reply to the original thread dated "Thu Dec 13 21:36:43 EST 2012"
should be the correct patch...
Zach
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips
2012-12-14 2:36 ` Zach Sadecki
2013-01-10 3:01 ` Huang Shijie
@ 2013-01-15 9:30 ` Artem Bityutskiy
1 sibling, 0 replies; 17+ messages in thread
From: Artem Bityutskiy @ 2013-01-15 9:30 UTC (permalink / raw)
To: Zach Sadecki; +Cc: linux-mtd
[-- Attachment #1: Type: text/plain, Size: 398 bytes --]
On Thu, 2012-12-13 at 20:36 -0600, Zach Sadecki wrote:
> Always report corrected and failed ECC stats back up to the MTD layer. Also
> return max_bitflips from read_page() as is expected from NAND drivers now.
>
> Signed-off-by: Zach Sadecki <zsadecki@itwatchdogs.com>
> Acked-by: Huang Shijie <b32955@freescale.com>
Pushed to l2-mtd.git, thanks!
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2013-01-15 9:28 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-03 19:48 [PATCH] mtd: gpmi: Always report ECC stats and return max_bitflips Zach Sadecki
2012-12-04 3:34 ` Huang Shijie
2012-12-04 14:40 ` Zach Sadecki
2012-12-05 3:04 ` Huang Shijie
2012-12-10 13:44 ` Artem Bityutskiy
2012-12-10 15:10 ` Zach Sadecki
2012-12-10 15:18 ` Zach Sadecki
2012-12-12 15:17 ` Artem Bityutskiy
2012-12-12 16:57 ` Zach Sadecki
2012-12-13 11:27 ` Artem Bityutskiy
2012-12-14 2:36 ` Zach Sadecki
2012-12-14 2:36 ` Zach Sadecki
2013-01-10 3:01 ` Huang Shijie
2013-01-15 9:30 ` Artem Bityutskiy
2012-12-14 2:39 ` Zach Sadecki
2013-01-10 3:28 ` Huang Shijie
2013-01-10 15:40 ` Zach Sadecki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox