From e541c98a7e19f22ab62a0adb370ea9f4c922e666 Mon Sep 17 00:00:00 2001 From: Fred Bauer Date: Wed, 29 Dec 2010 16:07:15 +0000 Subject: revert r28834 because it causes problems with uSD git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28925 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/sd-as3525.c | 42 ++++++---------------------------- 1 file changed, 7 insertions(+), 35 deletions(-) (limited to 'firmware/target/arm/as3525/sd-as3525.c') 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); static tCardInfo card_info[NUM_DRIVES]; /* maximum timeouts recommanded in the SD Specification v2.00 */ -#define SD_MAX_READ_TIMEOUT ((AS3525_PCLK_FREQ*(cpu_frequency==CPUFREQ_MAX?2:1)) / 1000 * 100) /* 100 ms */ -#define SD_MAX_WRITE_TIMEOUT ((AS3525_PCLK_FREQ*(cpu_frequency==CPUFREQ_MAX?2:1)) / 1000 * 250) /* 250 ms */ +#define SD_MAX_READ_TIMEOUT ((AS3525_PCLK_FREQ) / 1000 * 100) /* 100 ms */ +#define SD_MAX_WRITE_TIMEOUT ((AS3525_PCLK_FREQ) / 1000 * 250) /* 250 ms */ + /* for compatibility */ static long last_disk_activity = -1; @@ -139,8 +140,6 @@ static struct wakeup transfer_completion_signal; static volatile unsigned int transfer_error[NUM_VOLUMES]; #define PL180_MAX_TRANSFER_ERRORS 10 -extern long cpu_frequency; - #define UNALIGNED_NUM_SECTORS 10 static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */ 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, #define MCI_HALFSPEED (MCI_CLOCK_ENABLE) /* MCLK/2 */ #define MCI_QUARTERSPEED (MCI_CLOCK_ENABLE | 1) /* MCLK/4 */ #define MCI_IDENTSPEED (MCI_CLOCK_ENABLE | AS3525_SD_IDENT_DIV) /* IDENT */ -#define MCI_IDENTSPEED_BOOSTED (MCI_CLOCK_ENABLE | AS3525_SD_IDENT_DIV_BOOSTED) + static int sd_init_card(const int drive) { unsigned long response; @@ -294,10 +293,7 @@ static int sd_init_card(const int drive) card_info[drive].rca = 0; /* MCLCK on and set to 400kHz ident frequency */ - if (cpu_frequency == CPUFREQ_MAX) - MCI_CLOCK(drive) = MCI_IDENTSPEED_BOOSTED; - else - MCI_CLOCK(drive) = MCI_IDENTSPEED; + MCI_CLOCK(drive) = MCI_IDENTSPEED; /* 100 - 400kHz clock required for Identification Mode */ /* Start of Card Identification Mode ************************************/ @@ -379,12 +375,8 @@ static int sd_init_card(const int drive) MCI_CLOCK(drive) = MCI_HALFSPEED; /* MCICLK = IDE_CLK/2 = 25 MHz */ #if defined(HAVE_MULTIDRIVE) else - { /* PCLK = 31Mhz (62 boosted) MCI = 31Mhz(hs) or 15.5 */ - if (cpu_frequency == CPUFREQ_MAX ) - MCI_CLOCK(drive) = (hs_card ? MCI_HALFSPEED : MCI_QUARTERSPEED); - else - MCI_CLOCK(drive) = (hs_card ? MCI_FULLSPEED : MCI_HALFSPEED); - } + /* MCICLK = PCLK/2 = 31MHz(HS) or PCLK/4 = 15.5 Mhz (STD)*/ + MCI_CLOCK(drive) = (hs_card ? MCI_HALFSPEED : MCI_QUARTERSPEED); #endif /* CMD7 w/rca: Select card to put it in TRAN state */ @@ -531,26 +523,6 @@ static void sd_thread(void) } } -#ifdef HAVE_MULTIDRIVE -void sd_set_boosted_divider(void) -{ - if ( !sd_enabled ) - return; - /* 62Mhz/2 - 62/4 */ - MCI_CLOCK(SD_SLOT_AS3525) = (hs_card ? - MCI_HALFSPEED : MCI_QUARTERSPEED); -} - -void sd_set_unboosted_divider(void) -{ - if ( !sd_enabled ) - return; - /* 31Mhz/1 - 31/2 */ - MCI_CLOCK(SD_SLOT_AS3525) = (hs_card ? - MCI_FULLSPEED : MCI_HALFSPEED); -} -#endif - static void init_pl180_controller(const int drive) { MCI_COMMAND(drive) = MCI_DATA_CTRL(drive) = 0; -- cgit v1.2.3