Patchwork [U-Boot] nand/mxc: set host->page_addr for NAND_CMD_READOOB

login
register
mail settings
Submitter Scott Wood
Date Jan. 31, 2013, 7:47 p.m.
Message ID <20130131194755.GA6926@home.buserror.net>
Download mbox | patch
Permalink /patch/217248/
State Superseded
Delegated to: Scott Wood
Headers show

Comments

Scott Wood - Jan. 31, 2013, 7:47 p.m.
Without this, all OOB reads are from the last page normally read
(or zero at boot).  This results in bad block scans failing to look
in the right place, and so no bad blocks are found.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
From IRC discussion with a2cypher.  Compile-tested only; testing
would be appreciated.

 drivers/mtd/nand/mxc_nand.c |    1 +
 1 file changed, 1 insertion(+)
Benoît Thébaudeau - Jan. 31, 2013, 8:45 p.m.
Hi Scott,

On Thursday, January 31, 2013 8:47:55 PM, Scott Wood wrote:
> Without this, all OOB reads are from the last page normally read
> (or zero at boot).  This results in bad block scans failing to look
> in the right place, and so no bad blocks are found.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> From IRC discussion with a2cypher.  Compile-tested only; testing
> would be appreciated.
> 
>  drivers/mtd/nand/mxc_nand.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index d0ded48..32ba340 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -1021,6 +1021,7 @@ void mxc_nand_command(struct mtd_info *mtd, unsigned
> command,
>  		break;
>  
>  	case NAND_CMD_READOOB:
> +		host->page_addr = page_addr;
>  		host->col_addr = column;
>  		host->spare_only = true;
>  		if (host->pagesize_2k)

For which NFC version and NAND Flash page size is this?

Do you have a means of duplicating the issue?

I wonder if the appropriate fix would not rather be to replace all occurrences
of "host->page_addr" with "page", except in mxc_nand_correct_data() and
mxc_nand_command(). Otherwise, it looks like there will still be weird things
going on with this variable.

Best regards,
Benoît

Patch

diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index d0ded48..32ba340 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1021,6 +1021,7 @@  void mxc_nand_command(struct mtd_info *mtd, unsigned command,
 		break;
 
 	case NAND_CMD_READOOB:
+		host->page_addr = page_addr;
 		host->col_addr = column;
 		host->spare_only = true;
 		if (host->pagesize_2k)