From 56457934c684b88ebf0156cfc9c69d71d3849348 Mon Sep 17 00:00:00 2001 From: Jack Halpin Date: Mon, 10 May 2010 17:34:54 +0000 Subject: 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(-) (limited to 'firmware/target/arm/as3525/sd-as3525v2.c') diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index 356deb88f1..0eb6943531 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; -- cgit v1.2.3