[PATCH 1/2] mtd: spi-nor: core: Allow manufacturer fixups to set nor->mtd.flags

tkuw584924 at gmail.com tkuw584924 at gmail.com
Tue Mar 14 23:34:56 PDT 2023


From: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>

Infineon SEMPER Flash family has on-die ECC and multiple programming on
the same 16-byte ECC data unit is not allowed to preserve ECC.

In JFFS2, ECC'd NOR Flash is supported when CONFIG_JFFS2_FS_WRITEBUFFER
is set and MTD_BIT_WRITEABLE is not set in mtd.flag.

In spi-nor/core, the mtd.flags is set to MTD_CAP_NORFLASH that defined as
(MTD_WRITEABLE | MTD_BIT_WRITEABLE).

The mtd.flags should be set to MTD_CAP_NORFLASH in spi-nor/core when it
is not yet set, to allow manufacturer fixups set it.

Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
---
 drivers/mtd/spi-nor/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 0a78045ca1d9..5be9392b65c1 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2976,7 +2976,8 @@ static void spi_nor_set_mtd_info(struct spi_nor *nor)
 	if (!mtd->name)
 		mtd->name = dev_name(dev);
 	mtd->type = MTD_NORFLASH;
-	mtd->flags = MTD_CAP_NORFLASH;
+	if (!mtd->flags)
+		mtd->flags = MTD_CAP_NORFLASH;
 	if (nor->info->flags & SPI_NOR_NO_ERASE)
 		mtd->flags |= MTD_NO_ERASE;
 	else
-- 
2.34.1




More information about the linux-mtd mailing list