Skip to content

Commit e1f251e

Browse files
committed
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 <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 18073e3 commit e1f251e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/mtd/nand/spi/macronix.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#define SPINAND_MFR_MACRONIX 0xC2
1313
#define MACRONIX_ECCSR_MASK 0x0F
1414

15+
#define STATUS_ECC_HAS_BITFLIPS_THRESHOLD (3 << 4)
16+
1517
static SPINAND_OP_VARIANTS(read_cache_variants,
1618
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
1719
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,
9597
return -EBADMSG;
9698

9799
case STATUS_ECC_HAS_BITFLIPS:
100+
case STATUS_ECC_HAS_BITFLIPS_THRESHOLD:
98101
return macronix_get_bf(spinand, status);
99102
default:
100103
break;

0 commit comments

Comments
 (0)