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
This commit is contained in:
Jack Halpin 2010-05-10 17:34:54 +00:00
parent fb6723afe4
commit 56457934c6

View file

@ -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;