Patchwork [U-Boot,V2] mtd: mxc_nand: Fix crash after MTD resync

login
register
mail settings
Submitter Marek Vasut
Date July 3, 2013, 12:34 a.m.
Message ID <1372811674-10395-1-git-send-email-marex@denx.de>
Download mbox | patch
Permalink /patch/256525/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Marek Vasut - July 3, 2013, 12:34 a.m.
The driver triggered a BUG() in nand_base.c:3214/nand_scan_tail()
because the ecc.strength was not set in NAND_ECC_HW_SYNDROME ECC
mode.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Benoit Thebaudeau <benoit.thebaudeau@advansee.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 drivers/mtd/nand/mxc_nand.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

V2: Set ecc.strength for both NAND_ECC_HW and NAND_ECC_HW_SYNDROME mode
Marek Vasut - July 12, 2013, 1:26 p.m.
Hi,

Tom/Stefano, can you pick this for .07? Otherwise all mxc with NAND are broken.

Thanks

> The driver triggered a BUG() in nand_base.c:3214/nand_scan_tail()
> because the ecc.strength was not set in NAND_ECC_HW_SYNDROME ECC
> mode.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Benoit Thebaudeau <benoit.thebaudeau@advansee.com>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Scott Wood <scottwood@freescale.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  drivers/mtd/nand/mxc_nand.c |   10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> V2: Set ecc.strength for both NAND_ECC_HW and NAND_ECC_HW_SYNDROME mode
> 
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index ac435f2..40b0741 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -1242,12 +1242,10 @@ int board_nand_init(struct nand_chip *this)
>  		this->ecc.mode = NAND_ECC_HW;
>  	}
> 
> -	if (this->ecc.mode == NAND_ECC_HW) {
> -		if (is_mxc_nfc_1())
> -			this->ecc.strength = 1;
> -		else
> -			this->ecc.strength = 4;
> -	}
> +	if (is_mxc_nfc_1())
> +		this->ecc.strength = 1;
> +	else
> +		this->ecc.strength = 4;
> 
>  	host->pagesize_2k = 0;

Best regards,
Marek Vasut

Patch

diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index ac435f2..40b0741 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1242,12 +1242,10 @@  int board_nand_init(struct nand_chip *this)
 		this->ecc.mode = NAND_ECC_HW;
 	}
 
-	if (this->ecc.mode == NAND_ECC_HW) {
-		if (is_mxc_nfc_1())
-			this->ecc.strength = 1;
-		else
-			this->ecc.strength = 4;
-	}
+	if (is_mxc_nfc_1())
+		this->ecc.strength = 1;
+	else
+		this->ecc.strength = 4;
 
 	host->pagesize_2k = 0;