diff options
-rw-r--r-- | util/flashrom/flash.h | 1 | ||||
-rw-r--r-- | util/flashrom/flashchips.c | 5 | ||||
-rw-r--r-- | util/flashrom/spi.c | 23 |
3 files changed, 29 insertions, 0 deletions
diff --git a/util/flashrom/flash.h b/util/flashrom/flash.h index bce4844801..0812331f60 100644 --- a/util/flashrom/flash.h +++ b/util/flashrom/flash.h @@ -424,6 +424,7 @@ int spi_command(unsigned int writecnt, unsigned int readcnt, void spi_write_enable(); void spi_write_disable(); int spi_chip_erase_c7(struct flashchip *flash); +int spi_chip_erase_d8(struct flashchip *flash); int spi_chip_write(struct flashchip *flash, uint8_t *buf); int spi_chip_read(struct flashchip *flash, uint8_t *buf); uint8_t spi_read_status_register(); diff --git a/util/flashrom/flashchips.c b/util/flashrom/flashchips.c index 3043caf5c6..1115342199 100644 --- a/util/flashrom/flashchips.c +++ b/util/flashrom/flashchips.c @@ -59,6 +59,11 @@ struct flashchip flashchips[] = { {"Macronix", "MX25L1605", MX_ID, MX_25L1605, 2048, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, {"Macronix", "MX25L3205", MX_ID, MX_25L3205, 4096, 256, TEST_OK_PREW, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, {"Macronix", "MX29F002", MX_ID, MX_29F002, 256, 64 * 1024, TEST_UNTESTED, probe_29f002, erase_29f002, write_29f002}, + {"Numonyx", "M25PE10", ST_ID, 0x8011, 128, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_d8, spi_chip_write, spi_chip_read}, + {"Numonyx", "M25PE20", ST_ID, 0x8012, 256, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_d8, spi_chip_write, spi_chip_read}, + {"Numonyx", "M25PE40", ST_ID, 0x8013, 256, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_d8, spi_chip_write, spi_chip_read}, + {"Numonyx", "M25PE80", ST_ID, 0x8014, 1024, 256, TEST_OK_PREW, probe_spi_rdid, spi_chip_erase_d8, spi_chip_write, spi_chip_read}, + {"Numonyx", "M25PE16", ST_ID, 0x8015, 2048, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_d8, spi_chip_write, spi_chip_read}, {"PMC", "Pm25LV010", PMC_ID, PMC_25LV010, 128, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, {"PMC", "Pm25LV016B", PMC_ID, PMC_25LV016B, 2048, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, {"PMC", "Pm25LV020", PMC_ID, PMC_25LV020, 256, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, diff --git a/util/flashrom/spi.c b/util/flashrom/spi.c index 0028b4cacd..83624fa381 100644 --- a/util/flashrom/spi.c +++ b/util/flashrom/spi.c @@ -310,6 +310,29 @@ int spi_block_erase_d8(const struct flashchip *flash, unsigned long addr) return 0; } +int spi_chip_erase_d8(struct flashchip *flash) +{ + int i, rc = 0; + int total_size = flash->total_size * 1024; + int erase_size = 64 * 1024; + + spi_disable_blockprotect(); + + printf("Erasing chip: \n"); + + for (i = 0; i < total_size / erase_size; i++) { + rc = spi_block_erase_d8(flash, i * erase_size); + if (rc) { + printf("Error erasing block at 0x%x\n", i); + break; + } + } + + printf("\n"); + + return rc; +} + /* Sector size is usually 4k, though Macronix eliteflash has 64k */ int spi_sector_erase(const struct flashchip *flash, unsigned long addr) { |