summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sd-as3525v2.c
diff options
context:
space:
mode:
authorJack Halpin <jack.halpin@gmail.com>2010-05-10 17:34:54 +0000
committerJack Halpin <jack.halpin@gmail.com>2010-05-10 17:34:54 +0000
commit56457934c684b88ebf0156cfc9c69d71d3849348 (patch)
treecf95752b306a243347c0466676dd7fc66e38dd5c /firmware/target/arm/as3525/sd-as3525v2.c
parentfb6723afe48ec4aa40ff675c0a97d404bad37434 (diff)
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
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525v2.c')
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c7
1 files changed, 4 insertions, 3 deletions
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;