From cc7ede53a93465ece37b250d2449441a0c1285b5 Mon Sep 17 00:00:00 2001 From: FlynDice Date: Mon, 10 May 2010 17:34:54 +0000 Subject: [PATCH] sd-as3525v2: Add delay after SD_SWITCH_FUNC to while switching to high speed timings and wait until after this switch to bring the card clock back up to full speed. This seems to make switching the uSD card to high speed timing much more reliable. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25935 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/sd-as3525v2.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index 356deb88f..0eb694353 100644 --- a/firmware/target/arm/as3525/sd-as3525v2.c +++ b/firmware/target/arm/as3525/sd-as3525v2.c @@ -507,9 +507,6 @@ static int sd_init_card(const int drive) #endif /* End of Card Identification Mode ************************************/ - /* Card back to full speed */ - MCI_CLKDIV &= ~(0xFF); /* CLK_DIV_0 : bits 7:0 = 0x00 */ - /* Attempt to switch cards to HS timings, non HS cards just ignore this */ /* CMD7 w/rca: Select card to put it in TRAN state */ if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL)) @@ -521,6 +518,7 @@ static int sd_init_card(const int drive) /* CMD6 */ if(!send_cmd(drive, SD_SWITCH_FUNC, 0x80fffff1, MCI_NO_RESP, NULL)) return -9; + mci_delay(); /* We need to go back to STBY state now so we can read csd */ /* CMD7 w/rca=0: Deselect card to put it in STBY state */ @@ -534,6 +532,9 @@ static int sd_init_card(const int drive) sd_parse_csd(&card_info[drive]); + /* Card back to full speed */ + MCI_CLKDIV &= ~(0xFF); /* CLK_DIV_0 : bits 7:0 = 0x00 */ + /* CMD7 w/rca: Select card to put it in TRAN state */ if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL)) return -12; -- 2.11.4.GIT