[PATCH 2/8] BBB: Migrate MMC0 clock enable from am335x_sd.c:sdInit() to cpuio.c:initCPUio()

Jarielle Catbagan jcatbagan93 at gmail.com
Tue Aug 4 18:03:22 UTC 2015


The reason why the MMC0 clock enable has to be executed much earlier is a result of the invocation
of sdInstalled() in sd.h before sdInit().  Without this migration, an exception occurs since the
MMC0 interface has not been enabled before it is accessed by sdInstalled().
---
 ports/beagleboneblack/am335x_sd.c | 4 ----
 ports/beagleboneblack/cpuio.c     | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ports/beagleboneblack/am335x_sd.c b/ports/beagleboneblack/am335x_sd.c
index ac2392c..7eb0180 100644
--- a/ports/beagleboneblack/am335x_sd.c
+++ b/ports/beagleboneblack/am335x_sd.c
@@ -47,10 +47,6 @@ sdInit(int interface, int verbosity)
 {
 	uint32_t cmd, arg, resp[4];
 
-	/* Enable MMC0 clocks */
-	CM_PER_REG(CM_PER_MMC0_CLKCTRL) |= CM_PER_MMC0_CLKCTRL_MODULEMODE_ENABLE;
-	while (CM_PER_REG(CM_PER_MMC0_CLKCTRL) & CM_PER_MMC0_CLKCTRL_IDLEST);
-
 	/* Reset the MMC/SD controller */
 	MMCHS0_REG(SD_SYSCONFIG) = SD_SYSCONFIG_SOFTRESET;
 	while (!(MMCHS0_REG(SD_SYSSTATUS) & SD_SYSSTATUS_RESETDONE));
diff --git a/ports/beagleboneblack/cpuio.c b/ports/beagleboneblack/cpuio.c
index eab0a00..a1ca3aa 100644
--- a/ports/beagleboneblack/cpuio.c
+++ b/ports/beagleboneblack/cpuio.c
@@ -205,6 +205,10 @@ initCPUio(void)
 	// Enable clock for GPIO1:
 	CM_PER_REG(CM_PER_GPIO1_CLKCTRL) |= 2;
 
+	/* Enable MMC0 clocks */
+	CM_PER_REG(CM_PER_MMC0_CLKCTRL) |= CM_PER_MMC0_CLKCTRL_MODULEMODE_ENABLE;
+	while (CM_PER_REG(CM_PER_MMC0_CLKCTRL) & CM_PER_MMC0_CLKCTRL_IDLEST);
+
 	pinMuxInit();
 
 	InitUART(DEFAULT_BAUD_RATE);
-- 
2.5.0



More information about the umon-devel mailing list