summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chipdrivers.h3
-rw-r--r--flashchips.c6
-rw-r--r--spi25.c16
3 files changed, 20 insertions, 5 deletions
diff --git a/chipdrivers.h b/chipdrivers.h
index 119ea70..94daafc 100644
--- a/chipdrivers.h
+++ b/chipdrivers.h
@@ -63,7 +63,8 @@ int spi_nbyte_program(int addr, uint8_t *bytes, int len);
int spi_nbyte_read(int addr, uint8_t *bytes, int len);
int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize);
int spi_write_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize);
-int spi_aai_write(struct flashchip *flash, uint8_t *buf, int start, int len);
+int spi_aai_write_new(struct flashchip *flash, uint8_t *buf, int start, int len);
+int spi_aai_write(struct flashchip *flash, uint8_t *buf);
/* 82802ab.c */
uint8_t wait_82802ab(chipaddr bios);
diff --git a/flashchips.c b/flashchips.c
index 2b1af0b..c0280b3 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -4860,7 +4860,7 @@ struct flashchip flashchips[] = {
.model_id = SST_SST25VF032B,
.total_size = 4096,
.page_size = 256,
- .tested = TEST_OK_PRW,
+ .tested = TEST_OK_PREW,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
.block_erasers =
@@ -4883,7 +4883,7 @@ struct flashchip flashchips[] = {
},
},
.unlock = spi_disable_blockprotect,
- .write = spi_chip_write_1,
+ .write = spi_aai_write,
.read = spi_chip_read,
},
@@ -4918,7 +4918,7 @@ struct flashchip flashchips[] = {
},
},
.unlock = spi_disable_blockprotect,
- .write = spi_chip_write_1,
+ .write = spi_chip_write_256,
.read = spi_chip_read,
},
diff --git a/spi25.c b/spi25.c
index 9cab10a..688a329 100644
--- a/spi25.c
+++ b/spi25.c
@@ -1300,7 +1300,7 @@ int spi_chip_write_1(struct flashchip *flash, uint8_t *buf)
return spi_chip_write_1_new(flash, buf, 0, flash->total_size * 1024);
}
-int spi_aai_write(struct flashchip *flash, uint8_t *buf, int start, int len)
+int spi_aai_write_new(struct flashchip *flash, uint8_t *buf, int start, int len)
{
uint32_t pos = start;
int result;
@@ -1391,3 +1391,17 @@ int spi_aai_write(struct flashchip *flash, uint8_t *buf, int start, int len)
spi_write_disable();
return 0;
}
+
+int spi_aai_write(struct flashchip *flash, uint8_t *buf)
+{
+ /* Erase first */
+ msg_cinfo("Erasing flash before programming... ");
+ if (erase_flash(flash)) {
+ msg_cerr("ERASE FAILED!\n");
+ return -1;
+ }
+ msg_cinfo("done.\n");
+
+ return spi_aai_write_new(flash, buf, 0, flash->total_size * 1024);
+}
+
OpenPOWER on IntegriCloud