summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-04 16:34:38 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-04 16:34:38 +0000
commit2b649f74775d0efd1e75c91f77c3045ae6249cb4 (patch)
treea39286cb968284f49d1dba3642386eea4ef023ae
parentf6381f4c3d338f9056b8af24d4e8b3f8e23ad64b (diff)
Program SD Cards into 4-bit mode (support for this is required in the spec). This gives a 20+% performance increase in load time of an 8MB image.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10455 6f19259b-4bc3-4df7-8a09-765794883524
-rwxr-xr-xOmap35xxPkg/Include/Omap3530/Omap3530Dma.h3
-rw-r--r--Omap35xxPkg/Include/Omap3530/Omap3530MMCHS.h3
-rw-r--r--Omap35xxPkg/MMCHSDxe/MMCHS.c21
3 files changed, 24 insertions, 3 deletions
diff --git a/Omap35xxPkg/Include/Omap3530/Omap3530Dma.h b/Omap35xxPkg/Include/Omap3530/Omap3530Dma.h
index 1b67a570d..927c6f270 100755
--- a/Omap35xxPkg/Include/Omap3530/Omap3530Dma.h
+++ b/Omap35xxPkg/Include/Omap3530/Omap3530Dma.h
@@ -97,7 +97,6 @@
#define DMA4_CCR_CONST_FILL_ENABLE BIT16
#define DMA4_CCR_TRANSPARENT_COPY_ENABLE BIT17
-
-
+
#endif
diff --git a/Omap35xxPkg/Include/Omap3530/Omap3530MMCHS.h b/Omap35xxPkg/Include/Omap3530/Omap3530MMCHS.h
index 80dfc1d97..d4abf305f 100644
--- a/Omap35xxPkg/Include/Omap3530/Omap3530MMCHS.h
+++ b/Omap35xxPkg/Include/Omap3530/Omap3530MMCHS.h
@@ -205,4 +205,7 @@
#define ACMD41 (INDX(41) | RSP_TYPE_48BITS)
#define ACMD41_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN)
+#define ACMD6 (INDX(6) | RSP_TYPE_48BITS)
+#define ACMD6_INT_EN (CERR_EN | CIE_EN | CCRC_EN | CC_EN | CEB_EN | CTO_EN)
+
#endif //__OMAP3530SDIO_H__
diff --git a/Omap35xxPkg/MMCHSDxe/MMCHS.c b/Omap35xxPkg/MMCHSDxe/MMCHS.c
index 61bf215f7..a6d2940cc 100644
--- a/Omap35xxPkg/MMCHSDxe/MMCHS.c
+++ b/Omap35xxPkg/MMCHSDxe/MMCHS.c
@@ -616,6 +616,23 @@ PerformCardConfiguration (
return Status;
}
+ if ((gCardInfo.CardType != UNKNOWN_CARD) && (gCardInfo.CardType != MMC_CARD)) {
+ // We could read SCR register, but SD Card Phys spec stats any SD Card shall
+ // set SCR.SD_BUS_WIDTHS to support 4-bit mode, so why bother?
+
+ // Send ACMD6 (application specific commands must be prefixed with CMD55)
+ Status = SendCmd (CMD55, CMD55_INT_EN, CmdArgument);
+ if (!EFI_ERROR (Status)) {
+ // set device into 4-bit data bus mode
+ Status = SendCmd (ACMD6, ACMD6_INT_EN, 0x2);
+ if (!EFI_ERROR (Status)) {
+ // Set host controler into 4-bit mode
+ MmioOr32 (MMCHS_HCTL, DTW_4_BIT);
+ DEBUG ((EFI_D_INFO, "SD Memory Card set to 4-bit mode\n"));
+ }
+ }
+ }
+
//Send CMD16 to set the block length
CmdArgument = gCardInfo.BlockSize;
Status = SendCmd (CMD16, CMD16_INT_EN, CmdArgument);
@@ -876,6 +893,8 @@ DetectCard (
gMMCHSMedia.MediaId++;
gMediaChange = FALSE;
+ DEBUG ((EFI_D_INFO, "SD Card Media Change\n"));
+
return Status;
}
@@ -1190,7 +1209,7 @@ MMCHSInitialize (
Status = gBS->CreateEvent (EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, TimerCallback, NULL, &gTimerEvent);
ASSERT_EFI_ERROR (Status);
- Status = gBS->SetTimer (gTimerEvent, TimerPeriodic, 1000000); // make me a PCD
+ Status = gBS->SetTimer (gTimerEvent, TimerPeriodic, 1000000ULL); // make me a PCD
ASSERT_EFI_ERROR (Status);
//Publish BlockIO.