Skip to content

Commit aaf7b72

Browse files
committed
spi: rp2040-gpio-bridge: Grow MAX_TRANSFER_SIZE
Increase the maximum SPI transfer size from an arbitrary 1 MiB to ~4 MiB (the amount of data that can be referenced by a single manifest). Signed-off-by: Richard Oliver <[email protected]>
1 parent f8e1143 commit aaf7b72

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

drivers/spi/spi-rp2040-gpio-bridge.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,19 @@
3131
#define RP2040_GBDG_BLOCK_SIZE (RP2040_GBDG_FLASH_BLOCK_SIZE - MD5_SUFFIX_SIZE)
3232

3333
/*
34-
* 1MiB transfer size is an arbitrary limit
3534
* Max value is 4173330 (using a single manifest)
35+
*
36+
* Internal page-size is 8KiB - 9 = 8183 bytes
37+
* Manifests address data by a series of 16-byte MD5 sums (following a 16-byte
38+
* manifest header)
39+
*
40+
* Max permissible data using a single manifest:
41+
* 8183 * (8183//16 - 1) = 4173330
42+
*
43+
* CMD_DAT_EMIT in fast_xfer/bypass_cache mode could potentially allow a max
44+
* transfer size of 4GiB, but this is not currently implemented.
3645
*/
37-
#define MAX_TRANSFER_SIZE (1024U * ONE_KIB)
46+
#define MAX_TRANSFER_SIZE 4173330
3847

3948
#define HALF_BUFFER (4U * ONE_KIB)
4049

@@ -58,7 +67,7 @@ static_assert(sizeof(struct rp2040_gbdg_device_info) == TOTAL_RD_HDR_SIZE);
5867
static_assert(MD5_DIGEST_SIZE == MANIFEST_UNIT_SIZE);
5968
#define MANIFEST_HEADER_UNITS 1
6069
#define MANIFEST_DATA_UNITS \
61-
DIV_ROUND_UP(MAX_TRANSFER_SIZE, RP2040_GBDG_BLOCK_SIZE)
70+
DIV_ROUND_UP((1024U * ONE_KIB), RP2040_GBDG_BLOCK_SIZE)
6271

6372
#define STATUS_BUSY 0x01
6473

0 commit comments

Comments
 (0)