diff mbox series

[1/8] mtd: rawnand: fsmc: Fix use of SM ORDER

Message ID 20210928221507.199198-2-miquel.raynal@bootlin.com (mailing list archive)
State New, archived
Headers show
Series Cleanup series about Hamming helpers | expand

Commit Message

Miquel Raynal Sept. 28, 2021, 10:15 p.m. UTC
The introduction of the generic ECC engine API lead to a number of
changes in various drivers which broke some of them. Here is a typical
example: I expected the SM_ORDER option to be handled by the Hamming ECC
engine internals. Problem: the fsmc driver does not instantiate (yet) a
real ECC engine object so we had to use a 'bare' ECC helper instead of
the shiny rawnand functions. However, when not intializing this engine
properly and using the bare helpers, we do not get the SM ORDER feature
handled automatically. It looks like this was lost in the process so
let's ensure we use the right SM ORDER now.

Fixes: ad9ffdce4539 ("mtd: rawnand: fsmc: Fix external use of SW Hamming ECC helper")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/fsmc_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Miquel Raynal Oct. 15, 2021, 10:33 a.m. UTC | #1
On Tue, 2021-09-28 at 22:15:00 UTC, Miquel Raynal wrote:
> The introduction of the generic ECC engine API lead to a number of
> changes in various drivers which broke some of them. Here is a typical
> example: I expected the SM_ORDER option to be handled by the Hamming ECC
> engine internals. Problem: the fsmc driver does not instantiate (yet) a
> real ECC engine object so we had to use a 'bare' ECC helper instead of
> the shiny rawnand functions. However, when not intializing this engine
> properly and using the bare helpers, we do not get the SM ORDER feature
> handled automatically. It looks like this was lost in the process so
> let's ensure we use the right SM ORDER now.
> 
> Fixes: ad9ffdce4539 ("mtd: rawnand: fsmc: Fix external use of SW Hamming ECC helper")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next.

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
index a3e66155ae40..658f0cbe7ce8 100644
--- a/drivers/mtd/nand/raw/fsmc_nand.c
+++ b/drivers/mtd/nand/raw/fsmc_nand.c
@@ -438,8 +438,10 @@  static int fsmc_correct_ecc1(struct nand_chip *chip,
 			     unsigned char *read_ecc,
 			     unsigned char *calc_ecc)
 {
+	bool sm_order = chip->ecc.options & NAND_ECC_SOFT_HAMMING_SM_ORDER;
+
 	return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
-				      chip->ecc.size, false);
+				      chip->ecc.size, sm_order);
 }
 
 /* Count the number of 0's in buff upto a max of max_bits */