All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spinand: foresee: Add support for FS35ND01G-S1Y2
@ 2026-12-06  1:56 ` Pengji Li
  0 siblings, 0 replies; 5+ messages in thread
From: Pengji Li @ 2026-12-06  1:56 UTC (permalink / raw)
  To: Miquel Raynal, linux-mtd
  Cc: Richard Weinberger, Vignesh Raghavendra, Daniel Palmer,
	linux-kernel, Pengji Li

Add the CD EA 11 device using the geometry and cache read operations
from Daniel Palmer's earlier submission. Reuse the existing FORESEE
program-load and cache-update variants for single and quad writes.

The device requires four bits of ECC per 512 bytes. Reuse the default
SPI-NAND ECC status handling and OOB layout. Status 00 does not
distinguish a clean read from up to three corrected bits in an ECC
step; status 01 reports four corrected bits.

The device allows one PROGRAM EXECUTE per page and requires programming
pages in increasing order within an eraseblock. The driver uses the
existing SPI-NAND write path without tracking the history of each page.

Link: https://lore.kernel.org/linux-mtd/20210811084924.52293-1-daniel@0x0f.com/
Signed-off-by: Pengji Li <wjjsn@qq.com>
---
Testing:

The 2021 review observed successful ECC reads with incorrect data.
nandbiterrs injects errors by programming the same page again, beyond
the device's one-program-per-page limit. nandflipbits erases the block
and restores only visible data and OOB, so it cannot preserve the
original hidden ECC. These tests do not establish the device's on-die
ECC behavior at four bitflips under the specified programming limits.

On a TCL T20 Pro running a Linux 6.18.64 OpenWrt RAM image, four raw
reads of a once-programmed page after read disturb each showed two
bitflips in the same 512-byte ECC step. In all four paired reads with
on-die ECC enabled, the entire 2048-byte page matched the original.
This used the existing SPI-NAND read path. Separate 6.18.64 RAM images
verified single and quad program loads and data readback on this board.

The available setup cannot manually inject four or more errors into
the same ECC step while preserving the original hidden ECC and
respecting the device's programming limits. Three-bit correction,
four-bit correction and uncorrectable reads above four bits remain
unverified on hardware.

This mtd/next version was build-tested with W=1 on MIPS; the board
results above are from Linux 6.18.64.

OpenCode assisted with the implementation and T20 Pro tests.

 drivers/mtd/nand/spi/foresee.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/mtd/nand/spi/foresee.c b/drivers/mtd/nand/spi/foresee.c
index 5ff183160..f323f5c98 100644
--- a/drivers/mtd/nand/spi/foresee.c
+++ b/drivers/mtd/nand/spi/foresee.c
@@ -94,6 +94,13 @@ static int f35sqb002g_ecc_get_status(struct spinand_device *spinand, u8 status)
 	return -EINVAL;
 }
 
+static SPINAND_OP_VARIANTS(fs35nd01g_read_cache_variants,
+		SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP(0, 2, NULL, 0, 0),
+		SPINAND_PAGE_READ_FROM_CACHE_1S_1S_4S_OP(0, 1, NULL, 0, 0),
+		SPINAND_PAGE_READ_FROM_CACHE_1S_2S_2S_OP(0, 1, NULL, 0, 0),
+		SPINAND_PAGE_READ_FROM_CACHE_1S_1S_2S_OP(0, 1, NULL, 0, 0),
+		SPINAND_PAGE_READ_FROM_CACHE_1S_1S_1S_OP(0, 1, NULL, 0, 0));
+
 static const struct spinand_info foresee_spinand_table[] = {
 	SPINAND_INFO("F35SQA002G",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x72, 0x72),
@@ -125,6 +132,14 @@ static const struct spinand_info foresee_spinand_table[] = {
 		     SPINAND_HAS_QE_BIT,
 		     SPINAND_ECCINFO(&f35sqa002g_ooblayout,
 				     f35sqb002g_ecc_get_status)),
+	SPINAND_INFO("FS35ND01G-S1Y2",
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xea, 0x11),
+		     NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
+		     NAND_ECCREQ(4, 512),
+		     SPINAND_INFO_OP_VARIANTS(&fs35nd01g_read_cache_variants,
+					      &write_cache_variants,
+					      &update_cache_variants),
+		     SPINAND_HAS_QE_BIT, SPINAND_ECCINFO(NULL, NULL)),
 };
 
 static const struct spinand_manufacturer_ops foresee_spinand_manuf_ops = {

base-commit: b3b86fbd14b98c6a1786308ba0ecd666827dcb0e


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-06  2:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-06  1:56 [PATCH] mtd: spinand: foresee: Add support for FS35ND01G-S1Y2 Pengji Li
2026-12-06  1:56 ` Pengji Li
2026-12-06  2:13 ` sashiko-bot
2026-12-06  2:23 ` Daniel Palmer
2026-12-06  2:23   ` Daniel Palmer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.