History

mtd: rawnand: pasemi: Do not force a particular software ECC engine

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.

Miquel Raynal committed 5 years ago

Commit 9506ab91 parent f87b7201 file · +3 −1Browse files

Unified · Split

drivers/mtd/nand/raw/pasemi_nand.c+3−1
@@ -77,7 +77,9 @@ static int pasemi_device_ready(struct nand_chip *chip) · 76 unmodified lines
7777 static int pasemi_attach_chip(struct nand_chip *chip)
7878 {
7979 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
80− chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
80+
81+ if (chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
82+ chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
8183
8284 return 0;
8385 }