diff options
author | Nico Huber <nico.h@gmx.de> | 2017-10-14 18:18:30 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2017-12-28 10:46:54 +0000 |
commit | 7a077222566c84546dca4a56c1a509626036e429 (patch) | |
tree | b4cd487275dd4ffc92ad6ac885268842efbe9eb3 /spi25.c | |
parent | a1672f829328e877d9b8dea7777f25e2eba52d0e (diff) | |
download | flashrom-7a077222566c84546dca4a56c1a509626036e429.tar.gz flashrom-7a077222566c84546dca4a56c1a509626036e429.tar.bz2 flashrom-7a077222566c84546dca4a56c1a509626036e429.zip |
spi25: Remove now obsolete `four_bytes_addr_funcs` path
Change-Id: Idb7c576cb159630da2268813388b497cb5f46b43
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/22386
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'spi25.c')
-rw-r--r-- | spi25.c | 30 |
1 files changed, 7 insertions, 23 deletions
@@ -652,10 +652,7 @@ int spi_read_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start, lenhere = min(start + len, (i + 1) * area_size) - starthere; for (j = 0; j < lenhere; j += chunksize) { toread = min(chunksize, lenhere - j); - rc = (flash->chip->feature_bits & FEATURE_4BA_SUPPORT) == 0 - ? spi_nbyte_read(flash, starthere + j, buf + starthere - start + j, toread) - : flash->chip->four_bytes_addr_funcs.read_nbyte(flash, starthere + j, - buf + starthere - start + j, toread); + rc = spi_nbyte_read(flash, starthere + j, buf + starthere - start + j, toread); if (rc) break; } @@ -674,7 +671,6 @@ int spi_read_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start, int spi_write_chunked(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize) { - int rc = 0; unsigned int i, j, starthere, lenhere, towrite; /* FIXME: page_size is the wrong variable. We need max_writechunk_size * in struct flashctx to do this properly. All chips using @@ -699,21 +695,16 @@ int spi_write_chunked(struct flashctx *flash, const uint8_t *buf, unsigned int s /* Length of bytes in the range in this page. */ lenhere = min(start + len, (i + 1) * page_size) - starthere; for (j = 0; j < lenhere; j += chunksize) { + int rc; + towrite = min(chunksize, lenhere - j); - rc = (flash->chip->feature_bits & FEATURE_4BA_SUPPORT) == 0 - ? spi_nbyte_program(flash, starthere + j, buf + starthere - start + j, towrite) - : flash->chip->four_bytes_addr_funcs.program_nbyte(flash, starthere + j, - buf + starthere - start + j, towrite); + rc = spi_nbyte_program(flash, starthere + j, buf + starthere - start + j, towrite); if (rc) - break; - while (spi_read_status_register(flash) & SPI_SR_WIP) - programmer_delay(10); + return rc; } - if (rc) - break; } - return rc; + return 0; } /* @@ -726,18 +717,11 @@ int spi_write_chunked(struct flashctx *flash, const uint8_t *buf, unsigned int s int spi_chip_write_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len) { unsigned int i; - int result = 0; for (i = start; i < start + len; i++) { - result = (flash->chip->feature_bits & FEATURE_4BA_SUPPORT) == 0 - ? spi_nbyte_program(flash, i, buf + i - start, 1) - : flash->chip->four_bytes_addr_funcs.program_byte(flash, i, buf[i - start]); - if (result) + if (spi_nbyte_program(flash, i, buf + i - start, 1)) return 1; - while (spi_read_status_register(flash) & SPI_SR_WIP) - programmer_delay(10); } - return 0; } |