mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-14 00:07:09 +04:00
kernel: fix FM25G01B/FM25G02B Quad I/O read dummy
The FM25G01B/FM25G02B datasheets specify a single dummy byte for the
0xEB Quad I/O read-from-cache, but the generic read_cache_variants set
issues two. The extra dummy byte shifts the data phase and returns
corrupted data with no ECC error, breaking boot on NC-1812/KN-1812.
Use a dedicated read-from-cache variant set with ndummy=1 for 0xEB.
Both the FM25G{01,02}B support (d5a5c9eb2ee9) and this fix
(8211f2d74b35) were merged into the mtd tree (nand/next). Backport both
patches to backport-6.12 using the actual upstream commits, so they
apply to the OpenWrt kernel tree and upstream nand/next as is.
FM25G01B datasheet: https://www.fmsh.com/nvm/FM25G01B_ds_eng.pdf
FM25G02B datasheet: https://www.fmsh.com/nvm/FM25G02B_ds_eng.pdf
Signed-off-by: Aleksandr Mineev <sanderrrs@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24007
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
(cherry picked from commit 6b98618527)
[Adapted to the SPI-NAND read-from-cache op API used before the
SPINAND_PAGE_READ_FROM_CACHE_1S_4S_4S_OP-style rename: kernel 6.12
still uses SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP/_X4_OP/_DUALIO_OP/
_X2_OP/_OP instead.]
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24781
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
1 parent
af591a8097
commit
d73bf56039
1 file changed
+60
+60
@@ -0,0 +1,60 @@
|
||||
From 8211f2d74b356a02fe38aeea5b74030ac156461f Mon Sep 17 00:00:00 2001
|
||||
From: Aleksandr Mineev <sanderrrs@gmail.com>
|
||||
Date: Fri, 17 Jul 2026 18:50:50 +0300
|
||||
Subject: mtd: spinand: fmsh: fix FM25G01B/FM25G02B Quad I/O read dummy cycles
|
||||
|
||||
The FM25G01B/FM25G02B datasheets specify a single dummy byte for the
|
||||
0xEB Quad I/O read-from-cache operation, but the generic
|
||||
read_cache_variants set uses two dummy bytes for the 1S-4S-4S variant.
|
||||
The extra dummy byte shifts the data phase and returns corrupted data
|
||||
with no ECC error, breaking boot on boards using these chips.
|
||||
|
||||
Use a dedicated read-from-cache variant set with ndummy=1 for the
|
||||
1S-4S-4S (0xEB) operation.
|
||||
|
||||
FM25G01B datasheet: https://www.fmsh.com/nvm/FM25G01B_ds_eng.pdf
|
||||
FM25G02B datasheet: https://www.fmsh.com/nvm/FM25G02B_ds_eng.pdf
|
||||
|
||||
Fixes: d5a5c9eb2ee9 ("mtd: spinand: fmsh: add support for FM25G{01,02}B")
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Aleksandr Mineev <sanderrrs@gmail.com>
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
---
|
||||
drivers/mtd/nand/spi/fmsh.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/nand/spi/fmsh.c
|
||||
+++ b/drivers/mtd/nand/spi/fmsh.c
|
||||
@@ -44,6 +44,14 @@ static SPINAND_OP_VARIANTS(update_cache_
|
||||
SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
|
||||
SPINAND_PROG_LOAD(false, 0, NULL, 0));
|
||||
|
||||
+static SPINAND_OP_VARIANTS(fm25g_read_cache_variants,
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
|
||||
+
|
||||
static int fm25g01b_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||
struct mtd_oob_region *region)
|
||||
{
|
||||
@@ -192,7 +200,7 @@ static const struct spinand_info fmsh_sp
|
||||
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xd1),
|
||||
NAND_MEMORG(1, 2048, 128, 64, 1024, 21, 1, 1, 1),
|
||||
NAND_ECCREQ(8, 528),
|
||||
- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ SPINAND_INFO_OP_VARIANTS(&fm25g_read_cache_variants,
|
||||
&write_cache_variants,
|
||||
&update_cache_variants),
|
||||
SPINAND_HAS_QE_BIT,
|
||||
@@ -202,7 +210,7 @@ static const struct spinand_info fmsh_sp
|
||||
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xd2),
|
||||
NAND_MEMORG(1, 2048, 128, 64, 2048, 41, 1, 1, 1),
|
||||
NAND_ECCREQ(8, 528),
|
||||
- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ SPINAND_INFO_OP_VARIANTS(&fm25g_read_cache_variants,
|
||||
&write_cache_variants,
|
||||
&update_cache_variants),
|
||||
SPINAND_HAS_QE_BIT,
|
||||
Reference in new issue
Block a user