This is probably the weirdest changelog ever.
OK, I forgot what this patch does, but I'm pretty sure it's justified.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-fwh/sst39sf020.c =================================================================== --- flashrom-fwh/sst39sf020.c (Revision 3324) +++ flashrom-fwh/sst39sf020.c (Arbeitskopie) @@ -22,21 +22,6 @@ #include <stdint.h> #include "flash.h"
-#define AUTO_PG_ERASE1 0x20 -#define AUTO_PG_ERASE2 0xD0 - -static __inline__ int erase_sector_39sf020(volatile uint8_t *bios, - unsigned long address) -{ - *bios = AUTO_PG_ERASE1; - *(bios + address) = AUTO_PG_ERASE2; - - /* wait for Toggle bit ready */ - toggle_ready_jedec(bios); - - return 0; -} - int write_39sf020(struct flashchip *flash, uint8_t *buf) { int i; Index: flashrom-fwh/flash.h =================================================================== --- flashrom-fwh/flash.h (Revision 3324) +++ flashrom-fwh/flash.h (Arbeitskopie) @@ -464,6 +464,8 @@ /* sst28sf040.c */ int probe_28sf040(struct flashchip *flash); int erase_28sf040(struct flashchip *flash); +int erase_all_sectors_28sf040(struct flashchip *flash); +int erase_sector_28sf040(volatile uint8_t *bios, unsigned long address); int write_28sf040(struct flashchip *flash, uint8_t *buf);
/* sst39sf020.c */ Index: flashrom-fwh/sst28sf040.c =================================================================== --- flashrom-fwh/sst28sf040.c (Revision 3324) +++ flashrom-fwh/sst28sf040.c (Arbeitskopie) @@ -58,8 +58,7 @@ tmp = *(volatile uint8_t *)(bios + 0x041A); }
-static __inline__ int erase_sector_28sf040(volatile uint8_t *bios, - unsigned long address) +int erase_sector_28sf040(volatile uint8_t *bios, unsigned long address) { *bios = AUTO_PG_ERASE1; *(bios + address) = AUTO_PG_ERASE2; @@ -119,6 +118,20 @@ return 0; }
+int erase_all_sectors_28sf040(struct flashchip *flash) +{ + int i; + int total_size = flash->total_size * 1024; + int page_size = flash->page_size; + volatile uint8_t *bios = flash->virtual_memory; + + for (i = 0; i < total_size / page_size; i++) { + /* erase the page before programming */ + erase_sector_28sf040(bios, i * page_size); + } + return 0; +} + int erase_28sf040(struct flashchip *flash) { volatile uint8_t *bios = flash->virtual_memory;