EmbeddedPkg/MmcDxe: Removed redundant CMD12 calls from MMC

Command 12 - Stop transmission (ends read or write).
Normally only needed for streaming transfers or after error.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14525 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin 2013-08-06 12:10:25 +00:00 committed by oliviermartin
parent 842b02d87f
commit 9532373b1d
1 changed files with 18 additions and 6 deletions

View File

@ -486,6 +486,22 @@ MmcDetectCard (
}
}
EFI_STATUS
MmcStopTransmission (
EFI_MMC_HOST_PROTOCOL *MmcHost
)
{
EFI_STATUS Status;
UINT32 Response[4];
// Command 12 - Stop transmission (ends read or write)
// Normally only needed for streaming transfers or after error.
Status = MmcHost->SendCommand (MmcHost, MMC_CMD12, 0);
if (!EFI_ERROR (Status)) {
MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1b, Response);
}
return Status;
}
#define MMCI0_BLOCKLEN 512
#define MMCI0_TIMEOUT 10000
@ -598,6 +614,7 @@ MmcIoBlocks (
Status = MmcHost->ReadBlockData (MmcHost, Lba, This->Media->BlockSize, Buffer);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_BLKIO, "MmcIoBlocks(): Error Read Block Data and Status = %r\n", Status));
MmcStopTransmission (MmcHost);
return Status;
}
Status = MmcNotifyState (MmcHostInstance, MmcProgrammingState);
@ -610,16 +627,11 @@ MmcIoBlocks (
Status = MmcHost->WriteBlockData (MmcHost, Lba, This->Media->BlockSize, Buffer);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_BLKIO, "MmcIoBlocks(): Error Write Block Data and Status = %r\n", Status));
MmcStopTransmission (MmcHost);
return Status;
}
}
// Command 12 - Stop transmission (ends read)
Status = MmcHost->SendCommand (MmcHost, MMC_CMD12, 0);
if (!EFI_ERROR (Status)) {
MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1b, Response);
}
// Command 13 - Read status and wait for programming to complete (return to tran)
Timeout = MMCI0_TIMEOUT;
CmdArg = MmcHostInstance->CardInfo.RCA << 16;