Skip to content

Commit c88c028

Browse files
AlvinPaul26michalsimek
authored andcommitted
sd: mmc: Remove unwanted request to card for reading OCR content
As part of the MMC card initialization sequence, CMD1 command send multiple times to the card, first time to identify the card type and second time to check the requested voltage window is supported or not. There is a chance that after issuing the CMD1 for first time, card will move to the ready state before issuing the CMD1 for second time. In this case, card will not respond to the CMD1 send for the second time as card is already moved to ready state and this leads to failures. Hence remove the separate card identification logic and call mmc_send_op_cond only once to check both supported voltage window and card type identification. Signed-off-by: Paul Alvin <[email protected]> Message-ID: <[email protected]> Link: zephyrproject-rtos/zephyr#86144 State: waiting
1 parent 84e3ed5 commit c88c028

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

subsys/sd/mmc.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,6 @@ int mmc_card_init(struct sd_card *card)
111111
return -EINVAL;
112112
}
113113

114-
/* Probe to see if card is an MMC card */
115-
ret = mmc_send_op_cond(card, ocr_arg);
116-
if (ret) {
117-
return ret;
118-
}
119-
/* Card is MMC card if no error
120-
* (Only MMC protocol supports CMD1)
121-
*/
122-
card->type = CARD_MMC;
123-
124114
/* Set OCR Arguments */
125115
if (card->host_props.host_caps.vol_180_support) {
126116
ocr_arg |= MMC_OCR_VDD170_195FLAG;
@@ -221,9 +211,11 @@ static int mmc_send_op_cond(struct sd_card *card, int ocr)
221211
/* OCR failed */
222212
return ret;
223213
}
224-
if (ocr == 0) {
225-
/* Just probing */
226-
return 0;
214+
if (retries == 0) {
215+
/* Card is MMC card if no error
216+
* (Only MMC protocol supports CMD1)
217+
*/
218+
card->type = CARD_MMC;
227219
}
228220
sd_delay(10);
229221
}

0 commit comments

Comments
 (0)