linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	<linux-mtd@lists.infradead.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Subject: [PATCH 6/9] mtd: rawnand: pasemi: Do not force a particular software ECC engine
Date: Thu,  3 Dec 2020 20:03:37 +0100	[thread overview]
Message-ID: <20201203190340.15522-7-miquel.raynal@bootlin.com> (raw)
In-Reply-To: <20201203190340.15522-1-miquel.raynal@bootlin.com>

Originally, commit d7157ff49a5b ("mtd: rawnand: Use the ECC framework
user input parsing bits") kind of broke the logic around the
initialization of several ECC engines.

Unfortunately, the fix (which indeed moved the ECC initialization to
the right place) did not take into account the fact that a different
ECC algorithm could have been used thanks to a DT property,
considering the "Hamming" algorithm entry a configuration while it was
only a default.

Add the necessary logic to be sure Hamming keeps being only a default.

Fixes: 8fc6f1f042b2 ("mtd: rawnand: pasemi: Move the ECC initialization to ->attach_chip()")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/pasemi_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/pasemi_nand.c b/drivers/mtd/nand/raw/pasemi_nand.c
index 4dfff34800f4..68c08772d7c2 100644
--- a/drivers/mtd/nand/raw/pasemi_nand.c
+++ b/drivers/mtd/nand/raw/pasemi_nand.c
@@ -77,7 +77,9 @@ static int pasemi_device_ready(struct nand_chip *chip)
 static int pasemi_attach_chip(struct nand_chip *chip)
 {
 	chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
-	chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
+
+	if (chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
+		chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
 
 	return 0;
 }
-- 
2.20.1


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

  parent reply	other threads:[~2020-12-03 19:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 19:03 [PATCH 0/9] mtd: rawnand: Do not overwrite user settings Miquel Raynal
2020-12-03 19:03 ` [PATCH 1/9] mtd: rawnand: ams-delta: Do not force a particular software ECC engine Miquel Raynal
2020-12-04 16:21   ` Miquel Raynal
2020-12-03 19:03 ` [PATCH 2/9] mtd: rawnand: au1550: " Miquel Raynal
2020-12-04 16:21   ` Miquel Raynal
2020-12-03 19:03 ` [PATCH 3/9] mtd: rawnand: gpio: " Miquel Raynal
2020-12-04 16:21   ` Miquel Raynal
2020-12-03 19:03 ` [PATCH 4/9] mtd: rawnand: mpc5121: " Miquel Raynal
2020-12-04 16:21   ` Miquel Raynal
2020-12-03 19:03 ` [PATCH 5/9] mtd: rawnand: orion: " Miquel Raynal
2020-12-04 16:20   ` Miquel Raynal
2020-12-03 19:03 ` Miquel Raynal [this message]
2020-12-04 16:20   ` [PATCH 6/9] mtd: rawnand: pasemi: " Miquel Raynal
2020-12-03 19:03 ` [PATCH 7/9] mtd: rawnand: plat_nand: " Miquel Raynal
2020-12-04 16:20   ` Miquel Raynal
2020-12-03 19:03 ` [PATCH 8/9] mtd: rawnand: socrates: " Miquel Raynal
2020-12-04 16:20   ` Miquel Raynal
2020-12-03 19:03 ` [PATCH 9/9] mtd: rawnand: xway: " Miquel Raynal
2020-12-04 16:20   ` 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=20201203190340.15522-7-miquel.raynal@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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).