summaryrefslogtreecommitdiff
path: root/util/flashrom/spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/flashrom/spi.c')
-rw-r--r--util/flashrom/spi.c23
1 files changed, 23 insertions, 0 deletions
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)
{