summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Halpin <jack.halpin@gmail.com>2009-10-11 03:11:13 +0000
committerJack Halpin <jack.halpin@gmail.com>2009-10-11 03:11:13 +0000
commit14079c39f0525e4ddb3951e3cf8a2aa52b170d77 (patch)
tree28211cd51c81ac07867df9ed562af1dd4335b658
parent178337970e7e09c68d3b4ff1b7bce61fb45ff321 (diff)
downloadrockbox-14079c39f0525e4ddb3951e3cf8a2aa52b170d77.tar.gz
rockbox-14079c39f0525e4ddb3951e3cf8a2aa52b170d77.zip
AMS Sansa: If SD card is HS capable set High Speed timings.
This still doesn't solve the problem of the cards being overclocked at 62MHz but we can mitigate this a bit by switching to HS timings. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23088 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/ata_sd_as3525.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c
index c848ba1dca..33816d4e61 100644
--- a/firmware/target/arm/as3525/ata_sd_as3525.c
+++ b/firmware/target/arm/as3525/ata_sd_as3525.c
@@ -94,6 +94,7 @@ static const int pl180_base[NUM_DRIVES] = {
94#endif 94#endif
95}; 95};
96 96
97static int sd_wait_for_state(const int drive, unsigned int state);
97static int sd_select_bank(signed char bank); 98static int sd_select_bank(signed char bank);
98static int sd_init_card(const int drive); 99static int sd_init_card(const int drive);
99static void init_pl180_controller(const int drive); 100static void init_pl180_controller(const int drive);
@@ -321,6 +322,15 @@ static int sd_init_card(const int drive)
321 MCI_CLOCK(drive) |= MCI_CLOCK_BYPASS; /* full speed for controller clock */ 322 MCI_CLOCK(drive) |= MCI_CLOCK_BYPASS; /* full speed for controller clock */
322 mci_delay(); 323 mci_delay();
323 324
325 /* If card is HS capable switch to HS timings */
326 if(card_info[drive].speed > 125000)
327 {
328 if(sd_wait_for_state(drive, SD_TRAN))
329 return -13;
330 if(!send_cmd(drive, SD_SWITCH_FUNC, 0x80fffff1, MCI_ARG, NULL))
331 return -14;
332 }
333
324 /* 334 /*
325 * enable bank switching 335 * enable bank switching
326 * without issuing this command, we only have access to 1/4 of the blocks 336 * without issuing this command, we only have access to 1/4 of the blocks
@@ -331,7 +341,7 @@ static int sd_init_card(const int drive)
331 { 341 {
332 const int ret = sd_select_bank(-1); 342 const int ret = sd_select_bank(-1);
333 if(ret < 0) 343 if(ret < 0)
334 return ret - 13; 344 return ret - 15;
335 } 345 }
336 346
337 return 0; 347 return 0;