diff options
author | Jack Halpin <jack.halpin@gmail.com> | 2010-03-24 05:41:33 +0000 |
---|---|---|
committer | Jack Halpin <jack.halpin@gmail.com> | 2010-03-24 05:41:33 +0000 |
commit | 9d9c090cbafb68268e492be299a017a02168b0b1 (patch) | |
tree | c1b5a886a33b653217d50cda345e9f4d44585db5 /firmware/target/arm | |
parent | 0466a110287b7133e4a3ea60ee68ed009a9e4079 (diff) |
sd-as3525v2.c Implement HS timings for those cards that are capable.
The internal card does not appear to be HS capable, at least not in 2GB clip+
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25316 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525v2.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index 5db63eef10..273507c495 100644 --- a/firmware/target/arm/as3525/sd-as3525v2.c +++ b/firmware/target/arm/as3525/sd-as3525v2.c @@ -318,6 +318,7 @@ static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attr static unsigned char *uncached_buffer = UNCACHED_ADDR(&aligned_buffer[0]); static void init_controller(void); +static int sd_wait_for_state(const int drive, unsigned int state); static tCardInfo card_info[NUM_DRIVES]; @@ -487,10 +488,28 @@ static int sd_init_card(const int drive) #endif /* End of Card Identification Mode ************************************/ + /* 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_RESP, &response)) + return -7; + + if(sd_wait_for_state(drive, SD_TRAN)) + return -8; + + /* 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 */ + if(!send_cmd(drive, SD_DESELECT_CARD, 0, MCI_RESP, &response)) + return -10; + /* CMD9 send CSD */ if(!send_cmd(drive, SD_SEND_CSD, card_info[drive].rca, MCI_RESP|MCI_LONG_RESP, card_info[drive].csd)) - return -7; + return -11; sd_parse_csd(&card_info[drive]); @@ -500,7 +519,7 @@ static int sd_init_card(const int drive) #ifndef HAVE_MULTIDRIVE /* 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 -8; + return -12; #endif card_info[drive].initialized = 1; |