kernel/qualcommax: Create kernel files for v6.6 (from v6.1)
[openwrt/staging/stintel.git] / target / linux / qualcommax / patches-6.6 / 0400-mtd-rawnand-add-support-for-TH58NYG3S0HBAI4.patch
1 From 8d8b37d3af2bdccf0a37d2017d876bfc6ce42552 Mon Sep 17 00:00:00 2001
2 From: Chukun Pan <amadeus@jmu.edu.cn>
3 Date: Fri, 20 Oct 2023 23:18:21 +0800
4 Subject: [PATCH 1/1] mtd: rawnand: add support for TH58NYG3S0HBAI4 NAND flash
5
6 The Toshiba TH58NYG3S0HBAI4 is detected with 128 byte OOB while the flash
7 has 256 bytes OOB. Since it is not an ONFI compliant NAND, the model name
8 cannot be read from anywhere, add a static NAND ID entry to correct this.
9
10 However, the NAND ID of this flash is inconsistent with the datasheet.
11 The actual NAND ID is only 4 ID bytes, the last ID byte is missing.
12
13 Datasheet available at (the ID table is on page 50):
14 https://europe.kioxia.com/content/dam/kioxia/newidr/productinfo/datasheet/201910/DST_TH58NYG3S0HBAI4-TDE_EN_31565.pdf
15
16 Datasheet NAND ID: {0x98, 0xa3, 0x91, 0x26, 0x76}
17 Actual NAND ID: {0x98, 0xa3, 0x91, 0x26}
18
19 It seems that this flash may be counterfeit, but another Toshiba flash
20 also has the same problem. Maybe the driver has a bug, or some Toshiba
21 nand flash is like this. Anyway, add a static NAND ID entry with only
22 4 ID bytes as a hack to make sure it works.
23
24 Tested on Arcadyan AW1000 flashed with OpenWrt.
25
26 Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
27 ---
28 drivers/mtd/nand/raw/nand_ids.c | 3 +++
29 1 file changed, 3 insertions(+)
30
31 --- a/drivers/mtd/nand/raw/nand_ids.c
32 +++ b/drivers/mtd/nand/raw/nand_ids.c
33 @@ -55,6 +55,9 @@ struct nand_flash_dev nand_flash_ids[] =
34 { .id = {0xad, 0xde, 0x14, 0xa7, 0x42, 0x4a} },
35 SZ_16K, SZ_8K, SZ_4M, NAND_NEED_SCRAMBLING, 6, 1664,
36 NAND_ECC_INFO(40, SZ_1K) },
37 + {"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) },
40 {"TH58NVG2S3HBAI4 4G 3.3V 8-bit",
41 { .id = {0x98, 0xdc, 0x91, 0x15, 0x76} },
42 SZ_2K, SZ_512, SZ_128K, 0, 5, 128, NAND_ECC_INFO(8, SZ_512) },