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>
diff --git a/serprog.c b/serprog.c
index 98aac83..25c9944 100644
--- a/serprog.c
+++ b/serprog.c
@@ -303,15 +303,13 @@
 				    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 @@
 	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