From c49d5dd6316d2581879b6ff840d03f22e365a371 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 21 Apr 2007 09:29:01 +0000 Subject: Coldfire targets: Adjusted PLL settings (lowest possible VCO clock for each setting) and IDE timing (especially it's faster now on M5+X5). * Added/updated table showing the necessary settings (PLL, refresh, waitstates, IDE timing) for each possible clock frequency. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13230 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/coldfire/iaudio/system-iaudio.c | 35 +++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'firmware/target/coldfire/iaudio/system-iaudio.c') diff --git a/firmware/target/coldfire/iaudio/system-iaudio.c b/firmware/target/coldfire/iaudio/system-iaudio.c index 30a4f6e71b..565f75aa6d 100644 --- a/firmware/target/coldfire/iaudio/system-iaudio.c +++ b/firmware/target/coldfire/iaudio/system-iaudio.c @@ -24,6 +24,28 @@ #include "timer.h" #include "pcf50606.h" +/* Settings for all possible clock frequencies (with properly working timers) + * + * xxx_REFRESH_TIMER below + * system.h, CPUFREQ_xxx_MULT | + * | | + * V V + * PLLCR & Rftim. IDECONFIG1/IDECONFIG2 + * CPUCLK/Hz MULT ~0x70c00000 16MB CSCR0 CSCR1 CS2Pre CS2Post CS2Wait + * ------------------------------------------------------------------------- + * 11289600 1 0x00000200 4 0x0180 0x0180 1 1 0 + * 22579200 2 0x05028049 10 0x0180 0x0180 1 1 0 + * 33868800 3 0x03024049 15 0x0180 0x0180 1 1 0 + * 45158400 4 0x05028045 21 0x0180 0x0180 1 1 0 + * 56448000 5 0x02028049 26 0x0580 0x0580 2 1 0 + * 67737600 6 0x03024045 32 0x0580 0x0980 2 1 0 + * 79027200 7 0x0302a045 37 0x0580 0x0d80 2 1 0 + * 90316800 8 0x03030045 43 0x0980 0x0d80 2 1 0 + * 101606400 9 0x01024049 48 0x0980 0x1180 2 1 0 + * 112896000 10 0x01028049 54 0x0980 0x1580 3 1 0 + * 124185600 11 0x0102c049 59 0x0980 0x1180 3 1 1 + */ + #define MAX_REFRESH_TIMER 59 #define NORMAL_REFRESH_TIMER 21 #define DEFAULT_REFRESH_TIMER 4 @@ -42,7 +64,7 @@ void set_cpu_frequency(long frequency) PLLCR &= ~1; /* Bypass mode */ timers_adjust_prescale(CPUFREQ_DEFAULT_MULT, false); RECALC_DELAYS(CPUFREQ_MAX); - PLLCR = 0x03042045 | (PLLCR & 0x70C00000); + PLLCR = 0x0102c049 | (PLLCR & 0x70C00000); CSCR0 = 0x00001180; /* Flash: 4 wait states */ CSCR1 = 0x00000980; /* LCD: 2 wait states */ while(!(PLLCR & 0x80000000)) {}; /* Wait until the PLL has locked. @@ -50,7 +72,8 @@ void set_cpu_frequency(long frequency) timers_adjust_prescale(CPUFREQ_MAX_MULT, true); DCR = (0x8200 | MAX_REFRESH_TIMER); /* Refresh timer */ cpu_frequency = CPUFREQ_MAX; - IDECONFIG1 = 0x106000 | (5 << 10); /* BUFEN2 enable + CS2Pre/CS2Post */ + IDECONFIG1 = 0x100000 | (1 << 13) | (3 << 10); + /* BUFEN2 enable | CS2Post | CS2Pre */ IDECONFIG2 = 0x40000 | (1 << 8); /* TA enable + CS2wait */ break; @@ -60,7 +83,7 @@ void set_cpu_frequency(long frequency) PLLCR &= ~1; /* Bypass mode */ timers_adjust_prescale(CPUFREQ_DEFAULT_MULT, false); RECALC_DELAYS(CPUFREQ_NORMAL); - PLLCR = 0x06030045 | (PLLCR & 0x70C00000); + PLLCR = 0x05028045 | (PLLCR & 0x70C00000); CSCR0 = 0x00000580; /* Flash: 1 wait state */ CSCR1 = 0x00000180; /* LCD: 0 wait states */ while(!(PLLCR & 0x80000000)) {}; /* Wait until the PLL has locked. @@ -68,7 +91,8 @@ void set_cpu_frequency(long frequency) timers_adjust_prescale(CPUFREQ_NORMAL_MULT, true); DCR = (0x8000 | NORMAL_REFRESH_TIMER); /* Refresh timer */ cpu_frequency = CPUFREQ_NORMAL; - IDECONFIG1 = 0x106000 | (5 << 10); /* BUFEN2 enable + CS2Pre/CS2Post */ + IDECONFIG1 = 0x100000 | (1 << 13) | (1 << 10); + /* BUFEN2 enable | CS2Post | CS2Pre */ IDECONFIG2 = 0x40000 | (0 << 8); /* TA enable + CS2wait */ break; default: @@ -83,7 +107,8 @@ void set_cpu_frequency(long frequency) CSCR1 = 0x00000180; /* LCD: 0 wait states */ DCR = (0x8000 | DEFAULT_REFRESH_TIMER); /* Refresh timer */ cpu_frequency = CPUFREQ_DEFAULT; - IDECONFIG1 = 0x106000 | (1 << 10); /* BUFEN2 enable + CS2Pre/CS2Post */ + IDECONFIG1 = 0x100000 | (1 << 13) | (1 << 10); + /* BUFEN2 enable | CS2Post | CS2Pre */ IDECONFIG2 = 0x40000 | (0 << 8); /* TA enable + CS2wait */ break; } -- cgit v1.2.3