flashchips: Add some GigaDevice GD25L*256 1.8V parts
Here's a bunch of chips that all share the same ID. They differ however
in their block-protection support (which is where we split them), their
support for native 4BA commands, and their logic to configure dummy cy-
cles in SPI mode.
Datasheets used:
https://www.gigadevice.com.cn/Public/Uploads/uploadfile/files/20220714/DS-00301-GD25LQ256D-Rev2.0.pdf
https://www.gigadevice.com.cn/Public/Uploads/uploadfile/files/20220714/DS-00282-GD25LE256D-Rev1.7.pdf
https://www.gigadevice.com.cn/Public/Uploads/uploadfile/files/20220714/DS-00314-GD25LB256D-Rev1.4.pdf
https://www.gigadevice.com.cn/Public/Uploads/uploadfile/files/20240729/DS-00562-GD25LQ255E-Rev1.2.pdf
https://www.gigadevice.com.cn/Public/Uploads/uploadfile/files/20241211/DS-01085-GD25LQ256H-Rev1.1.pdf
https://www.gigadevice.com.cn/Public/Uploads/uploadfile/files/20241211/DS-01113-GD25LE256H-Rev1.1.pdf
https://www.gigadevice.com.cn/Public/Uploads/uploadfile/files/20230926/DS-00978-GD25LB256F-Rev1.0.pdf
https://www.gigadevice.com.cn/Public/Uploads/uploadfile/files/20220714/DS-00619-GD25LE255E-Rev1.2.pdf
Change-Id: Id995c53f371c9b83dabe5fb6f881954a7e7f4f59
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/303
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/flashchips.c b/flashchips.c
index 7fb4f21..c8b9b1c 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -7423,6 +7423,197 @@
{
.vendor = "GigaDevice",
+ .name = "GD25LQ256D/GD25LE256D/GD25LB256D/GD25LQ255E",
+ .bustype = BUS_SPI,
+ .manufacture_id = GIGADEVICE_ID,
+ .model_id = GIGADEVICE_GD25LQ256D,
+ .total_size = 32768,
+ .page_size = 256,
+ /* GD25LQ255E also supports native 4BA commands, EAR. */
+ .feature_bits = FEATURE_WRSR_EITHER | FEATURE_WRSR_EXT2 | FEATURE_OTP |
+ FEATURE_4BA_ENTER | FEATURE_QPI_SRP,
+ .dummy_cycles = { .qpi_read_params = { 4, 6, 8, 8 } },
+ .tested = TEST_UNTESTED,
+ .probe = probe_spi_rdid,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 8192} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 1024} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 512} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {32 * 1024 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {32 * 1024 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
+ .printlock = spi_prettyprint_status_register_bp4_srwd,
+ .unlock = spi_disable_blockprotect_bp4_srwd,
+ .write = spi_chip_write_256,
+ .read = spi_chip_read,
+ .voltage = {1650, 2000},
+ .reg_bits =
+ {
+ .qe = {STATUS2, 1, RW}, /* GD25LB256D: Fixed QE=1 */
+ .srp = {STATUS1, 7, RW},
+ .srl = {STATUS2, 0, RW},
+ .bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}},
+ .tb = {STATUS1, 5, RW},
+ .sec = {STATUS1, 6, RW},
+ .cmp = {STATUS2, 6, RW},
+ },
+ .wp_write_cfg = spi_wp_write_cfg,
+ .wp_read_cfg = spi_wp_read_cfg,
+ .wp_get_ranges = spi_wp_get_available_ranges,
+ .decode_range = decode_range_spi25,
+ .prepare_access = spi_prepare_io,
+ .finish_access = spi_finish_io,
+ },
+
+ {
+ .vendor = "GigaDevice",
+ .name = "GD25LQ256H/GD25LE256H/GD25LB256F",
+ .bustype = BUS_SPI,
+ .manufacture_id = GIGADEVICE_ID,
+ .model_id = GIGADEVICE_GD25LQ256D,
+ .total_size = 32768,
+ .page_size = 256,
+ /* Has non-volatile DC bits which affect DIO and QIO in SPI mode. */
+ /* LE256H supports DTR. */
+ .feature_bits = FEATURE_WRSR_EITHER | FEATURE_WRSR_EXT2 | FEATURE_WRSR3 |
+ FEATURE_OTP | FEATURE_4BA | FEATURE_FAST_READ_QPI4B |
+ (FEATURE_QPI_SRP & ~(FEATURE_FAST_READ_DIO | FEATURE_FAST_READ_QIO)),
+ .dummy_cycles = { .qpi_read_params = { 4, 6, 8, 8 } },
+ .tested = TEST_UNTESTED,
+ .probe = probe_spi_rdid,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 8192} },
+ .block_erase = spi_block_erase_21,
+ }, {
+ .eraseblocks = { {4 * 1024, 8192} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 1024} },
+ .block_erase = spi_block_erase_5c,
+ }, {
+ .eraseblocks = { {32 * 1024, 1024} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 512} },
+ .block_erase = spi_block_erase_dc,
+ }, {
+ .eraseblocks = { {64 * 1024, 512} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {32 * 1024 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {32 * 1024 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
+ .printlock = spi_prettyprint_status_register_bp4_srwd,
+ .unlock = spi_disable_blockprotect_bp4_srwd,
+ .write = spi_chip_write_256,
+ .read = spi_chip_read,
+ .voltage = {1650, 2000},
+ .reg_bits =
+ {
+ .qe = {STATUS2, 1, RW}, /* GD25LB256F: Fixed QE=1 */
+ .dc = {{STATUS3, 0, RW}, {STATUS3, 1, RW}},
+ .srp = {STATUS1, 7, RW},
+ .srl = {STATUS2, 0, RW},
+ .bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}, {STATUS1, 5, RW}},
+ .tb = {STATUS1, 6, RW},
+ .cmp = {STATUS2, 6, RW},
+ },
+ .wp_write_cfg = spi_wp_write_cfg,
+ .wp_read_cfg = spi_wp_read_cfg,
+ .wp_get_ranges = spi_wp_get_available_ranges,
+ .decode_range = decode_range_spi25,
+ .prepare_access = spi_prepare_io,
+ .finish_access = spi_finish_io,
+ },
+
+ {
+ .vendor = "GigaDevice",
+ .name = "GD25LE255E",
+ .bustype = BUS_SPI,
+ .manufacture_id = GIGADEVICE_ID,
+ .model_id = GIGADEVICE_GD25LQ256D,
+ .total_size = 32768,
+ .page_size = 256,
+ /* Non-volatile DC bits control SPI mode, hence disable fast-read commands. */
+ .feature_bits = FEATURE_WRSR_EITHER | FEATURE_WRSR_EXT2 | FEATURE_WRSR3 |
+ FEATURE_OTP | (FEATURE_4BA & ~FEATURE_4BA_FAST_READ) |
+ FEATURE_FAST_READ_QPI4B | (FEATURE_QPI_SRP & ~FEATURE_QIO),
+ .dummy_cycles = { .qpi_read_params = { 4, 6, 8, } },
+ .tested = TEST_UNTESTED,
+ .probe = probe_spi_rdid,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 8192} },
+ .block_erase = spi_block_erase_21,
+ }, {
+ .eraseblocks = { {4 * 1024, 8192} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 1024} },
+ .block_erase = spi_block_erase_5c,
+ }, {
+ .eraseblocks = { {32 * 1024, 1024} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 512} },
+ .block_erase = spi_block_erase_dc,
+ }, {
+ .eraseblocks = { {64 * 1024, 512} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {32 * 1024 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {32 * 1024 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
+ .printlock = spi_prettyprint_status_register_bp4_srwd,
+ .unlock = spi_disable_blockprotect_bp4_srwd,
+ .write = spi_chip_write_256,
+ .read = spi_chip_read,
+ .voltage = {1650, 2000},
+ .reg_bits =
+ {
+ .qe = {STATUS2, 1, RW},
+ .dc = {{STATUS3, 0, RW}, {STATUS3, 1, RW}},
+ .srp = {STATUS1, 7, RW},
+ .srl = {STATUS2, 0, RW},
+ .bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}, {STATUS1, 5, RW}},
+ .tb = {STATUS1, 6, RW},
+ },
+ .wp_write_cfg = spi_wp_write_cfg,
+ .wp_read_cfg = spi_wp_read_cfg,
+ .wp_get_ranges = spi_wp_get_available_ranges,
+ .decode_range = decode_range_spi25,
+ .prepare_access = spi_prepare_io,
+ .finish_access = spi_finish_io,
+ },
+
+ {
+ .vendor = "GigaDevice",
.name = "GD25LQ32",
.bustype = BUS_SPI,
.manufacture_id = GIGADEVICE_ID,
diff --git a/include/flashchips.h b/include/flashchips.h
index e901069..7871077 100644
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -415,6 +415,7 @@
#define GIGADEVICE_GD25LQ32 0x6016
#define GIGADEVICE_GD25LQ64 0x6017 /* Same as GD25LQ64B (which is faster) */
#define GIGADEVICE_GD25LQ128CD 0x6018
+#define GIGADEVICE_GD25LQ256D 0x6019 /* Same as GD25L[EB]256D/GD25LQ255E/GD25L[QE]256H/GD25LB256F/GD25LE255E */
#define GIGADEVICE_GD25LR512ME 0x671a
#define GIGADEVICE_GD25WQ80E 0x6514
#define GIGADEVICE_GD29GL064CAB 0x7E0601