spi25: Replace spi_read_chunked() with more abstract version

The new flashprog_read_chunked() takes a low-level reading function as
argument. This allows us to make use of the chunking with non-SPI read
functions.

Change-Id: Ica1b616e75e4e7682120928588e231c82cf4cf70
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/74865
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/include/flash.h b/include/flash.h
index b411f34..cfc9c4e 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -178,6 +178,7 @@
 struct flashprog_flashctx;
 #define flashctx flashprog_flashctx /* TODO: Agree on a name and convert all occurrences. */
 typedef int (erasefunc_t)(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
+typedef int (readfunc_t)(struct flashctx *flash, uint8_t *dst, unsigned int start, unsigned int len);
 
 enum flash_reg {
 	INVALID_REG = 0,
@@ -418,6 +419,7 @@
 void print_supported_wiki(void);
 
 /* helpers.c */
+int flashprog_read_chunked(struct flashctx *, uint8_t *dst, unsigned int start, unsigned int len, unsigned int chunksize, readfunc_t *);
 uint32_t address_to_bits(uint32_t addr);
 unsigned int bitcount(unsigned long a);
 #undef MIN