On Sat, 14 Mar 2015 15:00:10 +0000 Steven Honeyman stevenhoneyman@gmail.com wrote:
I found this in a Chinese router, read tested (twice, successful) but not yet write/erase tested. Based on information from the datasheet at http://www.chingistek.com/img/Product_Files/Pm25LQ032C%20datasheet%20v1.6.1....
Signed-off-by: Steven Honeyman stevenhoneyman@gmail.com
Hi Steven,
thanks for your patch. There are a number of similar chips (Pm25LQ020, Pm25LQ040, Pm25LQ080, Pm25LQ016). Do you want to add support for them too?
Index: flashchips.c
--- flashchips.c (revision 1888) +++ flashchips.c (working copy) @@ -9708,8 +9708,46 @@ .voltage = {2700, 3600}, /* 2.3-3.6V for Pm25LD040 */ },
-{
- { .vendor = "PMC",
.name = "Pm25LQ032",
Have you found any traces of a Pm25LQ032 without a C suffix? I don't and would rather add the C suffix here (and in the ID macro) until we have proof they really exist.
.bustype = BUS_SPI,
.manufacture_id = PMC_ID,
.model_id = PMC_PM25LQ032,
.total_size = 4096,
.page_size = 256,
.feature_bits = FEATURE_WRSR_WREN,
Missing OTP flag and information.
.tested = TEST_OK_PR,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
.block_erasers =
{
{
.eraseblocks = { {4 * 1024, 1024} },
.block_erase = spi_block_erase_20, /* sector erase */
All these comments are redundant. Experienced flashrom hacker will instantly deduce that from the erase block size(s).
}, {
.eraseblocks = { {4 * 1024, 1024} },
.block_erase = spi_block_erase_d7, /* sector erase */
}, {
.eraseblocks = { {64 * 1024, 64} },
.block_erase = spi_block_erase_d8, /* block erase */
}, {
.eraseblocks = { {4096 * 1024, 1} },
.block_erase = spi_block_erase_60, /* chip erase */
}, {
.eraseblocks = { {4096 * 1024, 1} },
.block_erase = spi_block_erase_c7, /* chip erase */
}
},
.printlock = spi_prettyprint_status_register_bp3_srwd,
bit 6 is quad enable
.unlock = spi_disable_blockprotect_bp3_srwd,
.write = spi_chip_write_256,
.read = spi_chip_read, /* Fast read (0x0B), dual I/O
supported */
Actually it supports even multi I/O
.voltage = {2700, 3600}, /* 2.7-3.6V for Pm25Q032 */
The comment there is redundant (and contains a typo). We only comment the cases where multiple chips share the same ID but have different voltage ranges. The smaller range goes into the code, the broader one gets commented.
- },
- {
.vendor = "PMC", .name = "Pm25LV512(A)", .bustype = BUS_SPI, .manufacture_id = PMC_ID_NOPREFIX,
Index: flashchips.h
--- flashchips.h (revision 1888) +++ flashchips.h (working copy) @@ -560,6 +560,7 @@ #define PMC_PM25LD512 0x20 /* Same as Pm25LD512C, but the latter has more locking options. */ #define PMC_PM25LD010 0x21 /* Same as Pm25LD010C, but the latter has more locking options. */ #define PMC_PM25LD020 0x22 /* Same as Pm25LD020C, but the latter has more locking options. */ +#define PMC_PM25LQ032 0x46 #define PMC_PM25LV512 0x7B /* Same as Pm25LV512A */ #define PMC_PM25LV010 0x7C /* Same as Pm25LV010A, but the former does not support RDID but RES3 only. */ #define PMC_PM25LV020 0x7D
The important parts are all correct and I think erase/write should just work, thank you. If you plan to add the other members of this chip's family please supersede this patch with the new one and include the corrections mentioned above. If you do not want to add them please say so and I'll correct it myself before committing.
On 4 April 2015 at 00:05, Stefan Tauner stefan.tauner@alumni.tuwien.ac.at wrote:
On Sat, 14 Mar 2015 15:00:10 +0000 Steven Honeyman stevenhoneyman@gmail.com wrote:
I found this in a Chinese router, read tested (twice, successful) but not yet write/erase tested. Based on information from the datasheet at http://www.chingistek.com/img/Product_Files/Pm25LQ032C%20datasheet%20v1.6.1....
Signed-off-by: Steven Honeyman stevenhoneyman@gmail.com
Hi Steven,
thanks for your patch. There are a number of similar chips (Pm25LQ020, Pm25LQ040, Pm25LQ080, Pm25LQ016). Do you want to add support for them too?
Hi,
Thanks for the feedback. I've made the changes and added support for the rest of the Pm25LQ family, new patch is below. The "C" part number thing is a bit strange - the *032 datasheet is the only one to have a C at the end, and has a smaller voltage range and smaller OTP size than the rest.
On 4 April 2015 at 00:05, Stefan Tauner stefan.tauner@alumni.tuwien.ac.at wrote:
.block_erase = spi_block_erase_20, /* sector erase */
All these comments are redundant. Experienced flashrom hacker will instantly deduce that from the erase block size(s).
Maybe... but that doesn't mean newbies will!
---
Add support for Pm25LQ020, Pm25LQ040, Pm25LQ080, Pm25LQ016, Pm25LQ032 Based on information from the datasheets at:
http://www.chingistek.com/img/Product_Files/Pm25LQ020-040%20datasheet%20v04.... http://www.chingistek.com/img/Product_Files/Pm25LQ080%20datasheet%20v0.4.4.p... http://www.chingistek.com/img/Product_Files/Pm25LQ016%20datasheet-final.pdf http://www.chingistek.com/img/Product_Files/Pm25LQ032C%20datasheet%20v1.6.1....
Signed-off-by: Steven Honeyman stevenhoneyman@gmail.com
Index: flashchips.c =================================================================== diff --git a/trunk/flashchips.c b/trunk/flashchips.c --- a/trunk/flashchips.c (revision 1889) +++ b/trunk/flashchips.c (working copy) @@ -9903,8 +9903,203 @@ .voltage = {2700, 3600}, /* 2.3-3.6V for Pm25LD040 */ },
-{ + { .vendor = "PMC", + .name = "Pm25LQ020", + .bustype = BUS_SPI, + .manufacture_id = PMC_ID, + .model_id = PMC_PM25LQ020, + .total_size = 256, + .page_size = 256, + /* OTP: 256B total; read 0x4B, write 0xB1 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { {4 * 1024, 64} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { {4 * 1024, 64} }, + .block_erase = spi_block_erase_d7, + }, { + .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_bp3_srwd, /* bit6 is quad enable */ + .unlock = spi_disable_blockprotect_bp3_srwd, + .write = spi_chip_write_256, + .read = spi_chip_read, + .voltage = {2300, 3600}, + }, + + { + .vendor = "PMC", + .name = "Pm25LQ040", + .bustype = BUS_SPI, + .manufacture_id = PMC_ID, + .model_id = PMC_PM25LQ040, + .total_size = 512, + .page_size = 256, + /* OTP: 256B total; read 0x4B, write 0xB1 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { {4 * 1024, 128} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { {4 * 1024, 128} }, + .block_erase = spi_block_erase_d7, + }, { + .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_bp3_srwd, /* bit6 is quad enable */ + .unlock = spi_disable_blockprotect_bp3_srwd, + .write = spi_chip_write_256, + .read = spi_chip_read, + .voltage = {2300, 3600}, + }, + + { + .vendor = "PMC", + .name = "Pm25LQ080", + .bustype = BUS_SPI, + .manufacture_id = PMC_ID, + .model_id = PMC_PM25LQ080, + .total_size = 1024, + .page_size = 256, + /* OTP: 64B total; read 0x4B, write 0xB1 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { {4 * 1024, 256} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { {4 * 1024, 256} }, + .block_erase = spi_block_erase_d7, + }, { + .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_bp3_srwd, /* bit6 is quad enable */ + .unlock = spi_disable_blockprotect_bp3_srwd, + .write = spi_chip_write_256, + .read = spi_chip_read, + .voltage = {2300, 3600}, + }, + + { + .vendor = "PMC", + .name = "Pm25LQ016", + .bustype = BUS_SPI, + .manufacture_id = PMC_ID, + .model_id = PMC_PM25LQ016, + .total_size = 2048, + .page_size = 256, + /* OTP: 256B total; read 0x4B, write 0xB1 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, + .tested = TEST_UNTESTED, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { {4 * 1024, 512} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { {4 * 1024, 512} }, + .block_erase = spi_block_erase_d7, + }, { + .eraseblocks = { {64 * 1024, 32} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {2048 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {2048 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + .printlock = spi_prettyprint_status_register_bp3_srwd, /* bit6 is quad enable */ + .unlock = spi_disable_blockprotect_bp3_srwd, + .write = spi_chip_write_256, + .read = spi_chip_read, + .voltage = {2300, 3600}, + }, + + { + .vendor = "PMC", + .name = "Pm25LQ032C", + .bustype = BUS_SPI, + .manufacture_id = PMC_ID, + .model_id = PMC_PM25LQ032C, + .total_size = 4096, + .page_size = 256, + /* OTP: 64B total; read 0x4B, write 0xB1 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, + .tested = TEST_OK_PR, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = + { + { + .eraseblocks = { {4 * 1024, 1024} }, + .block_erase = spi_block_erase_20, + }, { + .eraseblocks = { {4 * 1024, 1024} }, + .block_erase = spi_block_erase_d7, + }, { + .eraseblocks = { {64 * 1024, 64} }, + .block_erase = spi_block_erase_d8, + }, { + .eraseblocks = { {4096 * 1024, 1} }, + .block_erase = spi_block_erase_60, + }, { + .eraseblocks = { {4096 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + .printlock = spi_prettyprint_status_register_bp3_srwd, /* bit6 is quad enable */ + .unlock = spi_disable_blockprotect_bp3_srwd, + .write = spi_chip_write_256, + .read = spi_chip_read, + .voltage = {2700, 3600}, + }, + + { + .vendor = "PMC", .name = "Pm25LV512(A)", .bustype = BUS_SPI, .manufacture_id = PMC_ID_NOPREFIX, @@ -15105,7 +15300,7 @@ .read = read_memmapped, .voltage = {3000, 3600}, /* Also has 12V fast program */ }, - + { .vendor = "Unknown", .name = "SFDP-capable chip", Index: flashchips.h =================================================================== diff --git a/trunk/flashchips.h b/trunk/flashchips.h --- a/trunk/flashchips.h (revision 1889) +++ b/trunk/flashchips.h (working copy) @@ -560,6 +560,11 @@ #define PMC_PM25LD512 0x20 /* Same as Pm25LD512C, but the latter has more locking options. */ #define PMC_PM25LD010 0x21 /* Same as Pm25LD010C, but the latter has more locking options. */ #define PMC_PM25LD020 0x22 /* Same as Pm25LD020C, but the latter has more locking options. */ +#define PMC_PM25LQ020 0x42 +#define PMC_PM25LQ040 0x43 +#define PMC_PM25LQ080 0x44 +#define PMC_PM25LQ016 0x45 +#define PMC_PM25LQ032C 0x46 #define PMC_PM25LV512 0x7B /* Same as Pm25LV512A */ #define PMC_PM25LV010 0x7C /* Same as Pm25LV010A, but the former does not support RDID but RES3 only. */ #define PMC_PM25LV020 0x7D