mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Edoardo Scaglia <scaglia@amelchem.com>
To: barebox@lists.infradead.org
Cc: Edoardo Scaglia <scaglia@amelchem.com>
Subject: [PATCH] mtd: nand: fix hardware ECC support in atmel_nand driver
Date: Tue, 23 Feb 2021 12:22:53 +0100	[thread overview]
Message-ID: <20210223112253.5468-1-scaglia@amelchem.com> (raw)

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

             reply	other threads:[~2021-02-23 11:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 11:22 Edoardo Scaglia [this message]
2021-02-24  8:53 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210223112253.5468-1-scaglia@amelchem.com \
    --to=scaglia@amelchem.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox