X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EmbeddedPkg%2FUniversal%2FMmcDxe%2FMmcBlockIo.c;h=38998c893fcde0bc8f13bdb24636e99daaf40b56;hp=887cb96a161578b9a3ea501235a37013daa1c063;hb=d8ad4736afb60d282e07530733831015321e547f;hpb=969ece79f161fb4ddcb2b370af7975a66b8f58e7 diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c index 887cb96a16..38998c893f 100644 --- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c +++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c @@ -333,19 +333,21 @@ MmcIdentificationMode ( return Status; } - CmdArg = 0; - CmdRetryCnt = CMD_RETRY_COUNT; - //Keep sending CMD 3 until card enters to Standby mode and Card status is ready - while((MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_STDBY) && CmdRetryCnt--) { - Status = MmcHost->SendCommand(MMC_CMD3, CmdArg); - if (EFI_ERROR(Status)) { - DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n")); - return Status; - } - MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_RCA,Response); - PrintRCA(Response[0]); + // + // Note, SD specifications say that "if the command execution causes a state change, it + // will be visible to the host in the response to the next command" + // The status returned for this CMD3 will be 2 - identification + // + CmdArg = 1; + Status = MmcHost->SendCommand(MMC_CMD3, CmdArg); + if (EFI_ERROR(Status)) { + DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n")); + return Status; } + MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_RCA,Response); + PrintRCA(Response[0]); + // For MMC card, RCA is assigned by CMD3 while CMD3 dumps the RCA for SD card if (MmcHostInstance->CardInfo.CardType != MMC_CARD) { MmcHostInstance->CardInfo.RCA = Response[0] >> 16;