summaryrefslogtreecommitdiffstats
path: root/spi.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2008-10-29 22:13:20 +0000
committerStefan Reinauer <stepan@coresystems.de>2008-10-29 22:13:20 +0000
commitfc9342f22463d4324a810b6e426cd9f8097984ad (patch)
tree604ec97701af76c957c5b8eef17adab3bc95a02f /spi.c
parent3ce88ac6797300ec7eefdb2ac7f943fe82aedc8a (diff)
downloadflashrom-fc9342f22463d4324a810b6e426cd9f8097984ad.zip
flashrom-fc9342f22463d4324a810b6e426cd9f8097984ad.tar.gz
Flashrom support for some Numonyx parts (M25PE)
Using block erase d8 as discussed with Peter Stuge Corresponding to flashrom svn r333 and coreboot v2 svn r3707. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de>
Diffstat (limited to 'spi.c')
-rw-r--r--spi.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/spi.c b/spi.c
index 0028b4c..83624fa 100644
--- a/spi.c
+++ b/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)
{
OpenPOWER on IntegriCloud