linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: linux-mtd@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
Subject: Kernel 5.10-rc1 not mounting NAND flash (Bisected to d7157ff49a5b ("mtd: rawnand: Use the ECC framework user input parsing bits"))
Date: Wed, 04 Nov 2020 18:33:53 +0100	[thread overview]
Message-ID: <20201104183353.Horde.FyqZycHkfr5KHDjPaOEBpQ7@messagerie.c-s.fr> (raw)

Hi Miquel,

I'm unable to boot 5.10-rc1 on my boards. I get the following error:

[    4.125811] nand: device found, Manufacturer ID: 0xad, Chip ID: 0x76
[    4.131992] nand: Hynix NAND 64MiB 3,3V 8-bit
[    4.136173] nand: 64 MiB, SLC, erase size: 16 KiB, page size: 512,  
OOB size: 16
[    4.143534] ------------[ cut here ]------------
[    4.147934] Unsupported ECC algorithm!
[    4.152142] WARNING: CPU: 0 PID: 1 at  
drivers/mtd/nand/raw/nand_base.c:5244 nand_scan_with_ids+0x1260/0x1640
...
[    4.332052] ---[ end trace e3a36f62cae4ac56 ]---
[    4.336882] gpio-nand: probe of c0000000.nand failed with error -22

Bisected to commit d7157ff49a5b ("mtd: rawnand: Use the ECC framework  
user input parsing bits")

My first impression is that with that change, the value set in chip->ecc.algo
by gpio_nand_probe() in drivers/mtd/nand/raw/gpio.c gets overwritten  
in rawnand_dt_init()

The following change fixes the problem, though I'm not sure it is the  
right fix. Can you have a look ?

diff --git a/drivers/mtd/nand/raw/nand_base.c  
b/drivers/mtd/nand/raw/nand_base.c
index 1f0d542d5923..aa74797cf2da 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -5032,7 +5032,8 @@ static int rawnand_dt_init(struct nand_chip *chip)
  		chip->ecc.engine_type = nand->ecc.defaults.engine_type;

  	chip->ecc.placement = nand->ecc.user_conf.placement;
-	chip->ecc.algo = nand->ecc.user_conf.algo;
+	if (chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
+		chip->ecc.algo = nand->ecc.user_conf.algo;
  	chip->ecc.strength = nand->ecc.user_conf.strength;
  	chip->ecc.size = nand->ecc.user_conf.step_size;

---

Thanks
Christophe

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

             reply	other threads:[~2020-11-04 17:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 17:33 Christophe Leroy [this message]
2020-11-04 17:38 ` Kernel 5.10-rc1 not mounting NAND flash (Bisected to d7157ff49a5b ("mtd: rawnand: Use the ECC framework user input parsing bits")) Miquel Raynal
2020-11-04 18:37   ` Christophe Leroy
2020-11-05  7:49     ` Miquel Raynal
2020-11-05  9:06       ` Christophe Leroy
2020-11-05  9:13         ` Miquel Raynal

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=20201104183353.Horde.FyqZycHkfr5KHDjPaOEBpQ7@messagerie.c-s.fr \
    --to=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=miquel.raynal@bootlin.com \
    /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;
as well as URLs for NNTP newsgroup(s).