diff options
author | Tomasz Moń <desowin@gmail.com> | 2011-12-21 09:58:03 +0000 |
---|---|---|
committer | Tomasz Moń <desowin@gmail.com> | 2011-12-21 09:58:03 +0000 |
commit | 013384f1387076a962388690341f8cb52e83f86c (patch) | |
tree | e414f6af5f4b3f2a61668f6c631ada12c072a871 /firmware/target/arm/tms320dm320/sdmmc-dm320.c | |
parent | 01415ad1b7d2d62c87d2bd2f433928a4a45e7859 (diff) |
Sansa Connect: Add udelay() in sdmmc card initialization to prevent dead locks.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31388 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tms320dm320/sdmmc-dm320.c')
-rw-r--r-- | firmware/target/arm/tms320dm320/sdmmc-dm320.c | 12 |
1 files changed, 9 insertions, 3 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), |