[flashrom] [commit] r777 - trunk

svn at flashrom.org svn at flashrom.org
Wed Nov 25 03:07:31 CET 2009


Author: hailfinger
Date: 2009-11-25 03:07:30 +0100 (Wed, 25 Nov 2009)
New Revision: 777

Modified:
   trunk/ichspi.c
Log:
Kill hardcoded block erase on ICH SPI.
The existing code does not work for all SPI chips, and it just was a
band-aid to cope with locked down chipsets back in a time when there was
no eraseblock infrastructure.
Basically, this unbreaks a few SPI chips on ICH.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Maciej Pijanka <maciej.pijanka at gmail.com>


Modified: trunk/ichspi.c
===================================================================
--- trunk/ichspi.c	2009-11-24 18:27:10 UTC (rev 776)
+++ trunk/ichspi.c	2009-11-25 02:07:30 UTC (rev 777)
@@ -658,20 +658,16 @@
 	int maxdata = 64;
 
 	spi_disable_blockprotect();
+	/* Erase first */
+	printf("Erasing flash before programming... ");
+	if (erase_flash(flash)) {
+		fprintf(stderr, "ERASE FAILED!\n");
+		return -1;
+	}
+	printf("done.\n");
 
 	printf("Programming page: \n");
-
 	for (i = 0; i < total_size / erase_size; i++) {
-		/* FIMXE: call the chip-specific spi_block_erase_XX instead.
-		 * For this, we need to add a block erase function to
-		 * struct flashchip.
-		 */
-		rc = spi_block_erase_d8(flash, i * erase_size, erase_size);
-		if (rc) {
-			printf("Error erasing block at 0x%x\n", i);
-			break;
-		}
-
 		if (spi_controller == SPI_CONTROLLER_VIA)
 			maxdata = 16;
 





More information about the flashrom mailing list