From: Pengji Li <wjjsn@qq.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>, linux-mtd@lists.infradead.org
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Daniel Palmer <daniel@0x0f.com>,
linux-kernel@vger.kernel.org, Pengji Li <wjjsn@qq.com>
Subject: [PATCH] mtd: spinand: foresee: Add support for FS35ND01G-S1Y2
Date: Sun, 6 Dec 2026 09:56:02 +0800 [thread overview]
Message-ID: <tencent_1C2EB0529BA7F35EC3D29801F15479667909@qq.com> (raw)
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
next reply other threads:[~2026-12-06 1:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 1:56 Pengji Li [this message]
2026-12-06 2:23 ` Daniel Palmer
2026-12-06 8:48 ` Pengji Li
2026-12-06 8:53 ` Daniel Palmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_1C2EB0529BA7F35EC3D29801F15479667909@qq.com \
--to=wjjsn@qq.com \
--cc=daniel@0x0f.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®