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
This commit is contained in:
oliviermartin 2011-08-15 16:12:13 +00:00
parent 969ece79f1
commit d8ad4736af
1 changed files with 13 additions and 11 deletions

View File

@ -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;