summaryrefslogtreecommitdiff
path: root/EmbeddedPkg/Universal
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2013-08-06 12:10:25 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2013-08-06 12:10:25 +0000
commit9532373b1dd5b9f4ba0c2c69fd287d436013ad0c (patch)
tree5048e63b129f4b06a81d29b38f15d5e2f9ef4104 /EmbeddedPkg/Universal
parent842b02d87f3c9d3a4192ee47ff2476e498ef3b3c (diff)
downloadedk2-platforms-9532373b1dd5b9f4ba0c2c69fd287d436013ad0c.tar.xz
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
Diffstat (limited to 'EmbeddedPkg/Universal')
-rw-r--r--EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
index 57fa14e42e..82ec5a7a2d 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
@@ -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;