]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmbeddedPkg/MmcDxe: Fix the CMD3 sequence
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Aug 2011 16:12:13 +0000 (16:12 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Aug 2011 16:12:13 +0000 (16:12 +0000)
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

EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c

index 887cb96a161578b9a3ea501235a37013daa1c063..38998c893fcde0bc8f13bdb24636e99daaf40b56 100644 (file)
@@ -333,19 +333,21 @@ MmcIdentificationMode (
     return Status;\r
   }\r
 \r
-  CmdArg = 0;\r
-  CmdRetryCnt = CMD_RETRY_COUNT;\r
-  //Keep sending CMD 3 until card enters to Standby mode and Card status is ready\r
-  while((MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_STDBY) && CmdRetryCnt--) {\r
-    Status = MmcHost->SendCommand(MMC_CMD3, CmdArg);\r
-    if (EFI_ERROR(Status)) {\r
-        DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));\r
-        return Status;\r
-    }\r
-    MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_RCA,Response);\r
-    PrintRCA(Response[0]);\r
+  //\r
+  // Note, SD specifications say that "if the command execution causes a state change, it\r
+  // will be visible to the host in the response to the next command"\r
+  // The status returned for this CMD3 will be 2 - identification\r
+  //\r
+  CmdArg = 1;\r
+  Status = MmcHost->SendCommand(MMC_CMD3, CmdArg);\r
+  if (EFI_ERROR(Status)) {\r
+    DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));\r
+    return Status;\r
   }\r
 \r
+  MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_RCA,Response);\r
+  PrintRCA(Response[0]);\r
+\r
   // For MMC card, RCA is assigned by CMD3 while CMD3 dumps the RCA for SD card\r
   if (MmcHostInstance->CardInfo.CardType != MMC_CARD) {\r
     MmcHostInstance->CardInfo.RCA = Response[0] >> 16;\r