summaryrefslogtreecommitdiffstats
path: root/at45db.c
diff options
context:
space:
mode:
Diffstat (limited to 'at45db.c')
-rw-r--r--at45db.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/at45db.c b/at45db.c
index 5f949bb20..6d66a6e99 100644
--- a/at45db.c
+++ b/at45db.c
@@ -80,9 +80,10 @@ static unsigned int at45db_get_sector_count(struct flashctx *flash)
unsigned int i, j;
unsigned int cnt = 0;
for (i = 0; i < NUM_ERASEFUNCTIONS; i++) {
- if (flash->chip->block_erasers[i].block_erase == &spi_erase_at45db_sector) {
+ const struct block_eraser *const eraser = &flash->chip->block_erasers[i];
+ if (eraser->block_erase == SPI_ERASE_AT45DB_SECTOR) {
for (j = 0; j < NUM_ERASEREGIONS; j++) {
- cnt += flash->chip->block_erasers[i].eraseblocks[j].count;
+ cnt += eraser->eraseblocks[j].count;
}
}
}
@@ -199,12 +200,12 @@ int probe_spi_at45db(struct flashctx *flash)
}
switch (chip->page_size) {
- case 256: chip->gran = write_gran_256bytes; break;
- case 264: chip->gran = write_gran_264bytes; break;
- case 512: chip->gran = write_gran_512bytes; break;
- case 528: chip->gran = write_gran_528bytes; break;
- case 1024: chip->gran = write_gran_1024bytes; break;
- case 1056: chip->gran = write_gran_1056bytes; break;
+ case 256: chip->gran = WRITE_GRAN_256BYTES; break;
+ case 264: chip->gran = WRITE_GRAN_264BYTES; break;
+ case 512: chip->gran = WRITE_GRAN_512BYTES; break;
+ case 528: chip->gran = WRITE_GRAN_528BYTES; break;
+ case 1024: chip->gran = WRITE_GRAN_1024BYTES; break;
+ case 1056: chip->gran = WRITE_GRAN_1056BYTES; break;
default:
msg_cerr("%s: unknown page size %d.\n", __func__, chip->page_size);
return 0;
@@ -309,7 +310,7 @@ static int at45db_wait_ready (struct flashctx *flash, unsigned int us, unsigned
return 0;
if (ret != 0 || retries-- == 0)
return 1;
- programmer_delay(us);
+ programmer_delay(flash, us);
}
}
@@ -550,6 +551,7 @@ int spi_write_at45db(struct flashctx *flash, const uint8_t *buf, unsigned int st
msg_cerr("Writing page %u failed!\n", i);
return 1;
}
+ update_progress(flash, FLASHROM_PROGRESS_WRITE, i + page_size, len);
}
return 0;
}