diff mbox

[2/2] mtd mxc_nand: move ecc strengh setup before nand_scan_tail

Message ID 1337955762-19157-2-git-send-email-s.hauer@pengutronix.de
State Accepted
Commit 4a43faf54e9173b6acce37cf7f053fc9515a2cdf
Headers show

Commit Message

Sascha Hauer May 25, 2012, 2:22 p.m. UTC
Since this commit:

  commit 6a918bade9dab40aaef80559bd1169c69e8d69cb
  Author: Mike Dunn <mikedunn@newsguy.com>
  Date:   Sun Mar 11 14:21:11 2012 -0700

     mtd: flash drivers set ecc strength

The mxc_nand driver fails with:

Driver must set ecc.strength when using hardware ECC

This is because nand_scan_tail checks for correct ecc strength
settings, so we must set them up before nand_scan_tail.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/mxc_nand.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Mike Dunn May 25, 2012, 4:29 p.m. UTC | #1
On 05/25/2012 07:22 AM, Sascha Hauer wrote:
> Since this commit:
> 
>   commit 6a918bade9dab40aaef80559bd1169c69e8d69cb
>   Author: Mike Dunn <mikedunn@newsguy.com>
>   Date:   Sun Mar 11 14:21:11 2012 -0700
> 
>      mtd: flash drivers set ecc strength
> 
> The mxc_nand driver fails with:
> 
> Driver must set ecc.strength when using hardware ECC
> 
> This is because nand_scan_tail checks for correct ecc strength
> settings, so we must set them up before nand_scan_tail.


Oops, sorry Sascha.  This was compile-tested only, but I should have ensured
strength was set before call to nand_scan_tail().

Thanks,
Mike
Artem Bityutskiy May 25, 2012, 4:55 p.m. UTC | #2
On Fri, 2012-05-25 at 16:22 +0200, Sascha Hauer wrote:
> Since this commit:
> 
>   commit 6a918bade9dab40aaef80559bd1169c69e8d69cb
>   Author: Mike Dunn <mikedunn@newsguy.com>
>   Date:   Sun Mar 11 14:21:11 2012 -0700
> 
>      mtd: flash drivers set ecc strength
> 
> The mxc_nand driver fails with:
> 
> Driver must set ecc.strength when using hardware ECC
> 
> This is because nand_scan_tail checks for correct ecc strength
> settings, so we must set them up before nand_scan_tail.

Pushed this one to l2-mtd.git as well, thanks!
diff mbox

Patch

diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 4d27ddc..aaf042b 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1485,12 +1485,6 @@  static int __init mxcnd_probe(struct platform_device *pdev)
 	else if (mtd->writesize == 4096)
 		this->ecc.layout = host->devtype_data->ecclayout_4k;
 
-	/* second phase scan */
-	if (nand_scan_tail(mtd)) {
-		err = -ENXIO;
-		goto escan;
-	}
-
 	if (this->ecc.mode == NAND_ECC_HW) {
 		if (nfc_is_v1())
 			this->ecc.strength = 1;
@@ -1498,6 +1492,12 @@  static int __init mxcnd_probe(struct platform_device *pdev)
 			this->ecc.strength = (host->eccsize == 4) ? 4 : 8;
 	}
 
+	/* second phase scan */
+	if (nand_scan_tail(mtd)) {
+		err = -ENXIO;
+		goto escan;
+	}
+
 	/* Register the partitions */
 	mtd_device_parse_register(mtd, part_probes,
 			&(struct mtd_part_parser_data){