From: oliviermartin Date: Mon, 15 Aug 2011 16:12:13 +0000 (+0000) Subject: EmbeddedPkg/MmcDxe: Fix the CMD3 sequence X-Git-Tag: edk2-stable201903~14404 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=d8ad4736afb60d282e07530733831015321e547f;ds=sidebyside EmbeddedPkg/MmcDxe: Fix the CMD3 sequence In the former version, we were checking the card was in the new state (Standby state). But the transition to the nez state is only visible in the response of the next command. This commit removes the check on the MMC state. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12130 6f19259b-4bc3-4df7-8a09-765794883524 --- 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;