Signed-off-by: Hatim Kanchwala hatim@hatimak.me --- flashchips.c | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ flashchips.h | 5 +- 2 files changed, 167 insertions(+), 1 deletion(-)
diff --git a/flashchips.c b/flashchips.c index 238389b..eb6eacb 100644 --- a/flashchips.c +++ b/flashchips.c @@ -6285,26 +6285,66 @@ const struct flashchip flashchips[] = { .eraseblocks = { {1024 * 1024, 1} }, .block_erase = spi_block_erase_c7, } }, .printlock = spi_prettyprint_status_register_plain, /* TODO: improve */ .unlock = spi_disable_blockprotect, .write = spi_chip_write_256, .read = spi_chip_read, .voltage = {2700, 3600}, },
{ .vendor = "GigaDevice", + .name = "GD25VQ21B", + .bustype = BUS_SPI, + .manufacture_id = GIGADEVICE_ID, + .model_id = GIGADEVICE_GD25VQ21B, + .total_size = 256, + .page_size = 256, + /* OTP: 1536B total; read 0x48, write 0x42, erase 0x44 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { { 4 * 1024, 64} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { { 32 * 1024, 8} }, + .block_erase = spi_block_erase_52, + }, { + .eraseblocks = { { 64 * 1024, 4} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {256 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {256 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + /* TODO: 2nd Status Register; read 0x35 */ + .printlock = spi_prettyprint_status_register_bp4_srwd, + .unlock = spi_disable_blockprotect_bp4_srwd, + .write = spi_chip_write_256, + .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ + .voltage = {2300, 3600}, + }, + + { + .vendor = "GigaDevice", .name = "GD25VQ41B", .bustype = BUS_SPI, .manufacture_id = GIGADEVICE_ID, .model_id = GIGADEVICE_GD25VQ41B, .total_size = 512, .page_size = 256, /* OTP: 1536B total; read 0x48, write 0x42, erase 0x44 */ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI, .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .probe_timing = TIMING_ZERO, .block_erasers = { @@ -6324,26 +6364,149 @@ const struct flashchip flashchips[] = { .eraseblocks = { {512 * 1024, 1} }, .block_erase = spi_block_erase_c7, } }, /* TODO: 2nd Status Register; read 0x35 */ .printlock = spi_prettyprint_status_register_bp4_srwd, .unlock = spi_disable_blockprotect_bp4_srwd, .write = spi_chip_write_256, .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ .voltage = {2300, 3600}, },
{ + .vendor = "GigaDevice", + .name = "GD25VQ40C", + .bustype = BUS_SPI, + .manufacture_id = GIGADEVICE_ID, + .model_id = GIGADEVICE_GD25VQ41B, + .total_size = 512, + .page_size = 256, + /* Supports SFDP; read 0x5A */ + /* OTP: 1024B total; read 0x48, write 0x42, erase 0x44 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { { 4 * 1024, 128} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { { 32 * 1024, 16} }, + .block_erase = spi_block_erase_52, + }, { + .eraseblocks = { { 64 * 1024, 8} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {512 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {512 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + /* TODO: 2nd Status Register; read 0x35 */ + .printlock = spi_prettyprint_status_register_bp4_srwd, + .unlock = spi_disable_blockprotect_bp4_srwd, + .write = spi_chip_write_256, + .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ + .voltage = {2300, 3600}, + }, + + { + .vendor = "GigaDevice", + .name = "GD25VQ80C", + .bustype = BUS_SPI, + .manufacture_id = GIGADEVICE_ID, + .model_id = GIGADEVICE_GD25VQ80C, + .total_size = 1024, + .page_size = 256, + /* Supports SFDP; read 0x5A */ + /* OTP: 1024B total; read 0x48, write 0x42, erase 0x44 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { { 4 * 1024, 256} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { { 32 * 1024, 32} }, + .block_erase = spi_block_erase_52, + }, { + .eraseblocks = { { 64 * 1024, 16} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {1024 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {1024 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + /* TODO: 2nd Status Register; read 0x35 */ + .printlock = spi_prettyprint_status_register_bp4_srwd, + .unlock = spi_disable_blockprotect_bp4_srwd, + .write = spi_chip_write_256, + .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ + .voltage = {2300, 3600}, + }, + + { + .vendor = "GigaDevice", + .name = "GD25VQ16C", + .bustype = BUS_SPI, + .manufacture_id = GIGADEVICE_ID, + .model_id = GIGADEVICE_GD25VQ16C, + .total_size = 2 * 1024, + .page_size = 256, + /* Supports SFDP; read 0x5A */ + /* OTP: 1024B total; read 0x48, write 0x42, erase 0x44 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { { 4 * 1024, 512} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { { 32 * 1024, 64} }, + .block_erase = spi_block_erase_52, + }, { + .eraseblocks = { { 64 * 1024, 32} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {2 * 1024 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {2 * 1024 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + /* TODO: 2nd Status Register; read 0x35 */ + .printlock = spi_prettyprint_status_register_bp4_srwd, + .unlock = spi_disable_blockprotect_bp4_srwd, + .write = spi_chip_write_256, + .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ + .voltage = {2300, 3600}, + }, + + { .vendor = "Hyundai", .name = "HY29F002T", .bustype = BUS_PARALLEL, .manufacture_id = HYUNDAI_ID, .model_id = HYUNDAI_HY29F002T, .total_size = 256, .page_size = 256 * 1024, .feature_bits = FEATURE_EITHER_RESET, /* Some revisions may need FEATURE_ADDR_2AA */ .tested = TEST_OK_PRE, .probe = probe_jedec, .probe_timing = TIMING_ZERO, /* Datasheet has no timing info specified */ .block_erasers = { diff --git a/flashchips.h b/flashchips.h index a109e94..ac1901f 100644 --- a/flashchips.h +++ b/flashchips.h @@ -368,27 +368,30 @@ #define GIGADEVICE_GD25Q20 0x4012 /* Same as GD25QB */ #define GIGADEVICE_GD25Q40 0x4013 /* Same as GD25QB */ #define GIGADEVICE_GD25Q80 0x4014 /* Same as GD25Q80B (which has OTP) */ #define GIGADEVICE_GD25Q16 0x4015 /* Same as GD25Q16B (which has OTP) */ #define GIGADEVICE_GD25Q32 0x4016 /* Same as GD25Q32B */ #define GIGADEVICE_GD25Q64 0x4017 /* Same as GD25Q64B */ #define GIGADEVICE_GD25Q128 0x4018 /* GD25Q128B and GD25Q128C only, can be distinguished by SFDP */ #define GIGADEVICE_GD25LQ40 0x6013 #define GIGADEVICE_GD25LQ80 0x6014 #define GIGADEVICE_GD25LQ16 0x6015 #define GIGADEVICE_GD25LQ32 0x6016 #define GIGADEVICE_GD25LQ64 0x6017 /* Same as GD25LQ64B (which is faster) */ #define GIGADEVICE_GD25LQ128 0x6018 -#define GIGADEVICE_GD25VQ41B 0x4213 +#define GIGADEVICE_GD25VQ21B 0x4212 +#define GIGADEVICE_GD25VQ41B 0x4213 /* Same as GD25VQ40C, can be distinguished by SFDP */ +#define GIGADEVICE_GD25VQ80C 0x4214 +#define GIGADEVICE_GD25VQ16C 0x4215 #define GIGADEVICE_GD29GL064CAB 0x7E0601
#define HYUNDAI_ID 0xAD /* Hyundai */ #define HYUNDAI_HY29F400T 0x23 /* Same as HY29F400AT */ #define HYUNDAI_HY29F800B 0x58 /* Same as HY29F800AB */ #define HYUNDAI_HY29LV800B 0x5B #define HYUNDAI_HY29F040A 0xA4 #define HYUNDAI_HY29F400B 0xAB /* Same as HY29F400AB */ #define HYUNDAI_HY29F002B 0x34 #define HYUNDAI_HY29F002T 0xB0 #define HYUNDAI_HY29LV400T 0xB9 #define HYUNDAI_HY29LV400B 0xBA #define HYUNDAI_HY29F080 0xD5
+#define GIGADEVICE_GD25VQ21B 0x4212 +#define GIGADEVICE_GD25VQ41B 0x4213 /* Same as GD25VQ40C, can be distinguished by SFDP */
This comment should go in the .c file, above the model_id for the GD25VQ40C and GD25VQ41B.
Aside from that, this patch looks good to me. I tested read/write/erase on a GD25VQ41B.
Signed-off-by: Hatim Kanchwala hatim@hatimak.me --- flashchips.c | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- flashchips.h | 7 ++- 2 files changed, 167 insertions(+), 6 deletions(-)
Hi,
thanks for your patch Hatim! I have fixed some minor problems and repost the patch in case you want to edit it further (e.g. to change the test status if need be ;).
This patch and also some of the previous ones had some white space errors that we missed in the last review. Please keep a closer look at the use and numbers of tabs and spaces in flashchips.c. This is also important because we need to edit the file automatically in the future when introducing the new probing architecture and any irregularities might complicate things then. I have fixed the unrelated problems in my tested stuff branch.
diff --git a/flashchips.c b/flashchips.c index 238389b..91544e1 100644 --- a/flashchips.c +++ b/flashchips.c @@ -5983,7 +5983,7 @@ const struct flashchip flashchips[] = {
{ .vendor = "GigaDevice", - .name = "GD25Q40(B)", + .name = "GD25Q40(B)/GD25VQ40C", .bustype = BUS_SPI, .manufacture_id = GIGADEVICE_ID, .model_id = GIGADEVICE_GD25Q40, @@ -6016,7 +6016,7 @@ const struct flashchip flashchips[] = { .unlock = spi_disable_blockprotect_bp4_srwd, /* TODO: 2nd status reg (read with 0x35) */ .write = spi_chip_write_256, .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ - .voltage = {2700, 3600}, + .voltage = {2700, 3600}, /* 2.3V-3.6V for GD25VQ40C */ },
{ @@ -6295,6 +6295,45 @@ const struct flashchip flashchips[] = {
{ .vendor = "GigaDevice", + .name = "GD25VQ21B", + .bustype = BUS_SPI, + .manufacture_id = GIGADEVICE_ID, + .model_id = GIGADEVICE_GD25VQ21B, + .total_size = 256, + .page_size = 256, + /* OTP: 1536B total; read 0x48, write 0x42, erase 0x44 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { { 4 * 1024, 64} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { { 32 * 1024, 8} }, + .block_erase = spi_block_erase_52, + }, { + .eraseblocks = { { 64 * 1024, 4} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {256 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {256 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + .printlock = spi_prettyprint_status_register_bp4_srwd, + .unlock = spi_disable_blockprotect_bp4_srwd, /* TODO: 2nd status reg (read with 0x35) */ + .write = spi_chip_write_256, + .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ + .voltage = {2300, 3600}, + }, + + { + .vendor = "GigaDevice", .name = "GD25VQ41B", .bustype = BUS_SPI, .manufacture_id = GIGADEVICE_ID, @@ -6325,9 +6364,128 @@ const struct flashchip flashchips[] = { .block_erase = spi_block_erase_c7, } }, - /* TODO: 2nd Status Register; read 0x35 */ .printlock = spi_prettyprint_status_register_bp4_srwd, - .unlock = spi_disable_blockprotect_bp4_srwd, + .unlock = spi_disable_blockprotect_bp4_srwd, /* TODO: 2nd status reg (read with 0x35) */ + .write = spi_chip_write_256, + .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ + .voltage = {2300, 3600}, + }, + + { + .vendor = "GigaDevice", + .name = "GD25VQ40C", + .bustype = BUS_SPI, + .manufacture_id = GIGADEVICE_ID, + .model_id = GIGADEVICE_GD25VQ41B, + .total_size = 512, + .page_size = 256, + /* Supports SFDP */ + /* OTP: 1024B total; read 0x48, write 0x42, erase 0x44 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { { 4 * 1024, 128} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { { 32 * 1024, 16} }, + .block_erase = spi_block_erase_52, + }, { + .eraseblocks = { { 64 * 1024, 8} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {512 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {512 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + .printlock = spi_prettyprint_status_register_bp4_srwd, + .unlock = spi_disable_blockprotect_bp4_srwd, /* TODO: 2nd status reg (read with 0x35) */ + .write = spi_chip_write_256, + .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ + .voltage = {2300, 3600}, + }, + + { + .vendor = "GigaDevice", + .name = "GD25VQ80C", + .bustype = BUS_SPI, + .manufacture_id = GIGADEVICE_ID, + .model_id = GIGADEVICE_GD25VQ80C, + .total_size = 1024, + .page_size = 256, + /* Supports SFDP */ + /* OTP: 1024B total; read 0x48, write 0x42, erase 0x44 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { { 4 * 1024, 256} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { { 32 * 1024, 32} }, + .block_erase = spi_block_erase_52, + }, { + .eraseblocks = { { 64 * 1024, 16} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {1024 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {1024 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + .printlock = spi_prettyprint_status_register_bp4_srwd, + .unlock = spi_disable_blockprotect_bp4_srwd, /* TODO: 2nd status reg (read with 0x35) */ + .write = spi_chip_write_256, + .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ + .voltage = {2300, 3600}, + }, + + { + .vendor = "GigaDevice", + .name = "GD25VQ16C", + .bustype = BUS_SPI, + .manufacture_id = GIGADEVICE_ID, + .model_id = GIGADEVICE_GD25VQ16C, + .total_size = 2 * 1024, + .page_size = 256, + /* Supports SFDP */ + /* OTP: 1024B total; read 0x48, write 0x42, erase 0x44 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { { 4 * 1024, 512} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { { 32 * 1024, 64} }, + .block_erase = spi_block_erase_52, + }, { + .eraseblocks = { { 64 * 1024, 32} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {2 * 1024 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {2 * 1024 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + .printlock = spi_prettyprint_status_register_bp4_srwd, + .unlock = spi_disable_blockprotect_bp4_srwd, /* TODO: 2nd status reg (read with 0x35) */ .write = spi_chip_write_256, .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ .voltage = {2300, 3600}, diff --git a/flashchips.h b/flashchips.h index a109e94..9928b69 100644 --- a/flashchips.h +++ b/flashchips.h @@ -365,8 +365,8 @@ #define GIGADEVICE_GD25T80 0x3114 #define GIGADEVICE_GD25Q512 0x4010 #define GIGADEVICE_GD25Q10 0x4011 -#define GIGADEVICE_GD25Q20 0x4012 /* Same as GD25QB */ -#define GIGADEVICE_GD25Q40 0x4013 /* Same as GD25QB */ +#define GIGADEVICE_GD25Q20 0x4012 /* Same as GD25Q20B */ +#define GIGADEVICE_GD25Q40 0x4013 /* Same as GD25Q40B & GD25VQ40C, latter can be distinguished by SFDP */ #define GIGADEVICE_GD25Q80 0x4014 /* Same as GD25Q80B (which has OTP) */ #define GIGADEVICE_GD25Q16 0x4015 /* Same as GD25Q16B (which has OTP) */ #define GIGADEVICE_GD25Q32 0x4016 /* Same as GD25Q32B */ @@ -378,7 +378,10 @@ #define GIGADEVICE_GD25LQ32 0x6016 #define GIGADEVICE_GD25LQ64 0x6017 /* Same as GD25LQ64B (which is faster) */ #define GIGADEVICE_GD25LQ128 0x6018 +#define GIGADEVICE_GD25VQ21B 0x4212 #define GIGADEVICE_GD25VQ41B 0x4213 +#define GIGADEVICE_GD25VQ80C 0x4214 +#define GIGADEVICE_GD25VQ16C 0x4215 #define GIGADEVICE_GD29GL064CAB 0x7E0601
#define HYUNDAI_ID 0xAD /* Hyundai */