+++ /dev/null
-From dd26402642a0899fde59ea6b0852fad3d799b4cc Mon Sep 17 00:00:00 2001
-From: George Moussalem <george.moussalem@outlook.com>
-Date: Thu, 15 May 2025 21:46:05 +0400
-Subject: mtd: spinand: esmt: fix id code for F50D1G41LB
-
-Upon detecting the ID for the ESMT F50D1G41LB chip, the fifth byte
-returned is always 0x00 instead of the expected JEDEC continuation code
-of 0x7f. This causes detection to fail:
-
-[ 0.304399] spi-nand spi0.0: unknown raw ID c8117f7f00
-[ 0.508943] spi-nand: probe of spi0.0 failed with error -524
-
-So let's revert back to the 4 byte ID code for this chip
-specifically.
-
-Fixes: 4bd14b2fd8a8 ("mtd: spinand: esmt: Extend IDs to 5 bytes")
-Signed-off-by: George Moussalem <george.moussalem@outlook.com>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
----
- drivers/mtd/nand/spi/esmt.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-(limited to 'drivers/mtd/nand/spi/esmt.c')
-
---- a/drivers/mtd/nand/spi/esmt.c
-+++ b/drivers/mtd/nand/spi/esmt.c
-@@ -129,7 +129,7 @@ static const struct spinand_info esmt_c8
- SPINAND_ECCINFO(&f50l1g41lb_ooblayout, NULL)),
- SPINAND_INFO("F50D1G41LB",
- SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x11, 0x7f,
-- 0x7f, 0x7f),
-+ 0x7f),
- NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
- NAND_ECCREQ(1, 512),
- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
Tested on Arcadyan AW1000 flashed with OpenWrt.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
+
+With 0411-mtd-rawnand-qpic-only-support-max-4-bytes-ID.patch, we can
+define 5 bytes ID here.
+
+Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
---
drivers/mtd/nand/raw/nand_ids.c | 3 +++
1 file changed, 3 insertions(+)
SZ_16K, SZ_8K, SZ_4M, NAND_NEED_SCRAMBLING, 6, 1664,
NAND_ECC_INFO(40, SZ_1K) },
+ {"TH58NYG3S0HBAI4 8G 1.8V 8-bit", /* Last ID bytes missing */
-+ { .id = {0x98, 0xa3, 0x91, 0x26} },
-+ SZ_4K, SZ_1K, SZ_256K, 0, 4, 256, NAND_ECC_INFO(8, SZ_512) },
++ { .id = {0x98, 0xa3, 0x91, 0x26, 0x76} },
++ SZ_4K, SZ_1K, SZ_256K, 0, 5, 256, NAND_ECC_INFO(8, SZ_512) },
{"TH58NVG2S3HBAI4 4G 3.3V 8-bit",
{ .id = {0x98, 0xdc, 0x91, 0x15, 0x76} },
SZ_2K, SZ_512, SZ_128K, 0, 5, 128, NAND_ECC_INFO(8, SZ_512) },
--- /dev/null
+From ce4d8b3c5e866a8c515608cf623990e1471a69c7 Mon Sep 17 00:00:00 2001
+From: Ziyang Huang <hzyitc@outlook.com>
+Date: Tue, 2 Dec 2025 22:02:30 +0800
+Subject: [PATCH 1/2] mtd: rawnand: qpic only support max 4 bytes ID
+
+QPIC use a reg (NAND_READ_ID) to transport the ID, so the max bytes of ID is a word (4Bytes).
+
+https://github.com/torvalds/linux/blob/3a8660878839faadb4f1a6dd72c3179c1df56787/drivers/mtd/nand/raw/qcom_nandc.c#L1783
+
+Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
+---
+ drivers/mtd/nand/raw/nand_base.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/raw/nand_base.c
++++ b/drivers/mtd/nand/raw/nand_base.c
+@@ -4955,7 +4955,7 @@ static bool find_full_id_nand(struct nan
+
+ memorg = nanddev_get_memorg(&chip->base);
+
+- if (!strncmp(type->id, id_data, type->id_len)) {
++ if (!strncmp(type->id, id_data, min(4, type->id_len))) {
+ memorg->pagesize = type->pagesize;
+ mtd->writesize = memorg->pagesize;
+ memorg->pages_per_eraseblock = type->erasesize /
--- /dev/null
+From cf5225a6e279995a574a5ed97cb227b5e076ed8e Mon Sep 17 00:00:00 2001
+From: Ziyang Huang <hzyitc@outlook.com>
+Date: Sun, 8 Sep 2024 16:40:11 +0800
+Subject: [PATCH 2/2] mtd: spinand: qpic only support max 4 bytes ID
+
+QPIC use a reg (NAND_READ_ID) to transport the ID, so the max bytes of ID is a word (4Bytes).
+
+https://github.com/torvalds/linux/blob/4a26e7032d7d57c998598c08a034872d6f0d3945/drivers/spi/spi-qpic-snand.c#L1392-L1393
+
+Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
+---
+ drivers/mtd/nand/spi/core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/spi/core.c
++++ b/drivers/mtd/nand/spi/core.c
+@@ -1337,7 +1337,7 @@ int spinand_match_and_init(struct spinan
+ if (rdid_method != info->devid.method)
+ continue;
+
+- if (memcmp(id + 1, info->devid.id, info->devid.len))
++ if (memcmp(id + 1, info->devid.id, min(3, info->devid.len)))
+ continue;
+
+ nand->memorg = table[i].memorg;