summaryrefslogtreecommitdiff
path: root/util/flashrom
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2008-10-29 22:13:20 +0000
committerStefan Reinauer <stepan@openbios.org>2008-10-29 22:13:20 +0000
commita69d1db50408053c3766d65c54fd266afd77a158 (patch)
treeed0948e85868504f9ea91536ef2bc5bd02a45ca3 /util/flashrom
parentc6bb6be6d27f95851cf6b7cbb67ddbd1ee5c8c5d (diff)
downloadcoreboot-a69d1db50408053c3766d65c54fd266afd77a158.tar.xz
Flashrom support for some Numonyx parts (M25PE)
using block erase d8 as discussed with Peter Stuge Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3707 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/flashrom')
-rw-r--r--util/flashrom/flash.h1
-rw-r--r--util/flashrom/flashchips.c5
-rw-r--r--util/flashrom/spi.c23
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)
{