Skip to content

Commit 1824520

Browse files
dangowrtmiquelraynal
authored andcommitted
mtd: spinand: set bitflip_threshold to 75% of ECC strength
Reporting an unclean read from SPI-NAND only when the maximum number of correctable bitflip errors has been hit seems a bit late. UBI LEB scrubbing, which depends on the lower MTD device reporting correctable bitflips, then only kicks in when it's almost too late. Set bitflip_threshold to 75% of the ECC strength, which is also the default for raw NAND. Signed-off-by: Daniel Golle <[email protected]> Reviewed-by: Frieder Schrempf <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/2117e387260b0a96f95b8e1652ff79e0e2d71d53.1723427450.git.daniel@makrotopia.org
1 parent e2a9fcb commit 1824520

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/mtd/nand/spi/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,7 @@ static int spinand_init(struct spinand_device *spinand)
12871287
/* Propagate ECC information to mtd_info */
12881288
mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength;
12891289
mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size;
1290+
mtd->bitflip_threshold = DIV_ROUND_UP(mtd->ecc_strength * 3, 4);
12901291

12911292
ret = spinand_create_dirmaps(spinand);
12921293
if (ret) {

0 commit comments

Comments
 (0)