From 042a78d9bb0c4ca2c0659f0a860a97491402aeeb Mon Sep 17 00:00:00 2001 From: Takahiro Kuwano Date: Tue, 30 Sep 2025 03:20:59 +0300 Subject: mtd: spinand: Introduce a way to avoid raw access SkyHigh spinand device has ECC enable bit in configuration register but it must be always enabled. If ECC is disabled, read and write ops results in undetermined state. For such devices, a way to avoid raw access is needed. Introduce SPINAND_NO_RAW_ACCESS flag to advertise the device does not support raw access. In such devices, the on-die ECC engine ops returns error to I/O request in raw mode. Checking and marking BBM need to be cared as special case, by adding fallback mechanism that tries read/write OOB with ECC enabled. This is a port of linux commit 6d9d6ab3a82a (mtd: spinand: Introduce a way to avoid raw access) Signed-off-by: Takahiro Kuwano Signed-off-by: Miquel Raynal Signed-off-by: Mikhail Kshevetskiy # U-Boot port Reviewed-by: Frieder Schrempf Signed-off-by: Michael Trimarchi --- include/linux/mtd/spinand.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index fb3a2e5d909..63626c9c27c 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -320,6 +320,7 @@ struct spinand_ecc_info { #define SPINAND_HAS_CR_FEAT_BIT BIT(1) #define SPINAND_HAS_PROG_PLANE_SELECT_BIT BIT(2) #define SPINAND_HAS_READ_PLANE_SELECT_BIT BIT(3) +#define SPINAND_NO_RAW_ACCESS BIT(4) /** * struct spinand_info - Structure used to describe SPI NAND chips -- cgit v1.2.3