All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [MTD] [NAND] pxa3xx_nand: add single-bit error corrections reporting
@ 2009-07-01 15:11 Mike Rapoport
  2009-07-13  9:15 ` Mike Rapoport
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Rapoport @ 2009-07-01 15:11 UTC (permalink / raw)
  To: dwmw2; +Cc: linux-mtd, Yeasah Pell, eric.y.miao

From: Yeasah Pell <yeasah@comrex.com>

Signed-off-by: Yeasah Pell <yeasah@comrex.com>
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
---
 drivers/mtd/nand/pxa3xx_nand.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 30a8ce6..6ea520a 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -102,6 +102,7 @@ enum {
 	ERR_SENDCMD	= -2,
 	ERR_DBERR	= -3,
 	ERR_BBERR	= -4,
+	ERR_SBERR	= -5,
 };
 
 enum {
@@ -564,11 +565,13 @@ static irqreturn_t pxa3xx_nand_irq(int irq, void *devid)
 
 	status = nand_readl(info, NDSR);
 
-	if (status & (NDSR_RDDREQ | NDSR_DBERR)) {
+	if (status & (NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR)) {
 		if (status & NDSR_DBERR)
 			info->retcode = ERR_DBERR;
+		else if (status & NDSR_SBERR)
+			info->retcode = ERR_SBERR;
 
-		disable_int(info, NDSR_RDDREQ | NDSR_DBERR);
+		disable_int(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
 
 		if (info->use_dma) {
 			info->state = STATE_DMA_READING;
@@ -670,7 +673,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
 		if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr))
 			break;
 
-		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR);
+		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
 
 		/* We only are OOB, so if the data has error, does not matter */
 		if (info->retcode == ERR_DBERR)
@@ -687,7 +690,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
 		if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr))
 			break;
 
-		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR);
+		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
 
 		if (info->retcode == ERR_DBERR) {
 			/* for blank page (all 0xff), HW will calculate its ECC as
@@ -861,8 +864,12 @@ static int pxa3xx_nand_ecc_correct(struct mtd_info *mtd,
 	 * consider it as a ecc error which will tell the caller the
 	 * read fail We have distinguish all the errors, but the
 	 * nand_read_ecc only check this function return value
+	 *
+	 * Corrected (single-bit) errors must also be noted.
 	 */
-	if (info->retcode != ERR_NONE)
+	if (info->retcode == ERR_SBERR)
+		return 1;
+	else if (info->retcode != ERR_NONE)
 		return -1;
 
 	return 0;
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] [MTD] [NAND] pxa3xx_nand: add single-bit error corrections reporting
  2009-07-01 15:11 [PATCH] [MTD] [NAND] pxa3xx_nand: add single-bit error corrections reporting Mike Rapoport
@ 2009-07-13  9:15 ` Mike Rapoport
  2009-07-13  9:48   ` Eric Miao
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Rapoport @ 2009-07-13  9:15 UTC (permalink / raw)
  To: dwmw2, eric.y.miao; +Cc: Yeasah Pell, linux-mtd

David, Eric
Any update on this?

Mike Rapoport wrote:
> From: Yeasah Pell <yeasah@comrex.com>
> 
> Signed-off-by: Yeasah Pell <yeasah@comrex.com>
> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
> ---
>  drivers/mtd/nand/pxa3xx_nand.c |   17 ++++++++++++-----
>  1 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> index 30a8ce6..6ea520a 100644
> --- a/drivers/mtd/nand/pxa3xx_nand.c
> +++ b/drivers/mtd/nand/pxa3xx_nand.c
> @@ -102,6 +102,7 @@ enum {
>  	ERR_SENDCMD	= -2,
>  	ERR_DBERR	= -3,
>  	ERR_BBERR	= -4,
> +	ERR_SBERR	= -5,
>  };
>  
>  enum {
> @@ -564,11 +565,13 @@ static irqreturn_t pxa3xx_nand_irq(int irq, void *devid)
>  
>  	status = nand_readl(info, NDSR);
>  
> -	if (status & (NDSR_RDDREQ | NDSR_DBERR)) {
> +	if (status & (NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR)) {
>  		if (status & NDSR_DBERR)
>  			info->retcode = ERR_DBERR;
> +		else if (status & NDSR_SBERR)
> +			info->retcode = ERR_SBERR;
>  
> -		disable_int(info, NDSR_RDDREQ | NDSR_DBERR);
> +		disable_int(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
>  
>  		if (info->use_dma) {
>  			info->state = STATE_DMA_READING;
> @@ -670,7 +673,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
>  		if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr))
>  			break;
>  
> -		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR);
> +		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
>  
>  		/* We only are OOB, so if the data has error, does not matter */
>  		if (info->retcode == ERR_DBERR)
> @@ -687,7 +690,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
>  		if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr))
>  			break;
>  
> -		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR);
> +		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
>  
>  		if (info->retcode == ERR_DBERR) {
>  			/* for blank page (all 0xff), HW will calculate its ECC as
> @@ -861,8 +864,12 @@ static int pxa3xx_nand_ecc_correct(struct mtd_info *mtd,
>  	 * consider it as a ecc error which will tell the caller the
>  	 * read fail We have distinguish all the errors, but the
>  	 * nand_read_ecc only check this function return value
> +	 *
> +	 * Corrected (single-bit) errors must also be noted.
>  	 */
> -	if (info->retcode != ERR_NONE)
> +	if (info->retcode == ERR_SBERR)
> +		return 1;
> +	else if (info->retcode != ERR_NONE)
>  		return -1;
>  
>  	return 0;

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [MTD] [NAND] pxa3xx_nand: add single-bit error corrections reporting
  2009-07-13  9:15 ` Mike Rapoport
@ 2009-07-13  9:48   ` Eric Miao
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Miao @ 2009-07-13  9:48 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: linux-mtd, Yeasah Pell, dwmw2

Mike Rapoport wrote:
> David, Eric
> Any update on this?
> 

Yep, looks fine to me.

Acked-by: Eric Miao <eric.y.miao@gmail.com>

David,

Could you please help merge this? Or I'll get this upstreamed via the
arm tree if it saves trouble.

> Mike Rapoport wrote:
>> From: Yeasah Pell <yeasah@comrex.com>
>>
>> Signed-off-by: Yeasah Pell <yeasah@comrex.com>
>> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
>> ---
>>  drivers/mtd/nand/pxa3xx_nand.c |   17 ++++++++++++-----
>>  1 files changed, 12 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
>> index 30a8ce6..6ea520a 100644
>> --- a/drivers/mtd/nand/pxa3xx_nand.c
>> +++ b/drivers/mtd/nand/pxa3xx_nand.c
>> @@ -102,6 +102,7 @@ enum {
>>  	ERR_SENDCMD	= -2,
>>  	ERR_DBERR	= -3,
>>  	ERR_BBERR	= -4,
>> +	ERR_SBERR	= -5,
>>  };
>>  
>>  enum {
>> @@ -564,11 +565,13 @@ static irqreturn_t pxa3xx_nand_irq(int irq, void *devid)
>>  
>>  	status = nand_readl(info, NDSR);
>>  
>> -	if (status & (NDSR_RDDREQ | NDSR_DBERR)) {
>> +	if (status & (NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR)) {
>>  		if (status & NDSR_DBERR)
>>  			info->retcode = ERR_DBERR;
>> +		else if (status & NDSR_SBERR)
>> +			info->retcode = ERR_SBERR;
>>  
>> -		disable_int(info, NDSR_RDDREQ | NDSR_DBERR);
>> +		disable_int(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
>>  
>>  		if (info->use_dma) {
>>  			info->state = STATE_DMA_READING;
>> @@ -670,7 +673,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
>>  		if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr))
>>  			break;
>>  
>> -		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR);
>> +		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
>>  
>>  		/* We only are OOB, so if the data has error, does not matter */
>>  		if (info->retcode == ERR_DBERR)
>> @@ -687,7 +690,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
>>  		if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr))
>>  			break;
>>  
>> -		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR);
>> +		pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
>>  
>>  		if (info->retcode == ERR_DBERR) {
>>  			/* for blank page (all 0xff), HW will calculate its ECC as
>> @@ -861,8 +864,12 @@ static int pxa3xx_nand_ecc_correct(struct mtd_info *mtd,
>>  	 * consider it as a ecc error which will tell the caller the
>>  	 * read fail We have distinguish all the errors, but the
>>  	 * nand_read_ecc only check this function return value
>> +	 *
>> +	 * Corrected (single-bit) errors must also be noted.
>>  	 */
>> -	if (info->retcode != ERR_NONE)
>> +	if (info->retcode == ERR_SBERR)
>> +		return 1;
>> +	else if (info->retcode != ERR_NONE)
>>  		return -1;
>>  
>>  	return 0;
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-13 10:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-01 15:11 [PATCH] [MTD] [NAND] pxa3xx_nand: add single-bit error corrections reporting Mike Rapoport
2009-07-13  9:15 ` Mike Rapoport
2009-07-13  9:48   ` Eric Miao

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.