Skip to contentSkip to conversation

MTD: nand: mxs_nand: Allow driver to auto setup ECC in SPL

PATCH In review Adam Ford 4 participants 6 messages Jan 17, 2019 – Feb 16, 2019

Subsystems (3)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 MTD: nand: mxs_nand: Allow driver to auto setup ECC in SPL

The initialization of the NAND in SPL hard-coded ecc.bytes, ecc.size, and ecc.strength which may work for some NAND parts, but it not appropriate for others. With the pending patch "mxs_nand: Fix BCH read timeout error on boards requiring ECC" the driver can auto configure the ECC when these entries are blank. This patch has been tested in NAND flash with oob 64 and oob 128.

drivers/mtd/nand/raw/mxs_nand.c +0 -3
index 2d84bfffe2..95fa452cef 100644
@@ -1191,9 +1191,6 @@ int mxs_nand_init_spl(struct nand_chip *nand)
 	nand->ecc.read_page	= mxs_nand_ecc_read_page;
 
 	nand->ecc.mode		= NAND_ECC_HW;
-	nand->ecc.bytes		= 9;
-	nand->ecc.size		= 512;
-	nand->ecc.strength	= 8;
 
 	return 0;
 }
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 MTD: nand: mxs_nand: Allow driver to auto setup ECC in SPL

Hi,

Quoted 9 lines · Adam Ford

The initialization of the NAND in SPL hard-coded ecc.bytes, ecc.size, and ecc.strength which may work for some NAND parts, but it not appropriate for others. With the pending patch "mxs_nand: Fix BCH read timeout error on boards requiring ECC" the driver can auto configure the ECC when these entries are blank. This patch has been tested in NAND flash with oob 64 and oob 128.

Maybe you can give me a hint where the driver actually does the auto configuration?

I've tested the patch on a custom i.MX6ULL board with a Micron NAND flash. The SPL loader is able to boot from NAND with and without this patch.

Quoted 14 lines
drivers/mtd/nand/raw/mxs_nand.c +0 -3
index 2d84bfffe2..95fa452cef 100644
@@ -1191,9 +1191,6 @@ int mxs_nand_init_spl(struct nand_chip *nand)
 	nand->ecc.read_page	= mxs_nand_ecc_read_page;
 
 	nand->ecc.mode		= NAND_ECC_HW;
-	nand->ecc.bytes		= 9;
-	nand->ecc.size		= 512;
-	nand->ecc.strength	= 8;
 
 	return 0;
 }
author
#2 lore raw

PATCH 1/1 MTD: nand: mxs_nand: Allow driver to auto setup ECC in SPL

Quoted 12 lines · Jörg Krause

Hi,

Quoted 8 lines · Adam Ford

The initialization of the NAND in SPL hard-coded ecc.bytes, ecc.size, and ecc.strength which may work for some NAND parts, but it not appropriate for others. With the pending patch "mxs_nand: Fix BCH read timeout error on boards requiring ECC" the driver can auto configure the ECC when these entries are blank. This patch has been tested in NAND flash with oob 64 and oob 128.

Quoted 8 lines
Quoted 1 line

Maybe you can give me a hint where the driver actually does the auto configuration?

I've tested the patch on a custom i.MX6ULL board with a Micron NAND flash. The SPL loader is able to boot from NAND with and without this patch.

I am traveling right now, so I don;t have my editor or source code, but I can tell you that the patch found in
http://patchwork.ozlabs.org/patch/1020160/ sets up the ECC, and if these values are not set they will get set. I won't be back to the office until a week from Monday.

The reason I found I needed this patch was because I have boards with different flash parts that used different ECC values. One my board boards didn't need the patch because the ECC matched the values hard-coded here, but my other board would get ECC errors during SPL because these values didn't match what U-Boot used when it wrote to flash.

If your board works with and without the patch, I am guessing the ECC values generated by the above mentioned patch probably set them to the same values that were hard coded before.

adam

Quoted 18 lines
Quoted 14 lines
drivers/mtd/nand/raw/mxs_nand.c +0 -3
index 2d84bfffe2..95fa452cef 100644
@@ -1191,9 +1191,6 @@ int mxs_nand_init_spl(struct nand_chip *nand)
      nand->ecc.read_page     = mxs_nand_ecc_read_page;
 
      nand->ecc.mode          = NAND_ECC_HW;
-     nand->ecc.bytes         = 9;
-     nand->ecc.size          = 512;
-     nand->ecc.strength      = 8;
 
      return 0;
 }
#3 lore raw

PATCH 1/1 MTD: nand: mxs_nand: Allow driver to auto setup ECC in SPL

In reply to Adam Ford
Quoted 17 lines · Adam Ford

The initialization of the NAND in SPL hard-coded ecc.bytes, ecc.size, and ecc.strength which may work for some NAND parts, but it not appropriate for others. With the pending patch "mxs_nand: Fix BCH read timeout error on boards requiring ECC" the driver can auto configure the ECC when these entries are blank. This patch has been tested in NAND flash with oob 64 and oob 128.

drivers/mtd/nand/raw/mxs_nand.c +0 -0
index 2d84bfffe2..95fa452cef 100644

drivers/mtd/nand/raw/mxs_nand.c int mxs_nand_init_spl(struct nand_chip *nand) · line 1196

Quoted 9 lines
drivers/mtd/nand/raw/mxs_nand.c +0 -3
@@ -1191,9 +1191,6 @@ int mxs_nand_init_spl(struct nand_chip *nand)
        nand->ecc.read_page     = mxs_nand_ecc_read_page;
 
        nand->ecc.mode          = NAND_ECC_HW;
-       nand->ecc.bytes         = 9;
-       nand->ecc.size          = 512;
-       nand->ecc.strength      = 8;
 
        return 0;
 }

Thanks Adam,

This resolves failed booting on Gateworks Ventana IMX6 with NAND SPL for Micron MT29F16G08AD 16Gbit (oob=224) and Cypress S34ML16G202BH 16Gbit (oob=128).

This fixes the regressions occuring with 5346c31e305a37d39f535cc0d5ae87d8b7e81230: mtd: nand: mxs_nand: use self init

for GW5104 with Micron MT29F16G08AD 16Gbit (oob=224) and Cypress S34ML16G202BH 16Gbit (oob=128)

Tim

author
#4 lore raw

PATCH 1/1 MTD: nand: mxs_nand: Allow driver to auto setup ECC in SPL

Quoted 39 lines · Tim Harvey
Quoted 17 lines · Adam Ford

The initialization of the NAND in SPL hard-coded ecc.bytes, ecc.size, and ecc.strength which may work for some NAND parts, but it not appropriate for others. With the pending patch "mxs_nand: Fix BCH read timeout error on boards requiring ECC" the driver can auto configure the ECC when these entries are blank. This patch has been tested in NAND flash with oob 64 and oob 128.

drivers/mtd/nand/raw/mxs_nand.c +0 -0
index 2d84bfffe2..95fa452cef 100644

drivers/mtd/nand/raw/mxs_nand.c int mxs_nand_init_spl(struct nand_chip *nand) · line 1196

Quoted 9 lines
drivers/mtd/nand/raw/mxs_nand.c +0 -3
@@ -1191,9 +1191,6 @@ int mxs_nand_init_spl(struct nand_chip *nand)
        nand->ecc.read_page     = mxs_nand_ecc_read_page;
 
        nand->ecc.mode          = NAND_ECC_HW;
-       nand->ecc.bytes         = 9;
-       nand->ecc.size          = 512;
-       nand->ecc.strength      = 8;
 
        return 0;
 }

Thanks Adam,

This resolves failed booting on Gateworks Ventana IMX6 with NAND SPL for Micron MT29F16G08AD 16Gbit (oob=224) and Cypress S34ML16G202BH 16Gbit (oob=128).

This fixes the regressions occuring with 5346c31e305a37d39f535cc0d5ae87d8b7e81230: mtd: nand: mxs_nand: use self init

Quoted 6 lines

for GW5104 with Micron MT29F16G08AD 16Gbit (oob=224) and Cypress S34ML16G202BH 16Gbit (oob=128)

Scott / Stefano,

Any chance this can get reviewed and/or applied for the next release? We've got a few people who have their respective tested-by comments.

adam

Quoted 1 line

Tim

#5 lore raw
In reply to Adam Ford
Quoted 16 lines

The initialization of the NAND in SPL hard-coded ecc.bytes, ecc.size, and ecc.strength which may work for some NAND parts, but it not appropriate for others. With the pending patch "mxs_nand: Fix BCH read timeout error on boards requiring ECC" the driver can auto configure the ECC when these entries are blank. This patch has been tested in NAND flash with oob 64 and oob 128.

drivers/mtd/nand/raw/mxs_nand.c +0 -0
index 2d84bfffe2..95fa452cef 100644

drivers/mtd/nand/raw/mxs_nand.c int mxs_nand_init_spl(struct nand_chip *nand) · line 1196

Quoted 9 lines
drivers/mtd/nand/raw/mxs_nand.c +0 -3
@@ -1191,9 +1191,6 @@ int mxs_nand_init_spl(struct nand_chip *nand)
 	nand->ecc.read_page	= mxs_nand_ecc_read_page;
 
 	nand->ecc.mode		= NAND_ECC_HW;
-	nand->ecc.bytes		= 9;
-	nand->ecc.size		= 512;
-	nand->ecc.strength	= 8;
 
 	return 0;
 }

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================