summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/tms320dm320/sdmmc-dm320.c12
-rw-r--r--firmware/target/arm/tms320dm320/system-dm320.c2
2 files changed, 10 insertions, 4 deletions
diff --git a/firmware/target/arm/tms320dm320/sdmmc-dm320.c b/firmware/target/arm/tms320dm320/sdmmc-dm320.c
index 6b5399d9a2..447ada21ae 100644
--- a/firmware/target/arm/tms320dm320/sdmmc-dm320.c
+++ b/firmware/target/arm/tms320dm320/sdmmc-dm320.c
@@ -348,6 +348,9 @@ static int sd_init_card(const int card_no)
bitclr16(&IO_MMC_CONTROL, MMC_CTRL_WIDTH);
sd_set_clock_rate(INITIAL_CLK);
+ /* Prevent dead lock */
+ udelay(100);
+
ret = sd_command(SD_GO_IDLE_STATE, 0, MMC_CMD_INITCLK, NULL);
if (ret < 0)
@@ -424,6 +427,9 @@ static int sd_init_card(const int card_no)
sd_set_clock_rate(currcard->speed);
+ /* Prevent dead lock */
+ udelay(100);
+
ret = sd_command(SD_SELECT_CARD, currcard->rca,
SDHC_RESP_FMT_1, NULL);
if (ret < 0)
@@ -893,7 +899,7 @@ int sd_init(void)
/* mmc module clock: 75 Mhz (AHB) / 2 = ~37.5 Mhz
* (Frequencies above are taken from Sansa Connect's OF source code) */
- IO_CLK_DIV3 = (IO_CLK_DIV3 & 0xFF00) | 0x02; /* OF uses 1 */
+ IO_CLK_DIV3 = (IO_CLK_DIV3 & 0xFF00) | 0x01;
bitset16(&IO_CLK_MOD2, CLK_MOD2_MMC);
@@ -932,8 +938,8 @@ int sd_init(void)
sd_select_device(1);
- /* Enable Memory Card CLK */
- bitset16(&IO_MMC_MEM_CLK_CONTROL, (1 << 8));
+ /* Disable Memory Card CLK - it is enabled on demand by TMS320DM320 */
+ bitclr16(&IO_MMC_MEM_CLK_CONTROL, (1 << 8));
queue_init(&sd_queue, true);
sd_thread_id = create_thread(sd_thread, sd_stack, sizeof(sd_stack),
diff --git a/firmware/target/arm/tms320dm320/system-dm320.c b/firmware/target/arm/tms320dm320/system-dm320.c
index e455ade590..5d7872f2bc 100644
--- a/firmware/target/arm/tms320dm320/system-dm320.c
+++ b/firmware/target/arm/tms320dm320/system-dm320.c
@@ -435,7 +435,7 @@ void udelay(int usec) {
if (stop < count)
{
/* udelay will end after counter reset (tick) */
- while (((IO_TIMER1_TMCNT < stop) && (current_tick != prev_tick)) ||
+ while ((IO_TIMER1_TMCNT < stop) ||
(current_tick == prev_tick)); /* ensure new tick */
}
else