summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Universal/MmcDxe
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-15 16:12:13 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-15 16:12:13 +0000
commitd8ad4736afb60d282e07530733831015321e547f (patch)
tree2055ec29a7b612b838f87ab90a26fadfeb2e0c55 /EmbeddedPkg/Universal/MmcDxe
parent969ece79f161fb4ddcb2b370af7975a66b8f58e7 (diff)
downloadedk2-d8ad4736afb60d282e07530733831015321e547f.tar.gz
edk2-d8ad4736afb60d282e07530733831015321e547f.tar.bz2
edk2-d8ad4736afb60d282e07530733831015321e547f.zip
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
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;