Skip to content

Commit 92c7fee

Browse files
hzyitcrobimarko
authored andcommitted
qualcommax: 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 https://github.com/torvalds/linux/blob/4a26e7032d7d57c998598c08a034872d6f0d3945/drivers/spi/spi-qpic-snand.c#L1392-L1393 Signed-off-by: Ziyang Huang <hzyitc@outlook.com> Link: openwrt#21021 Signed-off-by: Robert Marko <robimarko@gmail.com>
1 parent bb76ac1 commit 92c7fee

4 files changed

Lines changed: 57 additions & 37 deletions

target/linux/qualcommax/patches-6.12/0055-v6.16-mtd-spinand-esmt-fix-id-code-for-F50D1G41LB.patch

Lines changed: 0 additions & 35 deletions
This file was deleted.

target/linux/qualcommax/patches-6.12/0400-mtd-rawnand-add-support-for-TH58NYG3S0HBAI4.patch

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ nand flash is like this. Anyway, add a static NAND ID entry with only
2424
Tested on Arcadyan AW1000 flashed with OpenWrt.
2525

2626
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
27+
28+
With 0411-mtd-rawnand-qpic-only-support-max-4-bytes-ID.patch, we can
29+
define 5 bytes ID here.
30+
31+
Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
2732
---
2833
drivers/mtd/nand/raw/nand_ids.c | 3 +++
2934
1 file changed, 3 insertions(+)
@@ -35,8 +40,8 @@ Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
3540
SZ_16K, SZ_8K, SZ_4M, NAND_NEED_SCRAMBLING, 6, 1664,
3641
NAND_ECC_INFO(40, SZ_1K) },
3742
+ {"TH58NYG3S0HBAI4 8G 1.8V 8-bit", /* Last ID bytes missing */
38-
+ { .id = {0x98, 0xa3, 0x91, 0x26} },
39-
+ SZ_4K, SZ_1K, SZ_256K, 0, 4, 256, NAND_ECC_INFO(8, SZ_512) },
43+
+ { .id = {0x98, 0xa3, 0x91, 0x26, 0x76} },
44+
+ SZ_4K, SZ_1K, SZ_256K, 0, 5, 256, NAND_ECC_INFO(8, SZ_512) },
4045
{"TH58NVG2S3HBAI4 4G 3.3V 8-bit",
4146
{ .id = {0x98, 0xdc, 0x91, 0x15, 0x76} },
4247
SZ_2K, SZ_512, SZ_128K, 0, 5, 128, NAND_ECC_INFO(8, SZ_512) },
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From ce4d8b3c5e866a8c515608cf623990e1471a69c7 Mon Sep 17 00:00:00 2001
2+
From: Ziyang Huang <hzyitc@outlook.com>
3+
Date: Tue, 2 Dec 2025 22:02:30 +0800
4+
Subject: [PATCH 1/2] mtd: rawnand: qpic only support max 4 bytes ID
5+
6+
QPIC use a reg (NAND_READ_ID) to transport the ID, so the max bytes of ID is a word (4Bytes).
7+
8+
https://github.com/torvalds/linux/blob/3a8660878839faadb4f1a6dd72c3179c1df56787/drivers/mtd/nand/raw/qcom_nandc.c#L1783
9+
10+
Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
11+
---
12+
drivers/mtd/nand/raw/nand_base.c | 2 +-
13+
1 file changed, 1 insertion(+), 1 deletion(-)
14+
15+
--- a/drivers/mtd/nand/raw/nand_base.c
16+
+++ b/drivers/mtd/nand/raw/nand_base.c
17+
@@ -4955,7 +4955,7 @@ static bool find_full_id_nand(struct nan
18+
19+
memorg = nanddev_get_memorg(&chip->base);
20+
21+
- if (!strncmp(type->id, id_data, type->id_len)) {
22+
+ if (!strncmp(type->id, id_data, min(4, type->id_len))) {
23+
memorg->pagesize = type->pagesize;
24+
mtd->writesize = memorg->pagesize;
25+
memorg->pages_per_eraseblock = type->erasesize /
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From cf5225a6e279995a574a5ed97cb227b5e076ed8e Mon Sep 17 00:00:00 2001
2+
From: Ziyang Huang <hzyitc@outlook.com>
3+
Date: Sun, 8 Sep 2024 16:40:11 +0800
4+
Subject: [PATCH 2/2] mtd: spinand: qpic only support max 4 bytes ID
5+
6+
QPIC use a reg (NAND_READ_ID) to transport the ID, so the max bytes of ID is a word (4Bytes).
7+
8+
https://github.com/torvalds/linux/blob/4a26e7032d7d57c998598c08a034872d6f0d3945/drivers/spi/spi-qpic-snand.c#L1392-L1393
9+
10+
Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
11+
---
12+
drivers/mtd/nand/spi/core.c | 2 +-
13+
1 file changed, 1 insertion(+), 1 deletion(-)
14+
15+
--- a/drivers/mtd/nand/spi/core.c
16+
+++ b/drivers/mtd/nand/spi/core.c
17+
@@ -1337,7 +1337,7 @@ int spinand_match_and_init(struct spinan
18+
if (rdid_method != info->devid.method)
19+
continue;
20+
21+
- if (memcmp(id + 1, info->devid.id, info->devid.len))
22+
+ if (memcmp(id + 1, info->devid.id, min(3, info->devid.len)))
23+
continue;
24+
25+
nand->memorg = table[i].memorg;

0 commit comments

Comments
 (0)