amd_spi100: Use flashprog_read_chunked() for progress reporting

Read up to 64 KiB in one go to be able to report progress in between.
Otherwise, we might read the whole flash at once, without being able
to report progress.

Change-Id: I4d06f6f5d19944fe22298a1ddfb91244fa7c2eb6
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/74867
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/amd_spi100.c b/amd_spi100.c
index 43d2623..e260bd9 100644
--- a/amd_spi100.c
+++ b/amd_spi100.c
@@ -69,6 +69,13 @@
 	mmio_readn_aligned(spi100->spibar + reg, data, len, 4);
 }
 
+static int spi100_mmap_read(struct flashctx *flash, uint8_t *dst, unsigned int start, unsigned int len)
+{
+	const struct spi100 *const spi100 = flash->mst.spi->data;
+	mmio_readn_aligned(spi100->memory + start, dst, len, 8);
+	return 0;
+}
+
 static int spi100_check_readwritecnt(const unsigned int writecnt, const unsigned int readcnt)
 {
 	if (writecnt < 1) {
@@ -165,7 +172,7 @@
 	/* Translate `start` to memory-mapped offset. */
 	start -= mapped_start;
 
-	mmio_readn_aligned(spi100->memory + start, buf, len, 8);
+	flashprog_read_chunked(flash, buf, start, len, MAX_DATA_READ_UNLIMITED, spi100_mmap_read);
 
 	return 0;
 }