From 34d8388bf4b5933b66056ad8ab4f78a23b7c569b Mon Sep 17 00:00:00 2001 From: Paul Scheffler Date: Thu, 15 Jun 2023 00:01:37 +0200 Subject: [PATCH] boot: Increase SD response timeout --- hw/bootrom/cheshire_bootrom.sv | 8 ++++---- sw/boot/flash.c | 8 ++++---- sw/include/hal/spi_sdcard.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/bootrom/cheshire_bootrom.sv b/hw/bootrom/cheshire_bootrom.sv index 2105cb978..1ce2edb30 100644 --- a/hw/bootrom/cheshire_bootrom.sv +++ b/hw/bootrom/cheshire_bootrom.sv @@ -1006,8 +1006,8 @@ module cheshire_bootrom #( 974: data_o = 32'hf0eff83e /* 0x0f38 */; 975: data_o = 32'h2501e0bf /* 0x0f3c */; 976: data_o = 32'h842ad161 /* 0x0f40 */; - 977: data_o = 32'h6489b771 /* 0x0f44 */; - 978: data_o = 32'h71048493 /* 0x0f48 */; + 977: data_o = 32'h64e1b771 /* 0x0f44 */; + 978: data_o = 32'h6a048493 /* 0x0f48 */; 979: data_o = 32'h0a134b11 /* 0x0f4c */; 980: data_o = 32'h49850171 /* 0x0f50 */; 981: data_o = 32'hc49da029 /* 0x0f54 */; @@ -1106,8 +1106,8 @@ module cheshire_bootrom #( 1074: data_o = 32'h089ce43e /* 0x10c8 */; 1075: data_o = 32'h0b3397e2 /* 0x10cc */; 1076: data_o = 32'h4c81418b /* 0x10d0 */; - 1077: data_o = 32'h6709e83e /* 0x10d4 */; - 1078: data_o = 32'h71070d93 /* 0x10d8 */; + 1077: data_o = 32'h6761e83e /* 0x10d4 */; + 1078: data_o = 32'h6a070d93 /* 0x10d8 */; 1079: data_o = 32'h09934a11 /* 0x10dc */; 1080: data_o = 32'h49050251 /* 0x10e0 */; 1081: data_o = 32'h0ff00a93 /* 0x10e4 */; diff --git a/sw/boot/flash.c b/sw/boot/flash.c index e983ca708..d94c0a5e7 100644 --- a/sw/boot/flash.c +++ b/sw/boot/flash.c @@ -72,13 +72,13 @@ int main() { target, sector); switch (target) { case 1: - ret = flash_spi_sdcard(core_freq, rtc_freq, img_base, sector, len); + { ret = flash_spi_sdcard(core_freq, rtc_freq, img_base, sector, len); break; } case 2: - ret = flash_spi_s25fs512s(core_freq, rtc_freq, img_base, sector, len); + { ret = flash_spi_s25fs512s(core_freq, rtc_freq, img_base, sector, len); break; } case 3: - ret = flash_i2c_24fc1025(core_freq, img_base, sector, len); + { ret = flash_i2c_24fc1025(core_freq, img_base, sector, len); break; } default: - ret = -1; + { ret = -1; break; } } if (ret) printf("ERROR (%d)\r\n", ret); diff --git a/sw/include/hal/spi_sdcard.h b/sw/include/hal/spi_sdcard.h index f6f03a3e3..4113c543a 100644 --- a/sw/include/hal/spi_sdcard.h +++ b/sw/include/hal/spi_sdcard.h @@ -23,10 +23,10 @@ typedef struct { static const uint64_t __spi_sdcard_init_clock = 200000; // How many cycles to wait for a non-yielding R1b response -static const uint64_t __spi_sdcard_r1b_timeout = 10000; +static const uint64_t __spi_sdcard_r1b_timeout = 100000; // How many cycles to wait for another data block -static const uint64_t __spi_sdcard_data_timeout = 10000; +static const uint64_t __spi_sdcard_data_timeout = 100000; // Sets up only this device; other functions may be used with own setup if requirements are met. // This assumes the power-up period of 1ms will be elapsed *before* issuing further commands.