Author: stepan Date: 2008-10-29 23:13:20 +0100 (Wed, 29 Oct 2008) New Revision: 3707
Modified: trunk/util/flashrom/flash.h trunk/util/flashrom/flashchips.c trunk/util/flashrom/spi.c Log: 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
Modified: trunk/util/flashrom/flash.h =================================================================== --- trunk/util/flashrom/flash.h 2008-10-29 14:54:36 UTC (rev 3706) +++ trunk/util/flashrom/flash.h 2008-10-29 22:13:20 UTC (rev 3707) @@ -424,6 +424,7 @@ 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();
Modified: trunk/util/flashrom/flashchips.c =================================================================== --- trunk/util/flashrom/flashchips.c 2008-10-29 14:54:36 UTC (rev 3706) +++ trunk/util/flashrom/flashchips.c 2008-10-29 22:13:20 UTC (rev 3707) @@ -59,6 +59,11 @@ {"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},
Modified: trunk/util/flashrom/spi.c =================================================================== --- trunk/util/flashrom/spi.c 2008-10-29 14:54:36 UTC (rev 3706) +++ trunk/util/flashrom/spi.c 2008-10-29 22:13:20 UTC (rev 3707) @@ -310,6 +310,29 @@ 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) {