From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=162.62.57.137 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796522209; b=RfPf5zTJTqOCBx2MNeEMT+Hwj/ILkQ6XAtjQKGN+F0STAm8kq38bWfqkA26iDtmN13kY cjucEMzFKR6eUF9D6gIcbh3TdTa2Nl0Ja/SXKcrfn1qISGM+rvPTIwoeJ5yZGok6kUI3m dFDHcWt9uoawb+cbwbw1khAaKb7bAiPh188vpw8QNcqAoaSl91eQ22Onf23hPAvZd1Apr 4mgGPv2YstPzj5Vet+ZRzG9zl0QUO0ihvdfVR5jgXFlZpimenRZis5E+nLSlGcgAXCs4v WCGmtbjbMs0gr1325BeqA79bUobW/GCBNxmvbuSuytSYGBpEWlKUaryIkZdcMw8TCRA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796522209; h=DMARC-Filter:DKIM-Signature:Received:X-QQ-mid:Message-ID: X-QQ-XMAILINFO:X-QQ-XMRINFO:From:To:Cc:Subject:Date:X-OQ-MSGID: X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=eFIjkssjDxRHuglh6ESlzJPOOS9Nqfzgiig+tql329Q=; b=x/GBETjrVcpXy0hHI0glctPKPm7+iNCDr4uAsUyWg9S79AbPGoAA4mkxR1LDLtnCOUOZ giPMw5ub6Gr+T+5aNyyZv3V+abqBbXcpDHj+YM50DoXAFgt3panHSpv7y4H3AV+Ivsoe7 X60c8e7M5AixU8Ba0BEQMhkZkk+nmsW16uNfVO10LgHwuHNPHzS0WPRalkkD2jEynjx/a Ej64eKgwLMKlYfh1annyvNAElinV0IImRdgGB432AjrDX5fb4soWFnb5k1IanV3OCuQiM yViOr+woFMEbgpx4/rhfkNae47Dn/qUZEOV6gZP0uZbEO7wfdjqhMZnkA2kPIsTAa1Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass header.d=qq.com header.i=@qq.com header.a=rsa-sha256 header.s=s201512 header.b=GnU9j7+f; arc=none smtp.remote-ip=162.62.57.137 Received: from out162-62-57-137.mail.qq.com (out162-62-57-137.mail.qq.com [162.62.57.137]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99D68606A31F for ; Sun, 6 Dec 2026 01:56:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 99D68606A31F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=qq.com header.i=@qq.com header.a=rsa-sha256 header.s=s201512 header.b=GnU9j7+f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1796522197; bh=eFIjkssjDxRHuglh6ESlzJPOOS9Nqfzgiig+tql329Q=; h=From:To:Cc:Subject:Date; b=GnU9j7+fyS0sQz9hKzzz38ktpDgxrMeBsq/C4flE4YTDhGu+dAo6hMznFKz8xnYSs bq0KizlMteKIiBlkl9W7Bf0vBanAGUwAj/v+x1abbjKdBqtkbGNDYyQGBuQrbbQ3dV j1zW4pE8LYJgUmAL/pEc39QI0Nd8x6cxC5vL3NR0= Received: from MYJGMC.localdomain ([180.173.165.54]) by newxmesmtplogicsvrszc50-0.qq.com (NewEsmtp) with SMTP id E22A3070; Sun, 06 Dec 2026 09:56:34 +0800 X-QQ-mid: xmsmtpt1796522194tnphuf6e9 Message-ID: X-QQ-XMAILINFO: N7qqMxIPUfzld53p9wUsTgwi7c1JcIhlhXg1przn2jQjn6j/0GoEByIkDiIrSR FcqmFdyJ+u4PLrbF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xK/fD5g== From: Pengji Li To: Miquel Raynal , linux-mtd@lists.infradead.org Cc: Richard Weinberger , Vignesh Raghavendra , Daniel Palmer , linux-kernel@vger.kernel.org, Pengji Li Subject: [PATCH] mtd: spinand: foresee: Add support for FS35ND01G-S1Y2 Date: Sun, 6 Dec 2026 09:56:02 +0800 X-OQ-MSGID: <20261206015602.214409-1-wjjsn@qq.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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