Convert the following chips to use struct eraseblock

Am29F010A/B
Am29F002(N)BB
Am29F002(N)BT
Am29F016D
Am29F040B
Am29F080B
Am29LV040B
Am29LV081B
A29040B
Pm29F002T
Pm29F002B

Change function signature of Am29 erase functions and JEDEC chip erase
to be usable with block_erasers.

Corresponding to flashrom svn r812.

Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
diff --git a/am29f040b.c b/am29f040b.c
index 46a5ef4..cfa6c49 100644
--- a/am29f040b.c
+++ b/am29f040b.c
@@ -22,9 +22,8 @@
 
 /* FIMXE: check that the 2 second delay is really needed.
           Use erase_sector_jedec if not? */
-static int erase_sector_29f040b(struct flashchip *flash, unsigned long address)
+int erase_sector_29f040b(struct flashchip *flash, unsigned int address, unsigned int blocklen)
 {
-	int page_size = flash->page_size;
 	chipaddr bios = flash->virtual_memory;
 
 	chip_writeb(0xAA, bios + 0x555);
@@ -39,13 +38,24 @@
 	/* wait for Toggle bit ready         */
 	toggle_ready_jedec(bios + address);
 
-	if (check_erased_range(flash, address, page_size)) {
+	if (check_erased_range(flash, address, blocklen)) {
 		fprintf(stderr, "ERASE FAILED!\n");
 		return -1;
 	}
 	return 0;
 }
 
+/* erase chip with block_erase() prototype */
+int erase_chip_29f040b(struct flashchip *flash, unsigned int addr, unsigned int blocklen)
+{
+	if ((addr != 0) || (blocklen != flash->total_size * 1024)) {
+		fprintf(stderr, "%s called with incorrect arguments\n",
+			__func__);
+		return -1;
+	}
+	return erase_29f040b(flash);
+}
+
 /* FIXME: use write_sector_jedec? */
 static int write_sector_29f040b(chipaddr bios, uint8_t *src, chipaddr dst,
 				unsigned int page_size)
@@ -127,7 +137,7 @@
 	printf("Programming page ");
 	for (i = 0; i < total_size / page_size; i++) {
 		/* erase the page before programming */
-		if (erase_sector_29f040b(flash, i * page_size)) {
+		if (erase_sector_29f040b(flash, i * page_size, page_size)) {
 			fprintf(stderr, "ERASE FAILED!\n");
 			return -1;
 		}