Fixed support for Winbond W39V040FA flash chip. The write support 
in previous version of flashrom is _not_ working. W39V040FA is closer 
in its principle of working to SST Firmware Hub chips. Therefore, 
the support for the chip is integrated to sst_fwhub.c. The difference 
is only in the way the chip erased. 

Signed-off-by: Darmawan Mappatutu Salihun <darmawan.salihun@gmail.com>

Index: sst_fwhub.c
===================================================================
--- sst_fwhub.c	(revision 2748)
+++ sst_fwhub.c	(working copy)
@@ -3,6 +3,7 @@
  *
  *
  * Copyright 2000 Silicon Integrated System Corporation
+ * Copyright 2007 Darmawan Mappatutu Salihun <darmawan.salihun@gmail.com>
  *
  *	This program is free software; you can redistribute it and/or modify
  *	it under the terms of the GNU General Public License as published by
@@ -62,11 +63,28 @@
 int erase_sst_fwhub(struct flashchip *flash)
 {
 	int i;
+	volatile uint8_t *wrprotect;
+	uint8_t value;
 	unsigned int total_size = flash->total_size * 1024;
 
-	for (i = 0; i < total_size; i += flash->page_size)
-		erase_sst_fwhub_block(flash, i);
-
+	if((flash->manufacture_id == WINBOND_ID) && (flash->model_id == W_39V040FA))
+	{
+		for (i = 0; i < total_size; i += flash->page_size)
+		{
+			wrprotect = flash->virtual_registers + i + 2;
+			value = *(wrprotect);
+			usleep(10);
+			value &= 0xF8;
+			*(wrprotect) = value;
+			usleep(10);
+		}	
+		erase_chip_jedec(flash);
+	}
+	else
+	{
+		for (i = 0; i < total_size; i += flash->page_size)
+			erase_sst_fwhub_block(flash, i);
+	}
 	return 0;
 }
 
Index: flashchips.c
===================================================================
--- flashchips.c	(revision 2748)
+++ flashchips.c	(working copy)
@@ -92,7 +92,7 @@
 	{"W49V002FA", 	WINBOND_ID, 	W_49V002FA,	256, 128,
 	 probe_jedec,	erase_chip_jedec, write_49f002},
 	{"W39V040FA", 	WINBOND_ID, 	W_39V040FA,	512, 64*1024,
-	 probe_jedec,	erase_chip_jedec, write_39sf020},
+	 probe_sst_fwhub, erase_sst_fwhub, write_sst_fwhub},
 	{"W39V040A", 	WINBOND_ID, 	W_39V040A,	512, 64*1024,
 	 probe_jedec,	erase_chip_jedec, write_39sf020},
 	{"W39V040B",    WINBOND_ID,     W_39V040B,      512, 64*1024,
