Unverified Commit 0a3095ea authored by enjoy-digital's avatar enjoy-digital Committed by GitHub

Merge pull request #583 from gsomlo/gls-sdcard-timeout

liblitesdcard/sdcard: adjust card-ready timeout
parents e473c6f2 6fdb36b8
...@@ -448,7 +448,7 @@ void sdcard_decode_csd(void) { ...@@ -448,7 +448,7 @@ void sdcard_decode_csd(void) {
int sdcard_init(void) { int sdcard_init(void) {
unsigned short rca; unsigned short rca;
uint16_t timeout; uint16_t timeout;
/* initialize freq */ /* initialize freq */
sdcard_set_clk_freq(16000000); sdcard_set_clk_freq(16000000);
...@@ -462,15 +462,13 @@ int sdcard_init(void) { ...@@ -462,15 +462,13 @@ int sdcard_init(void) {
busy_wait(1); busy_wait(1);
sdcard_send_ext_csd(); sdcard_send_ext_csd();
/* wait for card to be ready */ /* wait for card to be ready */
timeout = 10; for (timeout = 128; timeout > 0; timeout--) {
while (timeout) {
sdcard_app_cmd(0); sdcard_app_cmd(0);
sdcard_app_send_op_cond(1, 0); sdcard_app_send_op_cond(1, 0);
if (sdcard_response[3] & 0x80000000) { if (sdcard_response[3] & 0x80000000) {
break; break;
} }
busy_wait(1); busy_wait(10);
timeout--;
} }
if (timeout == 0) if (timeout == 0)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment