From ba9220c5bdf951983bcee3f6c49b195a066d98e8 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 8 Aug 2022 10:06:05 -0500 Subject: [PATCH] sd: sdmmc: wait before sending second OCR introduce a small wait between probing and initialization OCR. This delay fixes a failure to initialize seen on some SD cards Fixes #47238 Signed-off-by: Daniel DeGrasse --- subsys/sd/sdmmc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/sd/sdmmc.c b/subsys/sd/sdmmc.c index c6e679a64e7..177efecc2c4 100644 --- a/subsys/sd/sdmmc.c +++ b/subsys/sd/sdmmc.c @@ -998,6 +998,11 @@ int sdmmc_card_init(struct sd_card *card) ocr_arg |= SD_OCR_VDD29_30FLAG; } ocr_arg |= (SD_OCR_VDD32_33FLAG | SD_OCR_VDD33_34FLAG); + /* Momentary delay before initialization OCR. Some cards will + * never leave busy state if init OCR is sent too soon after + * probing OCR + */ + k_busy_wait(100); /* Send SD OCR to card to initialize it */ ret = sdmmc_send_ocr(card, ocr_arg); } else {