[PATCH 1/2] mmc: detect illegal command response in SPI mode
Kathpalia, Tanmay
tanmay.kathpalia at altera.com
Tue Jul 7 19:57:29 CEST 2026
On 7/6/2026 11:56 AM, Peng Fan wrote:
> On Sun, Jun 14, 2026 at 02:04:37AM +0200, Mart?? Alonso wrote:
>> At idle state, prior initialization, MMC cards (not SD) will respond
>> with illegal command to anything other than CMD1 (MMC_SEND_OP_COND) and
>> CMD58 (MMC_READ_OCR). The MMC driver initially sends CMD8
>> (SD_SEND_IF_COND) to check for an SD card, but this needs to return an
>> error, if not an SD card, so it can later check for an MMC card with
>> CMD1 (MMC_SEND_OP_COND).
> CMD8 is supported in SD 2.0+, so this might break SD 1.0.
>
>> Additionally, CMD55 + ACMD41 (SD_APP_SEND_OP_COND) can be skipped if
>> CMD8 (SD_SEND_IF_COND) already failed.
>>
Peng is correct. CMD8 was introduced in SD spec v2.0, so SD v1.x cards
return an illegal command response to it - identical to MMC. CMD8 failure
alone cannot distinguish between SD v1.x and MMC.
ACMD41 is the correct discriminator: SD cards (v1.x and v2.0+) respond to
it; MMC cards do not. Only an ACMD41 timeout means the card is not SD.
The existing code handles this correctly by always attempting ACMD41
regardless of CMD8's result. See section 4.2.3 "Card Initialization and
Identification" of the SD Physical Layer Simplified Specification.
Regards,
Tanmay Kathpalia
More information about the U-Boot
mailing list