diff options
author | Fred Bauer <fred.w.bauer@gmail.com> | 2010-12-29 16:07:15 +0000 |
---|---|---|
committer | Fred Bauer <fred.w.bauer@gmail.com> | 2010-12-29 16:07:15 +0000 |
commit | e541c98a7e19f22ab62a0adb370ea9f4c922e666 (patch) | |
tree | 74aa302fcc9e3c1ea05c9f45ad1724da8badd71e /firmware/target/arm/as3525/sd-as3525.c | |
parent | 7f31e38ac12884db251734482e0d37174c62e40b (diff) | |
download | rockbox-e541c98a7e19f22ab62a0adb370ea9f4c922e666.tar.gz rockbox-e541c98a7e19f22ab62a0adb370ea9f4c922e666.zip |
revert r28834 because it causes problems with uSD
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28925 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525.c')
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525.c | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c index 6f11145ee6..0dc29c8aa5 100644 --- a/firmware/target/arm/as3525/sd-as3525.c +++ b/firmware/target/arm/as3525/sd-as3525.c | |||
@@ -116,8 +116,9 @@ static void init_pl180_controller(const int drive); | |||
116 | static tCardInfo card_info[NUM_DRIVES]; | 116 | static tCardInfo card_info[NUM_DRIVES]; |
117 | 117 | ||
118 | /* maximum timeouts recommanded in the SD Specification v2.00 */ | 118 | /* maximum timeouts recommanded in the SD Specification v2.00 */ |
119 | #define SD_MAX_READ_TIMEOUT ((AS3525_PCLK_FREQ*(cpu_frequency==CPUFREQ_MAX?2:1)) / 1000 * 100) /* 100 ms */ | 119 | #define SD_MAX_READ_TIMEOUT ((AS3525_PCLK_FREQ) / 1000 * 100) /* 100 ms */ |
120 | #define SD_MAX_WRITE_TIMEOUT ((AS3525_PCLK_FREQ*(cpu_frequency==CPUFREQ_MAX?2:1)) / 1000 * 250) /* 250 ms */ | 120 | #define SD_MAX_WRITE_TIMEOUT ((AS3525_PCLK_FREQ) / 1000 * 250) /* 250 ms */ |
121 | |||
121 | /* for compatibility */ | 122 | /* for compatibility */ |
122 | static long last_disk_activity = -1; | 123 | static long last_disk_activity = -1; |
123 | 124 | ||
@@ -139,8 +140,6 @@ static struct wakeup transfer_completion_signal; | |||
139 | static volatile unsigned int transfer_error[NUM_VOLUMES]; | 140 | static volatile unsigned int transfer_error[NUM_VOLUMES]; |
140 | #define PL180_MAX_TRANSFER_ERRORS 10 | 141 | #define PL180_MAX_TRANSFER_ERRORS 10 |
141 | 142 | ||
142 | extern long cpu_frequency; | ||
143 | |||
144 | #define UNALIGNED_NUM_SECTORS 10 | 143 | #define UNALIGNED_NUM_SECTORS 10 |
145 | static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */ | 144 | static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */ |
146 | static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]); | 145 | static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]); |
@@ -284,7 +283,7 @@ static bool send_cmd(const int drive, const int cmd, const int arg, | |||
284 | #define MCI_HALFSPEED (MCI_CLOCK_ENABLE) /* MCLK/2 */ | 283 | #define MCI_HALFSPEED (MCI_CLOCK_ENABLE) /* MCLK/2 */ |
285 | #define MCI_QUARTERSPEED (MCI_CLOCK_ENABLE | 1) /* MCLK/4 */ | 284 | #define MCI_QUARTERSPEED (MCI_CLOCK_ENABLE | 1) /* MCLK/4 */ |
286 | #define MCI_IDENTSPEED (MCI_CLOCK_ENABLE | AS3525_SD_IDENT_DIV) /* IDENT */ | 285 | #define MCI_IDENTSPEED (MCI_CLOCK_ENABLE | AS3525_SD_IDENT_DIV) /* IDENT */ |
287 | #define MCI_IDENTSPEED_BOOSTED (MCI_CLOCK_ENABLE | AS3525_SD_IDENT_DIV_BOOSTED) | 286 | |
288 | static int sd_init_card(const int drive) | 287 | static int sd_init_card(const int drive) |
289 | { | 288 | { |
290 | unsigned long response; | 289 | unsigned long response; |
@@ -294,10 +293,7 @@ static int sd_init_card(const int drive) | |||
294 | card_info[drive].rca = 0; | 293 | card_info[drive].rca = 0; |
295 | 294 | ||
296 | /* MCLCK on and set to 400kHz ident frequency */ | 295 | /* MCLCK on and set to 400kHz ident frequency */ |
297 | if (cpu_frequency == CPUFREQ_MAX) | 296 | MCI_CLOCK(drive) = MCI_IDENTSPEED; |
298 | MCI_CLOCK(drive) = MCI_IDENTSPEED_BOOSTED; | ||
299 | else | ||
300 | MCI_CLOCK(drive) = MCI_IDENTSPEED; | ||
301 | 297 | ||
302 | /* 100 - 400kHz clock required for Identification Mode */ | 298 | /* 100 - 400kHz clock required for Identification Mode */ |
303 | /* Start of Card Identification Mode ************************************/ | 299 | /* Start of Card Identification Mode ************************************/ |
@@ -379,12 +375,8 @@ static int sd_init_card(const int drive) | |||
379 | MCI_CLOCK(drive) = MCI_HALFSPEED; /* MCICLK = IDE_CLK/2 = 25 MHz */ | 375 | MCI_CLOCK(drive) = MCI_HALFSPEED; /* MCICLK = IDE_CLK/2 = 25 MHz */ |
380 | #if defined(HAVE_MULTIDRIVE) | 376 | #if defined(HAVE_MULTIDRIVE) |
381 | else | 377 | else |
382 | { /* PCLK = 31Mhz (62 boosted) MCI = 31Mhz(hs) or 15.5 */ | 378 | /* MCICLK = PCLK/2 = 31MHz(HS) or PCLK/4 = 15.5 Mhz (STD)*/ |
383 | if (cpu_frequency == CPUFREQ_MAX ) | 379 | MCI_CLOCK(drive) = (hs_card ? MCI_HALFSPEED : MCI_QUARTERSPEED); |
384 | MCI_CLOCK(drive) = (hs_card ? MCI_HALFSPEED : MCI_QUARTERSPEED); | ||
385 | else | ||
386 | MCI_CLOCK(drive) = (hs_card ? MCI_FULLSPEED : MCI_HALFSPEED); | ||
387 | } | ||
388 | #endif | 380 | #endif |
389 | 381 | ||
390 | /* CMD7 w/rca: Select card to put it in TRAN state */ | 382 | /* CMD7 w/rca: Select card to put it in TRAN state */ |
@@ -531,26 +523,6 @@ static void sd_thread(void) | |||
531 | } | 523 | } |
532 | } | 524 | } |
533 | 525 | ||
534 | #ifdef HAVE_MULTIDRIVE | ||
535 | void sd_set_boosted_divider(void) | ||
536 | { | ||
537 | if ( !sd_enabled ) | ||
538 | return; | ||
539 | /* 62Mhz/2 - 62/4 */ | ||
540 | MCI_CLOCK(SD_SLOT_AS3525) = (hs_card ? | ||
541 | MCI_HALFSPEED : MCI_QUARTERSPEED); | ||
542 | } | ||
543 | |||
544 | void sd_set_unboosted_divider(void) | ||
545 | { | ||
546 | if ( !sd_enabled ) | ||
547 | return; | ||
548 | /* 31Mhz/1 - 31/2 */ | ||
549 | MCI_CLOCK(SD_SLOT_AS3525) = (hs_card ? | ||
550 | MCI_FULLSPEED : MCI_HALFSPEED); | ||
551 | } | ||
552 | #endif | ||
553 | |||
554 | static void init_pl180_controller(const int drive) | 526 | static void init_pl180_controller(const int drive) |
555 | { | 527 | { |
556 | MCI_COMMAND(drive) = MCI_DATA_CTRL(drive) = 0; | 528 | MCI_COMMAND(drive) = MCI_DATA_CTRL(drive) = 0; |