Works on my hardware except that it is very slow, so changing usleep from 1000 to 10 and increasing timeout to 100 * 1000 * 60 (line 461 ichspi.c) results in a fast erase/read (about 2.5 sec) and successful write in 62 seconds.
Test Log :
ali@Velocity:~/tmp/f$ sudo time ./flashrom/flashrom -w mybios.rom flashrom v0.9.0-r471 Calibrating delay loop... OK. No coreboot table found. Found chipset "Intel ICH7M", enabling flash write... OK. Found chip "SST SST25VF080B" (1024 KB) at physical address 0xfff00000. Flash image seems to be a legacy BIOS. Disabling checks. 62.14user 0.10system 1:03.08elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+512minor)pagefaults 0swaps
ali@Velocity:~/tmp/f$ sudo time ./flashrom/flashrom -r ddd flashrom v0.9.0-r471 Calibrating delay loop... OK. No coreboot table found. Found chipset "Intel ICH7M", enabling flash write... OK. Found chip "SST SST25VF080B" (1024 KB) at physical address 0xfff00000. Reading flash... done. 2.87user 0.06system 0:03.05elapsed 96%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+2048outputs (0major+513minor)pagefaults 0swaps
ali@Velocity:~/tmp/f$ diff ddd mybios.rom
ali@Velocity:~/tmp/f$
Regards -- Ali Nadalizadeh
On Thu, May 7, 2009 at 5:44 PM, Carl-Daniel Hailfinger < c-d.hailfinger.devel.2006@gmx.net> wrote:
Chips like the SST SST25VF080B can only handle single byte writes outside AAI mode.
Change SPI architecture to handle 1-byte chunk chip writing differently from 256-byte chunk chip writing.
Convert all flashchips.c entries with SPI programing to the 256-byte version by default.
Change the flashchips entry for SST SST25VF080B to 1-byte writing.
Untested.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-SST25VF080B/flash.h
--- flashrom-SST25VF080B/flash.h (Revision 471) +++ flashrom-SST25VF080B/flash.h (Arbeitskopie) @@ -565,7 +565,8 @@ int spi_chip_erase_d8(struct flashchip *flash); int spi_block_erase_52(const struct flashchip *flash, unsigned long addr); int spi_block_erase_d8(const struct flashchip *flash, unsigned long addr); -int spi_chip_write(struct flashchip *flash, uint8_t *buf); +int spi_chip_write_1(struct flashchip *flash, uint8_t *buf); +int spi_chip_write_256(struct flashchip *flash, uint8_t *buf); int spi_chip_read(struct flashchip *flash, uint8_t *buf); uint8_t spi_read_status_register(void); int spi_disable_blockprotect(void); @@ -593,7 +594,7 @@ int ich_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); int ich_spi_read(struct flashchip *flash, uint8_t * buf); -int ich_spi_write(struct flashchip *flash, uint8_t * buf); +int ich_spi_write_256(struct flashchip *flash, uint8_t * buf);
/* it87spi.c */ extern uint16_t it8716f_flashport; @@ -601,13 +602,14 @@ int it8716f_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf); -int it8716f_spi_chip_write(struct flashchip *flash, uint8_t *buf); +int it8716f_spi_chip_write_1(struct flashchip *flash, uint8_t *buf); +int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf);
/* sb600spi.c */ int sb600_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); int sb600_spi_read(struct flashchip *flash, uint8_t *buf); -int sb600_spi_write(struct flashchip *flash, uint8_t *buf); +int sb600_spi_write_256(struct flashchip *flash, uint8_t *buf); uint8_t sb600_read_status_register(void); extern uint8_t volatile *sb600_spibar;
@@ -706,7 +708,7 @@ int wbsio_check_for_spi(const char *name); int wbsio_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); int wbsio_spi_read(struct flashchip *flash, uint8_t *buf); -int wbsio_spi_write(struct flashchip *flash, uint8_t *buf); +int wbsio_spi_write_256(struct flashchip *flash, uint8_t *buf);
/* stm50flw0x0x.c */ int probe_stm50flw0x0x(struct flashchip *flash); Index: flashrom-SST25VF080B/it87spi.c =================================================================== --- flashrom-SST25VF080B/it87spi.c (Revision 471) +++ flashrom-SST25VF080B/it87spi.c (Arbeitskopie) @@ -215,10 +215,12 @@ }
/*
- IT8716F only allows maximum of 512 kb SPI mapped to LPC memory cycles
- Program chip using firmware cycle byte programming. (SLOW!)
- This is for chips which can only handle one byte writes
- and for chips where memory mapped programming is impossible due to
- size constraints in IT87* (over 512 kB)
*/ -int it8716f_over512k_spi_chip_write(struct flashchip *flash, uint8_t *buf) +int it8716f_spi_chip_write_1(struct flashchip *flash, uint8_t *buf) { int total_size = 1024 * flash->total_size; int i; @@ -262,13 +264,17 @@ return 0; }
-int it8716f_spi_chip_write(struct flashchip *flash, uint8_t *buf) +int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf) { int total_size = 1024 * flash->total_size; int i;
/*
* IT8716F only allows maximum of 512 kb SPI chip size for memory
* mapped access.
*/ if (total_size > 512 * 1024) {
it8716f_over512k_spi_chip_write(flash, buf);
it8716f_spi_chip_write_1(flash, buf); } else { for (i = 0; i < total_size / 256; i++) { it8716f_spi_page_program(i, buf,
Index: flashrom-SST25VF080B/flashchips.c
--- flashrom-SST25VF080B/flashchips.c (Revision 471) +++ flashrom-SST25VF080B/flashchips.c (Arbeitskopie) @@ -151,7 +151,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -165,7 +165,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -179,7 +179,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -193,7 +193,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -207,7 +207,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -221,7 +221,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -235,7 +235,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -249,7 +249,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -263,7 +263,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -277,7 +277,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -305,7 +305,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -319,7 +319,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -333,7 +333,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -348,7 +348,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },*/
@@ -554,7 +554,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid4, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -737,7 +737,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -751,7 +751,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -765,7 +765,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -779,7 +779,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -793,7 +793,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -807,7 +807,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -821,7 +821,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -835,7 +835,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -849,7 +849,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -863,7 +863,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -877,7 +877,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -930,7 +930,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -944,7 +944,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -958,7 +958,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -972,7 +972,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -986,7 +986,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1000,7 +1000,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1014,7 +1014,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1028,7 +1028,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1042,7 +1042,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1056,7 +1056,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1070,7 +1070,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1123,7 +1123,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1137,7 +1137,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1151,7 +1151,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1165,7 +1165,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1179,7 +1179,7 @@ .tested = TEST_OK_PR, .probe = probe_spi_rems, .erase = spi_chip_erase_60,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1207,7 +1207,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_1, .read = spi_chip_read, },
@@ -1559,7 +1559,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1573,7 +1573,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1587,7 +1587,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1601,7 +1601,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1615,7 +1615,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_res, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1629,7 +1629,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1643,7 +1643,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1657,7 +1657,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1671,7 +1671,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1685,7 +1685,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1946,7 +1946,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1960,7 +1960,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1974,7 +1974,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1988,7 +1988,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
Index: flashrom-SST25VF080B/spi.c
--- flashrom-SST25VF080B/spi.c (Revision 471) +++ flashrom-SST25VF080B/spi.c (Arbeitskopie) @@ -597,19 +597,41 @@ return 1; }
-int spi_chip_write(struct flashchip *flash, uint8_t *buf) +/*
- Program chip using firmware cycle byte programming. (SLOW!)
- This is for chips which can only handle one byte writes
- and for chips where memory mapped programming is impossible
- (e.g. due to size constraints in IT87* for over 512 kB)
- */
+int spi_chip_write_1(struct flashchip *flash, uint8_t *buf) {
int total_size = 1024 * flash->total_size;
int i;
spi_disable_blockprotect();
for (i = 0; i < total_size; i++) {
spi_write_enable();
spi_byte_program(i, buf[i]);
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
myusec_delay(10);
}
return 0;
+}
+int spi_chip_write_256(struct flashchip *flash, uint8_t *buf) +{ switch (flashbus) { case BUS_TYPE_IT87XX_SPI:
return it8716f_spi_chip_write(flash, buf);
return it8716f_spi_chip_write_256(flash, buf); case BUS_TYPE_SB600_SPI:
return sb600_spi_write(flash, buf);
return sb600_spi_write_256(flash, buf); case BUS_TYPE_ICH7_SPI: case BUS_TYPE_ICH9_SPI: case BUS_TYPE_VIA_SPI:
return ich_spi_write(flash, buf);
return ich_spi_write_256(flash, buf); case BUS_TYPE_WBSIO_SPI:
return wbsio_spi_write(flash, buf);
return wbsio_spi_write_256(flash, buf); default: printf_debug ("%s called, but no SPI chipset/strapping detected\n",
@@ -627,7 +649,7 @@ case BUS_TYPE_WBSIO_SPI: fprintf(stderr, "%s: impossible with Winbond SPI masters," " degrading to byte program\n", __func__);
return spi_chip_write(flash, buf);
return spi_chip_write_1(flash, buf); default: break; }
Index: flashrom-SST25VF080B/wbsio_spi.c
--- flashrom-SST25VF080B/wbsio_spi.c (Revision 471) +++ flashrom-SST25VF080B/wbsio_spi.c (Arbeitskopie) @@ -186,7 +186,7 @@ return 0; }
-int wbsio_spi_write(struct flashchip *flash, uint8_t *buf) +int wbsio_spi_write_256(struct flashchip *flash, uint8_t *buf) { int pos, size = flash->total_size * 1024;
Index: flashrom-SST25VF080B/sb600spi.c
--- flashrom-SST25VF080B/sb600spi.c (Revision 471) +++ flashrom-SST25VF080B/sb600spi.c (Arbeitskopie) @@ -64,7 +64,7 @@ return readarr[0]; }
-int sb600_spi_write(struct flashchip *flash, uint8_t *buf) +int sb600_spi_write_256(struct flashchip *flash, uint8_t *buf) { int rc = 0, i; int total_size = flash->total_size * 1024; Index: flashrom-SST25VF080B/ichspi.c =================================================================== --- flashrom-SST25VF080B/ichspi.c (Revision 471) +++ flashrom-SST25VF080B/ichspi.c (Arbeitskopie) @@ -707,7 +707,7 @@ return rc; }
-int ich_spi_write(struct flashchip *flash, uint8_t * buf) +int ich_spi_write_256(struct flashchip *flash, uint8_t * buf) { int i, j, rc = 0; int total_size = flash->total_size * 1024;
Index: flashrom-SST25VF080B/flash.h
--- flashrom-SST25VF080B/flash.h (Revision 471) +++ flashrom-SST25VF080B/flash.h (Arbeitskopie) @@ -565,7 +565,8 @@ int spi_chip_erase_d8(struct flashchip *flash); int spi_block_erase_52(const struct flashchip *flash, unsigned long addr); int spi_block_erase_d8(const struct flashchip *flash, unsigned long addr); -int spi_chip_write(struct flashchip *flash, uint8_t *buf); +int spi_chip_write_1(struct flashchip *flash, uint8_t *buf); +int spi_chip_write_256(struct flashchip *flash, uint8_t *buf); int spi_chip_read(struct flashchip *flash, uint8_t *buf); uint8_t spi_read_status_register(void); int spi_disable_blockprotect(void); @@ -593,7 +594,7 @@ int ich_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); int ich_spi_read(struct flashchip *flash, uint8_t * buf); -int ich_spi_write(struct flashchip *flash, uint8_t * buf); +int ich_spi_write_256(struct flashchip *flash, uint8_t * buf);
/* it87spi.c */ extern uint16_t it8716f_flashport; @@ -601,13 +602,14 @@ int it8716f_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf); -int it8716f_spi_chip_write(struct flashchip *flash, uint8_t *buf); +int it8716f_spi_chip_write_1(struct flashchip *flash, uint8_t *buf); +int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf);
/* sb600spi.c */ int sb600_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); int sb600_spi_read(struct flashchip *flash, uint8_t *buf); -int sb600_spi_write(struct flashchip *flash, uint8_t *buf); +int sb600_spi_write_256(struct flashchip *flash, uint8_t *buf); uint8_t sb600_read_status_register(void); extern uint8_t volatile *sb600_spibar;
@@ -706,7 +708,7 @@ int wbsio_check_for_spi(const char *name); int wbsio_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); int wbsio_spi_read(struct flashchip *flash, uint8_t *buf); -int wbsio_spi_write(struct flashchip *flash, uint8_t *buf); +int wbsio_spi_write_256(struct flashchip *flash, uint8_t *buf);
/* stm50flw0x0x.c */ int probe_stm50flw0x0x(struct flashchip *flash); Index: flashrom-SST25VF080B/it87spi.c =================================================================== --- flashrom-SST25VF080B/it87spi.c (Revision 471) +++ flashrom-SST25VF080B/it87spi.c (Arbeitskopie) @@ -215,10 +215,12 @@ }
/*
- IT8716F only allows maximum of 512 kb SPI mapped to LPC memory cycles
- Program chip using firmware cycle byte programming. (SLOW!)
- This is for chips which can only handle one byte writes
- and for chips where memory mapped programming is impossible due to
- size constraints in IT87* (over 512 kB)
*/ -int it8716f_over512k_spi_chip_write(struct flashchip *flash, uint8_t *buf) +int it8716f_spi_chip_write_1(struct flashchip *flash, uint8_t *buf) { int total_size = 1024 * flash->total_size; int i; @@ -262,13 +264,17 @@ return 0; }
-int it8716f_spi_chip_write(struct flashchip *flash, uint8_t *buf) +int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf) { int total_size = 1024 * flash->total_size; int i;
/*
* IT8716F only allows maximum of 512 kb SPI chip size for memory
* mapped access.
*/ if (total_size > 512 * 1024) {
it8716f_over512k_spi_chip_write(flash, buf);
it8716f_spi_chip_write_1(flash, buf); } else { for (i = 0; i < total_size / 256; i++) { it8716f_spi_page_program(i, buf,
Index: flashrom-SST25VF080B/flashchips.c
--- flashrom-SST25VF080B/flashchips.c (Revision 471) +++ flashrom-SST25VF080B/flashchips.c (Arbeitskopie) @@ -151,7 +151,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -165,7 +165,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -179,7 +179,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -193,7 +193,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -207,7 +207,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -221,7 +221,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -235,7 +235,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -249,7 +249,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -263,7 +263,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -277,7 +277,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -305,7 +305,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -319,7 +319,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -333,7 +333,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -348,7 +348,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },*/
@@ -554,7 +554,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid4, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -737,7 +737,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -751,7 +751,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -765,7 +765,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -779,7 +779,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -793,7 +793,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -807,7 +807,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -821,7 +821,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -835,7 +835,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -849,7 +849,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -863,7 +863,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -877,7 +877,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -930,7 +930,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -944,7 +944,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -958,7 +958,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -972,7 +972,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -986,7 +986,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_d8,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1000,7 +1000,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1014,7 +1014,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1028,7 +1028,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1042,7 +1042,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1056,7 +1056,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1070,7 +1070,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1123,7 +1123,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1137,7 +1137,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1151,7 +1151,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1165,7 +1165,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1179,7 +1179,7 @@ .tested = TEST_OK_PR, .probe = probe_spi_rems, .erase = spi_chip_erase_60,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1207,7 +1207,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_60_c7,
.write = spi_chip_write,
.write = spi_chip_write_1, .read = spi_chip_read, },
@@ -1559,7 +1559,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1573,7 +1573,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1587,7 +1587,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1601,7 +1601,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1615,7 +1615,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_res, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1629,7 +1629,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1643,7 +1643,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1657,7 +1657,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1671,7 +1671,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1685,7 +1685,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1946,7 +1946,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1960,7 +1960,7 @@ .tested = TEST_UNTESTED, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1974,7 +1974,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
@@ -1988,7 +1988,7 @@ .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .erase = spi_chip_erase_c7,
.write = spi_chip_write,
.write = spi_chip_write_256, .read = spi_chip_read, },
Index: flashrom-SST25VF080B/spi.c
--- flashrom-SST25VF080B/spi.c (Revision 471) +++ flashrom-SST25VF080B/spi.c (Arbeitskopie) @@ -597,19 +597,41 @@ return 1; }
-int spi_chip_write(struct flashchip *flash, uint8_t *buf) +/*
- Program chip using firmware cycle byte programming. (SLOW!)
- This is for chips which can only handle one byte writes
- and for chips where memory mapped programming is impossible
- (e.g. due to size constraints in IT87* for over 512 kB)
- */
+int spi_chip_write_1(struct flashchip *flash, uint8_t *buf) {
int total_size = 1024 * flash->total_size;
int i;
spi_disable_blockprotect();
for (i = 0; i < total_size; i++) {
spi_write_enable();
spi_byte_program(i, buf[i]);
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
myusec_delay(10);
}
return 0;
+}
+int spi_chip_write_256(struct flashchip *flash, uint8_t *buf) +{ switch (flashbus) { case BUS_TYPE_IT87XX_SPI:
return it8716f_spi_chip_write(flash, buf);
return it8716f_spi_chip_write_256(flash, buf); case BUS_TYPE_SB600_SPI:
return sb600_spi_write(flash, buf);
return sb600_spi_write_256(flash, buf); case BUS_TYPE_ICH7_SPI: case BUS_TYPE_ICH9_SPI: case BUS_TYPE_VIA_SPI:
return ich_spi_write(flash, buf);
return ich_spi_write_256(flash, buf); case BUS_TYPE_WBSIO_SPI:
return wbsio_spi_write(flash, buf);
return wbsio_spi_write_256(flash, buf); default: printf_debug ("%s called, but no SPI chipset/strapping detected\n",
@@ -627,7 +649,7 @@ case BUS_TYPE_WBSIO_SPI: fprintf(stderr, "%s: impossible with Winbond SPI masters," " degrading to byte program\n", __func__);
return spi_chip_write(flash, buf);
return spi_chip_write_1(flash, buf); default: break; }
Index: flashrom-SST25VF080B/wbsio_spi.c
--- flashrom-SST25VF080B/wbsio_spi.c (Revision 471) +++ flashrom-SST25VF080B/wbsio_spi.c (Arbeitskopie) @@ -186,7 +186,7 @@ return 0; }
-int wbsio_spi_write(struct flashchip *flash, uint8_t *buf) +int wbsio_spi_write_256(struct flashchip *flash, uint8_t *buf) { int pos, size = flash->total_size * 1024;
Index: flashrom-SST25VF080B/sb600spi.c
--- flashrom-SST25VF080B/sb600spi.c (Revision 471) +++ flashrom-SST25VF080B/sb600spi.c (Arbeitskopie) @@ -64,7 +64,7 @@ return readarr[0]; }
-int sb600_spi_write(struct flashchip *flash, uint8_t *buf) +int sb600_spi_write_256(struct flashchip *flash, uint8_t *buf) { int rc = 0, i; int total_size = flash->total_size * 1024; Index: flashrom-SST25VF080B/ichspi.c =================================================================== --- flashrom-SST25VF080B/ichspi.c (Revision 471) +++ flashrom-SST25VF080B/ichspi.c (Arbeitskopie) @@ -707,7 +707,7 @@ return rc; }
-int ich_spi_write(struct flashchip *flash, uint8_t * buf) +int ich_spi_write_256(struct flashchip *flash, uint8_t * buf) { int i, j, rc = 0; int total_size = flash->total_size * 1024;
-- coreboot mailing list: coreboot@coreboot.org http://www.coreboot.org/mailman/listinfo/coreboot