summaryrefslogtreecommitdiffstats
path: root/sst_fwhub.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2008-03-16 19:44:13 +0000
committerStefan Reinauer <stefan.reinauer@coreboot.org>2008-03-16 19:44:13 +0000
commitb7c83233993bd1ff602c53def439f8cbff0f372a (patch)
tree44a8bacbeef826f95eda6b387f5e0e5b9a85e89a /sst_fwhub.c
parentfc425e81cef5465ff6188468101be1c110f43531 (diff)
downloadast2050-flashrom-b7c83233993bd1ff602c53def439f8cbff0f372a.zip
ast2050-flashrom-b7c83233993bd1ff602c53def439f8cbff0f372a.tar.gz
Check whether SST FWH chip was successfully erased on flashchip -E, too
Corresponding to flashrom svn r212 and coreboot v2 svn r3153. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de>
Diffstat (limited to 'sst_fwhub.c')
-rw-r--r--sst_fwhub.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/sst_fwhub.c b/sst_fwhub.c
index 0f5dd15..455107e 100644
--- a/sst_fwhub.c
+++ b/sst_fwhub.c
@@ -63,10 +63,19 @@ int erase_sst_fwhub(struct flashchip *flash)
{
int i;
unsigned int total_size = flash->total_size * 1024;
+ volatile uint8_t *bios = flash->virtual_memory;
for (i = 0; i < total_size; i += flash->page_size)
erase_sst_fwhub_block(flash, i);
+ // dumb check if erase was successful.
+ for (i = 0; i < total_size; i++) {
+ if (bios[i] != 0xff) {
+ printf("ERASE FAILED!\n");
+ return -1;
+ }
+ }
+
return 0;
}
@@ -78,15 +87,8 @@ int write_sst_fwhub(struct flashchip *flash, uint8_t *buf)
volatile uint8_t *bios = flash->virtual_memory;
// FIXME: We want block wide erase instead of ironing the whole chip
- erase_sst_fwhub(flash);
-
- // dumb check if erase was successful.
- for (i = 0; i < total_size; i++) {
- if (bios[i] != 0xff) {
- printf("ERASE FAILED!\n");
- return -1;
- }
- }
+ if (erase_sst_fwhub(flash))
+ return -1;
printf("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {
OpenPOWER on IntegriCloud