summaryrefslogtreecommitdiffstats
path: root/ichspi.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-11-25 02:07:30 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-11-25 02:07:30 +0000
commit96123034f4c28800fe2c3693be82970f2b9148c3 (patch)
treed7437011a0195845d062b9be494fa94fc8c863b5 /ichspi.c
parentd5b28fae1da48233753a19d3fa007c204786ec8c (diff)
downloadast2050-flashrom-96123034f4c28800fe2c3693be82970f2b9148c3.zip
ast2050-flashrom-96123034f4c28800fe2c3693be82970f2b9148c3.tar.gz
Kill hardcoded block erase on ICH SPI
The existing code does not work for all SPI chips, and it just was a band-aid to cope with locked down chipsets back in a time when there was no eraseblock infrastructure. Basically, this unbreaks a few SPI chips on ICH. Corresponding to flashrom svn r777. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Maciej Pijanka <maciej.pijanka@gmail.com>
Diffstat (limited to 'ichspi.c')
-rw-r--r--ichspi.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/ichspi.c b/ichspi.c
index b53a925..cd02b96 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -658,20 +658,16 @@ int ich_spi_write_256(struct flashchip *flash, uint8_t * buf)
int maxdata = 64;
spi_disable_blockprotect();
+ /* Erase first */
+ printf("Erasing flash before programming... ");
+ if (erase_flash(flash)) {
+ fprintf(stderr, "ERASE FAILED!\n");
+ return -1;
+ }
+ printf("done.\n");
printf("Programming page: \n");
-
for (i = 0; i < total_size / erase_size; i++) {
- /* FIMXE: call the chip-specific spi_block_erase_XX instead.
- * For this, we need to add a block erase function to
- * struct flashchip.
- */
- rc = spi_block_erase_d8(flash, i * erase_size, erase_size);
- if (rc) {
- printf("Error erasing block at 0x%x\n", i);
- break;
- }
-
if (spi_controller == SPI_CONTROLLER_VIA)
maxdata = 16;
OpenPOWER on IntegriCloud