0400-mtd-rawnand-add-support-for-TH58NYG3S0HBAI4.patch 1.8 KB

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