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.
Unified · Split
| @@ -77,7 +77,9 @@ static int pasemi_device_ready(struct nand_chip *chip) · 76 unmodified lines | ||
| 77 | 77 | static int pasemi_attach_chip(struct nand_chip *chip) |
| 78 | 78 | { |
| 79 | 79 | 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; | |
| 81 | 83 | |
| 82 | 84 | return 0; |
| 83 | 85 | } |