From bd7b951af04b0443065e84f3886a22e74ba42cfc Mon Sep 17 00:00:00 2001 From: Andrew Dennison Date: Mon, 29 May 2023 15:07:36 +1000 Subject: [PATCH] soc/software/liblitesdcard: be less verbose debug is now more usable: Booting from SDCard in SD-Mode... Booting from boot.json... Setting SDCard clk freq to 781 KHz CMD0: GO_IDLE cmdevt: wait for event & 0x1 cmdevt: 00000001 00000000 00000000 00000000 00000000 CMD8: SEND_EXT_CSD, arg: 0x000001aa cmdevt: wait for event & 0x1 cmdevt: 00000005 00000000 00000000 00000000 00000000 Booting from boot.bin... Setting SDCard clk freq to 781 KHz CMD0: GO_IDLE cmdevt: wait for event & 0x1 cmdevt: 00000001 00000000 00000000 00000000 00000000 CMD8: SEND_EXT_CSD, arg: 0x000001aa cmdevt: wait for event & 0x1 cmdevt: 00000005 00000000 00000000 00000000 00000000 SDCard boot failed. No boot medium found --- litex/soc/software/liblitesdcard/sdcard.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/litex/soc/software/liblitesdcard/sdcard.c b/litex/soc/software/liblitesdcard/sdcard.c index 05be4e670..6557d3a63 100644 --- a/litex/soc/software/liblitesdcard/sdcard.c +++ b/litex/soc/software/liblitesdcard/sdcard.c @@ -41,17 +41,16 @@ int sdcard_wait_cmd_done(void) { unsigned int event; #ifdef SDCARD_DEBUG uint32_t r[SD_CMD_RESPONSE_SIZE/4]; + printf("cmdevt: wait for event & 0x1\n"); #endif for (;;) { event = sdcore_cmd_event_read(); -#ifdef SDCARD_DEBUG - printf("cmdevt: %08x\n", event); -#endif busy_wait_us(10); if (event & 0x1) break; } #ifdef SDCARD_DEBUG + printf("cmdevt: %08x\n", event); csr_rd_buf_uint32(CSR_SDCORE_CMD_RESPONSE_ADDR, r, SD_CMD_RESPONSE_SIZE/4); printf("%08x %08x %08x %08x\n", r[0], r[1], r[2], r[3]); @@ -65,15 +64,18 @@ int sdcard_wait_cmd_done(void) { int sdcard_wait_data_done(void) { unsigned int event; +#ifdef SDCARD_DEBUG + printf("dataevt: wait for event & 0x1\n"); +#endif for (;;) { event = sdcore_data_event_read(); -#ifdef SDCARD_DEBUG - printf("dataevt: %08x\n", event); -#endif if (event & 0x1) break; busy_wait_us(10); } +#ifdef SDCARD_DEBUG + printf("dataevt: %08x\n", event); +#endif if (event & 0x4) return SD_TIMEOUT; else if (event & 0x8)