aboutsummaryrefslogtreecommitdiffstats
path: root/serprog.c
diff options
context:
space:
mode:
authorUrja Rannikko <urjaman@gmail.com>2017-06-15 13:32:01 +0300
committerNico Huber <nico.h@gmx.de>2017-07-13 16:23:16 +0000
commit731316a9128c4015bc0facd1743afeb3a080129e (patch)
tree841a0f5b86816f556254d45c26859981561c3c81 /serprog.c
parent026c7416515985f47fe26a0478a37c0a1c2466c5 (diff)
downloadflashrom-731316a9128c4015bc0facd1743afeb3a080129e.tar.gz
flashrom-731316a9128c4015bc0facd1743afeb3a080129e.tar.bz2
flashrom-731316a9128c4015bc0facd1743afeb3a080129e.zip
Enable continuous SPI reads
Previous unnecessary page-by-page reading is repurposed to read by big naturally aligned areas (now chip size limited to 16MB for future-proofing of 4 byte addressed multi-die chips) and serprog hack for continuous reads is removed. Change-Id: Iadf909c9216578b1c5dacd4c4991bb436e32edc9 Signed-off-by: Urja Rannikko <urjaman@gmail.com> Reviewed-on: https://review.coreboot.org/20223 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'serprog.c')
-rw-r--r--serprog.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/serprog.c b/serprog.c
index 98aac831..25c9944e 100644
--- a/serprog.c
+++ b/serprog.c
@@ -303,15 +303,13 @@ static int serprog_spi_send_command(struct flashctx *flash,
unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr,
unsigned char *readarr);
-static int serprog_spi_read(struct flashctx *flash, uint8_t *buf,
- unsigned int start, unsigned int len);
static struct spi_master spi_master_serprog = {
.type = SPI_CONTROLLER_SERPROG,
.max_data_read = MAX_DATA_READ_UNLIMITED,
.max_data_write = MAX_DATA_WRITE_UNLIMITED,
.command = serprog_spi_send_command,
.multicommand = default_spi_send_multicommand,
- .read = serprog_spi_read,
+ .read = default_spi_read,
.write_256 = default_spi_write_256,
.write_aai = default_spi_write_aai,
};
@@ -933,25 +931,6 @@ static int serprog_spi_send_command(struct flashctx *flash,
return ret;
}
-/* FIXME: This function is optimized so that it does not split each transaction
- * into chip page_size long blocks unnecessarily like spi_read_chunked. This has
- * the advantage that it is much faster for most chips, but breaks those with
- * non-continuous reads. When spi_read_chunked is fixed this method can be removed. */
-static int serprog_spi_read(struct flashctx *flash, uint8_t *buf,
- unsigned int start, unsigned int len)
-{
- unsigned int i, cur_len;
- const unsigned int max_read = spi_master_serprog.max_data_read;
- for (i = 0; i < len; i += cur_len) {
- int ret;
- cur_len = min(max_read, (len - i));
- ret = spi_nbyte_read(flash, start + i, buf + i, cur_len);
- if (ret)
- return ret;
- }
- return 0;
-}
-
void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len)
{
/* Serprog transmits 24 bits only and assumes the underlying implementation handles any remaining bits