Skip to contentSkip to conversation

mtd: spi-nor: add support for Fudan Microelectronics FM25Q256

PATCH In review Cole Leavitt 2 participants 2 messages Feb 14 – Feb 16

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: spi-nor: add support for Fudan Microelectronics FM25Q256

Add support for the Fudan Microelectronics FM25Q256 (JEDEC ID f7 f0 30), a 256Mbit (32MB) SPI NOR flash chip. This chip is found on Lenovo ThinkPad P16 Gen 3 (Arrow Lake-S) platforms as the SPI flash backing the UEFI firmware.

The chip supports 4K sector erase, dual read, and quad read modes.

Without this patch, the kernel's spi-nor driver reports:
spi-nor spi0.0: unrecognized JEDEC id bytes: f7 f0 30
and refuses to create an MTD device, preventing userspace tools from accessing the flash.

---
 drivers/mtd/spi-nor/Makefile |  1 +
 drivers/mtd/spi-nor/core.c   |  1 +
 drivers/mtd/spi-nor/core.h   |  1 +
 drivers/mtd/spi-nor/fudan.c  | 25 +++++++++++++++++++++++++
 4 files changed, 28 insertions(+)
 create mode 100644 drivers/mtd/spi-nor/fudan.c
drivers/mtd/spi-nor/Makefile +1 -0
index 5dd9c35f6b6f..2c8b9b3e08bb 100644
@@ -5,6 +5,7 @@ spi-nor-objs			+= atmel.o
 spi-nor-objs			+= eon.o
 spi-nor-objs			+= esmt.o
 spi-nor-objs			+= everspin.o
+spi-nor-objs			+= fudan.o
 spi-nor-objs			+= gigadevice.o
 spi-nor-objs			+= intel.o
 spi-nor-objs			+= issi.o
drivers/mtd/spi-nor/core.c +1 -0
index d3f8a78efd3b..395ff5c39883 100644
@@ -1944,6 +1944,7 @@ static const struct spi_nor_manufacturer *manufacturers[] = {
 	&spi_nor_eon,
 	&spi_nor_esmt,
 	&spi_nor_everspin,
+	&spi_nor_fudan,
 	&spi_nor_gigadevice,
 	&spi_nor_intel,
 	&spi_nor_issi,
drivers/mtd/spi-nor/core.h +1 -0
index 16b382d4f04f..be63273677c8 100644
@@ -594,6 +594,7 @@ extern const struct spi_nor_manufacturer spi_nor_atmel;
 extern const struct spi_nor_manufacturer spi_nor_eon;
 extern const struct spi_nor_manufacturer spi_nor_esmt;
 extern const struct spi_nor_manufacturer spi_nor_everspin;
+extern const struct spi_nor_manufacturer spi_nor_fudan;
 extern const struct spi_nor_manufacturer spi_nor_gigadevice;
 extern const struct spi_nor_manufacturer spi_nor_intel;
 extern const struct spi_nor_manufacturer spi_nor_issi;
drivers/mtd/spi-nor/fudan.c new file +25 -0
new file mode 100644
index 000000000000..e9a4d3ed3cd0
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Fudan Microelectronics SPI NOR flash support.
+ *
+ * JEDEC manufacturer ID 0xf7.
+ */
+
+#include <linux/mtd/spi-nor.h>
+
+#include "core.h"
+
+static const struct flash_info fudan_nor_parts[] = {
+	{
+		.id = SNOR_ID(0xf7, 0xf0, 0x30),
+		.name = "fm25q256",
+		.size = SZ_32M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	},
+};
+
+const struct spi_nor_manufacturer spi_nor_fudan = {
+	.name = "fudan",
+	.parts = fudan_nor_parts,
+	.nparts = ARRAY_SIZE(fudan_nor_parts),
+};

base-commit: 2687c848e57820651b9f69d30c4710f4219f7dbf

Signature · 5 lines
2.52.0

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer
#1 lore raw

Hi,

Quoted 1 line · Cole Leavitt

Add support for the Fudan Microelectronics FM25Q256 (JEDEC ID f7 f0 30),

So F7 (without continuation codes) is ZMD. Fudan Micro is 7F 7F 7F 7F 7F 7F 7F A1 or if you (wrongly) ignore the continuation codes A1.

That's also what's described in the datasheet, mentioned below. Do you really have a Fudan Micro flash?

Quoted 8 lines

a 256Mbit (32MB) SPI NOR flash chip. This chip is found on Lenovo ThinkPad P16 Gen 3 (Arrow Lake-S) platforms as the SPI flash backing the UEFI firmware.

The chip supports 4K sector erase, dual read, and quad read modes.

Without this patch, the kernel's spi-nor driver reports:
spi-nor spi0.0: unrecognized JEDEC id bytes: f7 f0 30

Do you use the latest kernel? Doesn't the flash provide SFDP? I've looked at [1] (there is none for the 256Mbit variant) and that one supports SFDP.

-michael

[1] https://eng.fmsh.com/nvm/FM25Q128_ds_eng.pdf

Quoted 81 lines

and refuses to create an MTD device, preventing userspace tools from accessing the flash.

---
 drivers/mtd/spi-nor/Makefile |  1 +
 drivers/mtd/spi-nor/core.c   |  1 +
 drivers/mtd/spi-nor/core.h   |  1 +
 drivers/mtd/spi-nor/fudan.c  | 25 +++++++++++++++++++++++++
 4 files changed, 28 insertions(+)
 create mode 100644 drivers/mtd/spi-nor/fudan.c
drivers/mtd/spi-nor/Makefile +1 -0
index 5dd9c35f6b6f..2c8b9b3e08bb 100644
@@ -5,6 +5,7 @@ spi-nor-objs			+= atmel.o
 spi-nor-objs			+= eon.o
 spi-nor-objs			+= esmt.o
 spi-nor-objs			+= everspin.o
+spi-nor-objs			+= fudan.o
 spi-nor-objs			+= gigadevice.o
 spi-nor-objs			+= intel.o
 spi-nor-objs			+= issi.o
drivers/mtd/spi-nor/core.c +1 -0
index d3f8a78efd3b..395ff5c39883 100644
@@ -1944,6 +1944,7 @@ static const struct spi_nor_manufacturer *manufacturers[] = {
 	&spi_nor_eon,
 	&spi_nor_esmt,
 	&spi_nor_everspin,
+	&spi_nor_fudan,
 	&spi_nor_gigadevice,
 	&spi_nor_intel,
 	&spi_nor_issi,
drivers/mtd/spi-nor/core.h +1 -0
index 16b382d4f04f..be63273677c8 100644
@@ -594,6 +594,7 @@ extern const struct spi_nor_manufacturer spi_nor_atmel;
 extern const struct spi_nor_manufacturer spi_nor_eon;
 extern const struct spi_nor_manufacturer spi_nor_esmt;
 extern const struct spi_nor_manufacturer spi_nor_everspin;
+extern const struct spi_nor_manufacturer spi_nor_fudan;
 extern const struct spi_nor_manufacturer spi_nor_gigadevice;
 extern const struct spi_nor_manufacturer spi_nor_intel;
 extern const struct spi_nor_manufacturer spi_nor_issi;
drivers/mtd/spi-nor/fudan.c new file +25 -0
new file mode 100644
index 000000000000..e9a4d3ed3cd0
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Fudan Microelectronics SPI NOR flash support.
+ *
+ * JEDEC manufacturer ID 0xf7.
+ */
+
+#include <linux/mtd/spi-nor.h>
+
+#include "core.h"
+
+static const struct flash_info fudan_nor_parts[] = {
+	{
+		.id = SNOR_ID(0xf7, 0xf0, 0x30),
+		.name = "fm25q256",
+		.size = SZ_32M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	},
+};
+
+const struct spi_nor_manufacturer spi_nor_fudan = {
+	.name = "fudan",
+	.parts = fudan_nor_parts,
+	.nparts = ARRAY_SIZE(fudan_nor_parts),
+};

base-commit: 2687c848e57820651b9f69d30c4710f4219f7dbf