Refine PMC Pm25LV series
- Add missing bits and resort chips
- Refine Pm25LV512(A) and Pm25LV010
Due to manufacturer ID continuation this one needs a new probing
function: probe_spi_res3() which should be refactored in the future.
The datasheet describes a very weird order of ID bytes:
Vendor byte, model byte, vendor continuation byte. Let's pretend we did
not read that or the datasheet is bogus (although the datasheet of the
successor series describes the same but luckily additionally to RDID).
- Add Pm25LV010A
This was tested by Chi Zhang:
http://paste.flashrom.org/view.php?id=1573
Corresponding to flashrom svn r1670.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
diff --git a/chipdrivers.h b/chipdrivers.h
index f0223ae..243b64a 100644
--- a/chipdrivers.h
+++ b/chipdrivers.h
@@ -38,6 +38,7 @@
int probe_spi_rems(struct flashctx *flash);
int probe_spi_res1(struct flashctx *flash);
int probe_spi_res2(struct flashctx *flash);
+int probe_spi_res3(struct flashctx *flash);
int probe_spi_at25f(struct flashctx *flash);
int spi_write_enable(struct flashctx *flash);
int spi_write_disable(struct flashctx *flash);
diff --git a/flashchips.c b/flashchips.c
index 16726ad..22ff2d7 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -6562,6 +6562,38 @@
{
.vendor = "PMC",
+ .name = "Pm25LV512(A)",
+ .bustype = BUS_SPI,
+ .manufacture_id = PMC_ID,
+ .model_id = PMC_PM25LV512,
+ .total_size = 64,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_WREN,
+ .tested = TEST_UNTESTED,
+ .probe = probe_spi_res3,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 16} },
+ .block_erase = spi_block_erase_d7,
+ }, {
+ .eraseblocks = { {32 * 1024, 2} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {64 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
+ .printlock = spi_prettyprint_status_register_default_bp1,
+ .unlock = spi_disable_blockprotect,
+ .write = spi_chip_write_256,
+ .read = spi_chip_read, /* Fast read (0x0B) supported */
+ .voltage = {2700, 3600},
+ },
+
+ {
+ .vendor = "PMC",
.name = "Pm25LV010",
.bustype = BUS_SPI,
.manufacture_id = PMC_ID,
@@ -6570,6 +6602,38 @@
.page_size = 256,
.feature_bits = FEATURE_WRSR_WREN,
.tested = TEST_UNTESTED,
+ .probe = probe_spi_res3,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 32} },
+ .block_erase = spi_block_erase_d7,
+ }, {
+ .eraseblocks = { {32 * 1024, 4} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {128 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
+ .printlock = spi_prettyprint_status_register_default_bp1,
+ .unlock = spi_disable_blockprotect,
+ .write = spi_chip_write_256,
+ .read = spi_chip_read, /* Fast read (0x0B) supported */
+ .voltage = {2700, 3600},
+ },
+
+ {
+ .vendor = "PMC",
+ .name = "Pm25LV010A",
+ .bustype = BUS_SPI,
+ .manufacture_id = PMC_ID,
+ .model_id = PMC_PM25LV010,
+ .total_size = 128,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_WREN,
+ .tested = TEST_OK_PREW,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
.block_erasers =
@@ -6585,48 +6649,10 @@
.block_erase = spi_block_erase_c7,
}
},
- .printlock = spi_prettyprint_status_register_plain, /* TODO: improve */
+ .printlock = spi_prettyprint_status_register_default_bp1,
.unlock = spi_disable_blockprotect,
.write = spi_chip_write_256,
- .read = spi_chip_read,
- .voltage = {2700, 3600},
- },
-
- {
- .vendor = "PMC",
- .name = "Pm25LV016B",
- .bustype = BUS_SPI,
- .manufacture_id = PMC_ID,
- .model_id = PMC_PM25LV016B,
- .total_size = 2048,
- .page_size = 256,
- .feature_bits = FEATURE_WRSR_WREN,
- .tested = TEST_UNTESTED,
- .probe = probe_spi_rdid,
- .probe_timing = TIMING_ZERO,
- .block_erasers =
- {
- {
- .eraseblocks = { {4 * 1024, 512} },
- .block_erase = spi_block_erase_d7,
- }, {
- .eraseblocks = { {4 * 1024, 512} },
- .block_erase = spi_block_erase_20,
- }, {
- .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_plain, /* TODO: improve */
- .unlock = spi_disable_blockprotect,
- .write = spi_chip_write_256,
- .read = spi_chip_read,
+ .read = spi_chip_read, /* Fast read (0x0B) supported */
.voltage = {2700, 3600},
},
@@ -6655,7 +6681,7 @@
.block_erase = spi_block_erase_c7,
}
},
- .printlock = spi_prettyprint_status_register_plain, /* TODO: improve */
+ .printlock = spi_prettyprint_status_register_default_bp2,
.unlock = spi_disable_blockprotect,
.write = spi_chip_write_256,
.read = spi_chip_read,
@@ -6687,10 +6713,10 @@
.block_erase = spi_block_erase_c7,
}
},
- .printlock = spi_prettyprint_status_register_plain, /* TODO: improve */
+ .printlock = spi_prettyprint_status_register_default_bp2,
.unlock = spi_disable_blockprotect,
.write = spi_chip_write_256,
- .read = spi_chip_read,
+ .read = spi_chip_read, /* Fast read (0x0B) supported */
.voltage = {2700, 3600},
},
@@ -6725,20 +6751,20 @@
.block_erase = spi_block_erase_c7,
}
},
- .printlock = spi_prettyprint_status_register_plain, /* TODO: improve */
+ .printlock = spi_prettyprint_status_register_default_bp2,
.unlock = spi_disable_blockprotect,
.write = spi_chip_write_256,
- .read = spi_chip_read,
+ .read = spi_chip_read, /* Fast read (0x0B) supported */
.voltage = {2700, 3600},
},
{
.vendor = "PMC",
- .name = "Pm25LV512",
+ .name = "Pm25LV016B",
.bustype = BUS_SPI,
.manufacture_id = PMC_ID,
- .model_id = PMC_PM25LV512,
- .total_size = 64,
+ .model_id = PMC_PM25LV016B,
+ .total_size = 2048,
.page_size = 256,
.feature_bits = FEATURE_WRSR_WREN,
.tested = TEST_UNTESTED,
@@ -6747,20 +6773,26 @@
.block_erasers =
{
{
- .eraseblocks = { {4 * 1024, 16} },
+ .eraseblocks = { {4 * 1024, 512} },
.block_erase = spi_block_erase_d7,
}, {
- .eraseblocks = { {32 * 1024, 2} },
+ .eraseblocks = { {4 * 1024, 512} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {64 * 1024, 32} },
.block_erase = spi_block_erase_d8,
}, {
- .eraseblocks = { {64 * 1024, 1} },
+ .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_plain, /* TODO: improve */
+ .printlock = spi_prettyprint_status_register_default_bp2,
.unlock = spi_disable_blockprotect,
.write = spi_chip_write_256,
- .read = spi_chip_read,
+ .read = spi_chip_read, /* Fast read (0x0B) supported */
.voltage = {2700, 3600},
},
diff --git a/flashchips.h b/flashchips.h
index 4eebc95..7bcbf9e 100644
--- a/flashchips.h
+++ b/flashchips.h
@@ -453,8 +453,12 @@
*/
#define PMC_ID 0x7F9D /* PMC */
#define PMC_ID_NOPREFIX 0x9D /* PMC, missing 0x7F prefix */
-#define PMC_PM25LV512 0x7B
-#define PMC_PM25LV010 0x7C
+#define PMC_PM25LD256C 0x2F
+#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_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
#define PMC_PM25LV040 0x7E
#define PMC_PM25LV080B 0x13
diff --git a/spi25.c b/spi25.c
index 911dc4e..a818630 100644
--- a/spi25.c
+++ b/spi25.c
@@ -279,6 +279,26 @@
return 1;
}
+int probe_spi_res3(struct flashctx *flash)
+{
+ unsigned char readarr[3];
+ uint32_t id1, id2;
+
+ if (spi_res(flash, readarr, 3)) {
+ return 0;
+ }
+
+ id1 = (readarr[0] << 8) | readarr[1];
+ id2 = readarr[2];
+
+ msg_cdbg("%s: id1 0x%x, id2 0x%x\n", __func__, id1, id2);
+
+ if (id1 != flash->chip->manufacture_id || id2 != flash->chip->model_id)
+ return 0;
+
+ return 1;
+}
+
/* Only used for some Atmel chips. */
int probe_spi_at25f(struct flashctx *flash)
{