]> git.ipfire.org Git - thirdparty/openwrt.git/blob
4b576fee3571f6bf9bf347b7cfa35f4c1fccf53e
[thirdparty/openwrt.git] /
1 From 1824520e7477bedf76bd08c32261c755e6405cd9 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Mon, 12 Aug 2024 02:56:41 +0100
4 Subject: [PATCH] mtd: spinand: set bitflip_threshold to 75% of ECC strength
5
6 Reporting an unclean read from SPI-NAND only when the maximum number
7 of correctable bitflip errors has been hit seems a bit late.
8 UBI LEB scrubbing, which depends on the lower MTD device reporting
9 correctable bitflips, then only kicks in when it's almost too late.
10
11 Set bitflip_threshold to 75% of the ECC strength, which is also the
12 default for raw NAND.
13
14 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
15 Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
16 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
17 Link: https://lore.kernel.org/linux-mtd/2117e387260b0a96f95b8e1652ff79e0e2d71d53.1723427450.git.daniel@makrotopia.org
18 ---
19 drivers/mtd/nand/spi/core.c | 1 +
20 1 file changed, 1 insertion(+)
21
22 --- a/drivers/mtd/nand/spi/core.c
23 +++ b/drivers/mtd/nand/spi/core.c
24 @@ -1287,6 +1287,7 @@ static int spinand_init(struct spinand_d
25 /* Propagate ECC information to mtd_info */
26 mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength;
27 mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size;
28 + mtd->bitflip_threshold = DIV_ROUND_UP(mtd->ecc_strength * 3, 4);
29
30 ret = spinand_create_dirmaps(spinand);
31 if (ret) {