mtd: nand: raw: atmel: Use ONFI ECC params if available

When ECC parameters are not specified in DT, first try ONFI ECC parameters
before fallback to maximum strength.

It's the Linux driver behavior since the driver rewriting in f88fc12.

From then 2 nand system refactors have been done in 6a1b66d6 and 53576c7b,
chip->ecc_strength_ds and chip->ecc_step_ds became
nanddev_get_ecc_requirements(). U-Boot didn't follow the refactor and
always use these 2 fields.

v2: Fix formatting, add upstream commit hash.

Signed-off-by: Zixun LI <zli@ogga.fr>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: Balamanikandan Gunasundar
This commit is contained in:
Zixun LI
2024-07-21 23:45:52 +02:00
committed by Michael Trimarchi
parent 47e544f576
commit 1db2aadd84

View File

@@ -1029,11 +1029,15 @@ static int atmel_nand_pmecc_init(struct nand_chip *chip)
req.ecc.strength = ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH; req.ecc.strength = ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH;
else if (chip->ecc.strength) else if (chip->ecc.strength)
req.ecc.strength = chip->ecc.strength; req.ecc.strength = chip->ecc.strength;
else if (chip->ecc_strength_ds)
req.ecc.strength = chip->ecc_strength_ds;
else else
req.ecc.strength = ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH; req.ecc.strength = ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH;
if (chip->ecc.size) if (chip->ecc.size)
req.ecc.sectorsize = chip->ecc.size; req.ecc.sectorsize = chip->ecc.size;
else if (chip->ecc_step_ds)
req.ecc.sectorsize = chip->ecc_step_ds;
else else
req.ecc.sectorsize = ATMEL_PMECC_SECTOR_SIZE_AUTO; req.ecc.sectorsize = ATMEL_PMECC_SECTOR_SIZE_AUTO;