* [PATCH] mtd: nand: fix hardware ECC support in atmel_nand driver
@ 2021-02-23 11:22 Edoardo Scaglia
2021-02-24 8:53 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Edoardo Scaglia @ 2021-02-23 11:22 UTC (permalink / raw)
To: barebox; +Cc: Edoardo Scaglia
When using a NAND memory with hardware ECC enabled on a Atmel SoC
probing fails during barebox boot with following error:
nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
nand_base: Micron MT29F4G08ABAEAWP
nand_base: 512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 224
WARNING: at drivers/mtd/nand/nand_base.c:5594/nand_scan_tail()!
WARNING: No oob scheme defined for oobsize 224
atmel_nand atmel_nand0: probe failed: No such device or address
The problem arises from commit b6bcd96de5a75bdc5d06a06f2efffc2d89e346ec
which among several changes dropped CONFIG_NAND_ECC_HW symbol, however
two references remained in atmel_nand driver causing the failure of NAND
probing when hardware ECC is configured in a Atmel SoC.
Signed-off-by: Edoardo Scaglia <scaglia@amelchem.com>
---
drivers/mtd/nand/atmel_nand.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index db13f5b7e4..58d53b7a78 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1351,8 +1351,7 @@ static int __init atmel_nand_probe(struct device_d *dev)
nand_chip->ecc.strength = pdata->ecc_strength ? : 1;
nand_chip->ecc.size = 1 << pdata->ecc_size_shift ? : 512;
- if (IS_ENABLED(CONFIG_NAND_ECC_HW) &&
- pdata->ecc_mode == NAND_ECC_HW) {
+ if (pdata->ecc_mode == NAND_ECC_HW) {
nand_chip->ecc.mode = NAND_ECC_HW;
}
@@ -1411,8 +1410,7 @@ static int __init atmel_nand_probe(struct device_d *dev)
host->ecc_code = xmalloc(mtd->oobsize);
- if (IS_ENABLED(CONFIG_NAND_ECC_HW) &&
- nand_chip->ecc.mode == NAND_ECC_HW) {
+ if (nand_chip->ecc.mode == NAND_ECC_HW) {
if (IS_ENABLED(CONFIG_NAND_ATMEL_PMECC) && pdata->has_pmecc)
res = atmel_pmecc_nand_init_params(dev, host);
else
--
2.30.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: nand: fix hardware ECC support in atmel_nand driver
2021-02-23 11:22 [PATCH] mtd: nand: fix hardware ECC support in atmel_nand driver Edoardo Scaglia
@ 2021-02-24 8:53 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-02-24 8:53 UTC (permalink / raw)
To: Edoardo Scaglia; +Cc: barebox
On Tue, Feb 23, 2021 at 12:22:53PM +0100, Edoardo Scaglia wrote:
> When using a NAND memory with hardware ECC enabled on a Atmel SoC
> probing fails during barebox boot with following error:
>
> nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
> nand_base: Micron MT29F4G08ABAEAWP
> nand_base: 512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 224
> WARNING: at drivers/mtd/nand/nand_base.c:5594/nand_scan_tail()!
> WARNING: No oob scheme defined for oobsize 224
> atmel_nand atmel_nand0: probe failed: No such device or address
>
> The problem arises from commit b6bcd96de5a75bdc5d06a06f2efffc2d89e346ec
> which among several changes dropped CONFIG_NAND_ECC_HW symbol, however
> two references remained in atmel_nand driver causing the failure of NAND
> probing when hardware ECC is configured in a Atmel SoC.
>
> Signed-off-by: Edoardo Scaglia <scaglia@amelchem.com>
> ---
> drivers/mtd/nand/atmel_nand.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Applied to master. Sorry for breaking it, it seems I only tested it with
software ecc.
Sascha
>
> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
> index db13f5b7e4..58d53b7a78 100644
> --- a/drivers/mtd/nand/atmel_nand.c
> +++ b/drivers/mtd/nand/atmel_nand.c
> @@ -1351,8 +1351,7 @@ static int __init atmel_nand_probe(struct device_d *dev)
> nand_chip->ecc.strength = pdata->ecc_strength ? : 1;
> nand_chip->ecc.size = 1 << pdata->ecc_size_shift ? : 512;
>
> - if (IS_ENABLED(CONFIG_NAND_ECC_HW) &&
> - pdata->ecc_mode == NAND_ECC_HW) {
> + if (pdata->ecc_mode == NAND_ECC_HW) {
> nand_chip->ecc.mode = NAND_ECC_HW;
> }
>
> @@ -1411,8 +1410,7 @@ static int __init atmel_nand_probe(struct device_d *dev)
>
> host->ecc_code = xmalloc(mtd->oobsize);
>
> - if (IS_ENABLED(CONFIG_NAND_ECC_HW) &&
> - nand_chip->ecc.mode == NAND_ECC_HW) {
> + if (nand_chip->ecc.mode == NAND_ECC_HW) {
> if (IS_ENABLED(CONFIG_NAND_ATMEL_PMECC) && pdata->has_pmecc)
> res = atmel_pmecc_nand_init_params(dev, host);
> else
> --
> 2.30.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-24 8:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 11:22 [PATCH] mtd: nand: fix hardware ECC support in atmel_nand driver Edoardo Scaglia
2021-02-24 8:53 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox