summaryrefslogtreecommitdiff
path: root/EmbeddedPkg/Universal/MmcDxe
diff options
context:
space:
mode:
Diffstat (limited to 'EmbeddedPkg/Universal/MmcDxe')
-rw-r--r--EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c24
1 files changed, 13 insertions, 11 deletions
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;