From 5897249c1e4fff7e4fa096fd83d89782c3b064ac Mon Sep 17 00:00:00 2001 From: Jack Halpin Date: Sat, 24 Oct 2009 16:42:24 +0000 Subject: [PATCH] Add #ifdef HAVE_MULTIDRIVE to HS timings switch for uSD cards. Internal cards are v1 sd cards so no need to include this code for the clip. Move transition from STBY -> TRAN-> STBY states inside the if(sd_v2) conditional check for HS switch as it's not needed for non HS cards. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23331 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/ata_sd_as3525.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c index 6a2860528f..65df027c30 100644 --- a/firmware/target/arm/as3525/ata_sd_as3525.c +++ b/firmware/target/arm/as3525/ata_sd_as3525.c @@ -310,25 +310,27 @@ static int sd_init_card(const int drive) MCI_CLOCK(drive) |= MCI_CLOCK_BYPASS; /* FIXME: 50 MHz is spec limit */ mci_delay(); - /* CMD7 w/rca: Select card to put it in TRAN state */ - if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_ARG, NULL)) - return -7; - +#ifdef HAVE_MULTIDRIVE /* Try to switch V2 cards to HS timings, non HS seem to ignore this */ if(sd_v2) { + /* CMD7 w/rca: Select card to put it in TRAN state */ + if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_ARG, NULL)) + return -7; + if(sd_wait_for_state(drive, SD_TRAN)) return -8; /* CMD6 */ if(!send_cmd(drive, SD_SWITCH_FUNC, 0x80fffff1, MCI_ARG, NULL)) return -9; mci_delay(); - } - /* go back to STBY state so we can read csd */ - /* CMD7 w/rca=0: Deselect card to put it in STBY state */ - if(!send_cmd(drive, SD_DESELECT_CARD, 0, MCI_ARG, NULL)) - return -10; + /* go back to STBY state so we can read csd */ + /* CMD7 w/rca=0: Deselect card to put it in STBY state */ + if(!send_cmd(drive, SD_DESELECT_CARD, 0, MCI_ARG, NULL)) + return -10; + } +#endif /* HAVE_MULTIDRIVE */ /* CMD9 send CSD */ if(!send_cmd(drive, SD_SEND_CSD, card_info[drive].rca,