See patch!

--
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
     Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: [EMAIL PROTECTED]  • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866

Add support for Numonyx M25PE80. This chip requires to be erased blockwise, as
the c7 method is unreliable, either for ICH7 or for this chip.

Signed-off-by: Stefan Reinauer <[EMAIL PROTECTED]>

Index: util/flashrom/flash.h
===================================================================
--- util/flashrom/flash.h	(revision 3462)
+++ util/flashrom/flash.h	(working copy)
@@ -418,6 +418,7 @@
 void spi_write_enable();
 void spi_write_disable();
 int spi_chip_erase_c7(struct flashchip *flash);
+int spi_chip_erase(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();
@@ -439,6 +440,7 @@
 int ich_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
 int ich_spi_read(struct flashchip *flash, uint8_t * buf);
 int ich_spi_write(struct flashchip *flash, uint8_t * buf);
+int ich_spi_chip_erase(struct flashchip *flash);
 
 /* it87spi.c */
 extern uint16_t it8716f_flashport;
Index: util/flashrom/flashchips.c
===================================================================
--- util/flashrom/flashchips.c	(revision 3462)
+++ util/flashrom/flashchips.c	(working copy)
@@ -57,6 +57,7 @@
 	{"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",	"M25PE80",		ST_ID,		0x8014,			1024,	256,		TEST_OK_PREW,	probe_spi_rdid,		spi_chip_erase,	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},
Index: util/flashrom/spi.c
===================================================================
--- util/flashrom/spi.c	(revision 3462)
+++ util/flashrom/spi.c	(working copy)
@@ -407,3 +407,19 @@
 	return 1;
 }
 
+int spi_chip_erase(struct flashchip *flash)
+{
+	switch (flashbus) {
+	case BUS_TYPE_IT87XX_SPI:
+	case BUS_TYPE_ICH9_SPI:
+	case BUS_TYPE_VIA_SPI:
+		return spi_chip_erase_c7(flash);
+	case BUS_TYPE_ICH7_SPI:
+		return ich_spi_chip_erase(flash);
+	default:
+		printf_debug("%s called, but no SPI chipset/strapping detected\n", __FUNCTION__);
+	}
+
+	return 1;
+}
+
Index: util/flashrom/ichspi.c
===================================================================
--- util/flashrom/ichspi.c	(revision 3462)
+++ util/flashrom/ichspi.c	(working copy)
@@ -587,6 +587,29 @@
 	return rc;
 }
 
+int ich_spi_chip_erase(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 = ich_spi_erase_block(flash, i * erase_size);
+		if (rc) {
+			printf("Error erasing block at 0x%x\n", i);
+			break;
+		}
+	}
+
+	printf("\n");
+
+	return rc;
+}
+
 int ich_spi_command(unsigned int writecnt, unsigned int readcnt,
 		    const unsigned char *writearr, unsigned char *readarr)
 {

Attachment: signature.asc
Description: OpenPGP digital signature

--
coreboot mailing list
coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to