summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/spi/macronix.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2024-08-26 12:14:11 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2024-09-06 17:00:14 +0200
commite1f251e1aad8b1cfb322cbd6057300e4613534f0 (patch)
treebc026cb21ef8784541358b60c60ed9fe0c4f0c97 /drivers/mtd/nand/spi/macronix.c
parent18073e395cd6d0de1427c4248380ccdbf937375d (diff)
mtd: spi-nand: macronix: Add a possible bitflip status flag
Macronix SPI-NANDs encode the ECC status into two bits. There are three standard situations (no bitflip, bitflips, error), and an additional possible situation which is only triggered when configuring the 0x10 configuration register, allowing to know, if there have been bitflips, whether the maximum amount of bitflips was above a configurable threshold or not. In all cases, for now, s this configuration register is unset, it means the same as "there are bitflips". This value is maybe standard, maybe not. For now, let's define it in the Macronix driver, we can safely move it to a shared place later if that is relevant. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240826101412.20644-9-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mtd/nand/spi/macronix.c')
-rw-r--r--drivers/mtd/nand/spi/macronix.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
index d26e8a8c5850..a4feeb030258 100644
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
@@ -12,6 +12,8 @@
#define SPINAND_MFR_MACRONIX 0xC2
#define MACRONIX_ECCSR_MASK 0x0F
+#define STATUS_ECC_HAS_BITFLIPS_THRESHOLD (3 << 4)
+
static SPINAND_OP_VARIANTS(read_cache_variants,
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
@@ -95,6 +97,7 @@ static int macronix_ecc_get_status(struct spinand_device *spinand,
return -EBADMSG;
case STATUS_ECC_HAS_BITFLIPS:
+ case STATUS_ECC_HAS_BITFLIPS_THRESHOLD:
return macronix_get_bf(spinand, status);
default:
break;