diff options
-rw-r--r-- | apps/debug_menu.c | 22 | ||||
-rw-r--r-- | firmware/export/config-ipodnano.h | 4 | ||||
-rw-r--r-- | firmware/export/config-ipodvideo.h | 2 | ||||
-rw-r--r-- | firmware/export/system.h | 7 | ||||
-rw-r--r-- | firmware/system.c | 54 |
5 files changed, 71 insertions, 18 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 267f548d87..619d38c6d2 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1049,7 +1049,9 @@ bool dbg_ports(void) | |||
1049 | lcd_puts(0, line++, buf); | 1049 | lcd_puts(0, line++, buf); |
1050 | snprintf(buf, sizeof(buf), "GPIO_D: %02x", gpio_d); | 1050 | snprintf(buf, sizeof(buf), "GPIO_D: %02x", gpio_d); |
1051 | lcd_puts(0, line++, buf); | 1051 | lcd_puts(0, line++, buf); |
1052 | 1052 | unsigned hehe = 0x12345678; | |
1053 | snprintf(buf, sizeof(buf), "%x %x", hehe, swap32(hehe)); | ||
1054 | lcd_puts(0, line++, buf); | ||
1053 | lcd_update(); | 1055 | lcd_update(); |
1054 | button = button_get_w_tmo(HZ/10); | 1056 | button = button_get_w_tmo(HZ/10); |
1055 | 1057 | ||
@@ -1183,16 +1185,24 @@ bool dbg_cpufreq(void) | |||
1183 | 1185 | ||
1184 | switch(button) | 1186 | switch(button) |
1185 | { | 1187 | { |
1188 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) | ||
1189 | case BUTTON_MENU: | ||
1190 | #else | ||
1186 | case BUTTON_UP: | 1191 | case BUTTON_UP: |
1192 | #endif | ||
1187 | cpu_boost(true); | 1193 | cpu_boost(true); |
1188 | break; | 1194 | break; |
1189 | 1195 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) | |
1196 | case BUTTON_PLAY: | ||
1197 | #else | ||
1190 | case BUTTON_DOWN: | 1198 | case BUTTON_DOWN: |
1199 | #endif | ||
1191 | cpu_boost(false); | 1200 | cpu_boost(false); |
1192 | break; | 1201 | break; |
1193 | 1202 | ||
1194 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | 1203 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ |
1195 | (CONFIG_KEYPAD == IRIVER_H300_PAD) | 1204 | (CONFIG_KEYPAD == IRIVER_H300_PAD) || \ |
1205 | (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) | ||
1196 | case BUTTON_SELECT: | 1206 | case BUTTON_SELECT: |
1197 | #else | 1207 | #else |
1198 | case BUTTON_PLAY: | 1208 | case BUTTON_PLAY: |
@@ -1200,9 +1210,13 @@ bool dbg_cpufreq(void) | |||
1200 | set_cpu_frequency(CPUFREQ_DEFAULT); | 1210 | set_cpu_frequency(CPUFREQ_DEFAULT); |
1201 | boost_counter = 0; | 1211 | boost_counter = 0; |
1202 | break; | 1212 | break; |
1203 | 1213 | ||
1214 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) | ||
1215 | case BUTTON_LEFT: | ||
1216 | #else | ||
1204 | case SETTINGS_CANCEL: | 1217 | case SETTINGS_CANCEL: |
1205 | case SETTINGS_OK2: | 1218 | case SETTINGS_OK2: |
1219 | #endif | ||
1206 | return false; | 1220 | return false; |
1207 | } | 1221 | } |
1208 | } | 1222 | } |
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index 1843d1809c..6bcbffb3b2 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h | |||
@@ -73,7 +73,7 @@ | |||
73 | #define ROM_START 0x00000000 | 73 | #define ROM_START 0x00000000 |
74 | 74 | ||
75 | /* Define this to the CPU frequency */ | 75 | /* Define this to the CPU frequency */ |
76 | #define CPU_FREQ 11289600 | 76 | #define CPU_FREQ 24000000 |
77 | 77 | ||
78 | #define CONFIG_LCD LCD_IPODNANO | 78 | #define CONFIG_LCD LCD_IPODNANO |
79 | 79 | ||
@@ -95,7 +95,7 @@ | |||
95 | #define CONFIG_LED LED_VIRTUAL | 95 | #define CONFIG_LED LED_VIRTUAL |
96 | 96 | ||
97 | /* Define this if you have adjustable CPU frequency */ | 97 | /* Define this if you have adjustable CPU frequency */ |
98 | //#define HAVE_ADJUSTABLE_CPU_FREQ | 98 | #define HAVE_ADJUSTABLE_CPU_FREQ |
99 | 99 | ||
100 | #define BOOTFILE_EXT "ipod" | 100 | #define BOOTFILE_EXT "ipod" |
101 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 101 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 6057afa9d7..6ea9fcebb8 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h | |||
@@ -97,7 +97,7 @@ | |||
97 | #define CONFIG_LED LED_VIRTUAL | 97 | #define CONFIG_LED LED_VIRTUAL |
98 | 98 | ||
99 | /* Define this if you have adjustable CPU frequency */ | 99 | /* Define this if you have adjustable CPU frequency */ |
100 | //#define HAVE_ADJUSTABLE_CPU_FREQ | 100 | #define HAVE_ADJUSTABLE_CPU_FREQ |
101 | 101 | ||
102 | #define BOOTFILE_EXT "ipod" | 102 | #define BOOTFILE_EXT "ipod" |
103 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 103 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
diff --git a/firmware/export/system.h b/firmware/export/system.h index e88c793fae..eb5bb52053 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h | |||
@@ -305,8 +305,11 @@ static inline void invalidate_icache(void) | |||
305 | 305 | ||
306 | /* TODO: Implement set_irq_level and check CPU frequencies */ | 306 | /* TODO: Implement set_irq_level and check CPU frequencies */ |
307 | 307 | ||
308 | #define CPUFREQ_DEFAULT CPU_FREQ | 308 | #define CPUFREQ_DEFAULT_MULT 8 |
309 | #define CPUFREQ_NORMAL 37500000 | 309 | #define CPUFREQ_DEFAULT 240000000 |
310 | #define CPUFREQ_NORMAL_MULT 10 | ||
311 | #define CPUFREQ_NORMAL 30000000 | ||
312 | #define CPUFREQ_MAX_MULT 25 | ||
310 | #define CPUFREQ_MAX 75000000 | 313 | #define CPUFREQ_MAX 75000000 |
311 | 314 | ||
312 | static inline unsigned short swap16(unsigned short value) | 315 | static inline unsigned short swap16(unsigned short value) |
diff --git a/firmware/system.c b/firmware/system.c index 63cdf0a144..b432cde79a 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -1200,21 +1200,55 @@ static void ipod_init_cache(void) | |||
1200 | inb(i); | 1200 | inb(i); |
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | static void ipod_set_cpu_speed(void) | 1203 | /* Only these two support CPU boosting at the moment */ |
1204 | #if defined(APPLE_IPODNANO) || defined(APPLE_IPODVIDEO) | ||
1205 | void set_cpu_frequency(long frequency) | ||
1204 | { | 1206 | { |
1205 | outl(inl(0x70000020) | (1<<30), 0x70000020); | 1207 | unsigned long postmult; |
1208 | |||
1209 | if (frequency == CPUFREQ_NORMAL) | ||
1210 | postmult = CPUFREQ_NORMAL_MULT; | ||
1211 | else if (frequency == CPUFREQ_MAX) | ||
1212 | postmult = CPUFREQ_MAX_MULT; | ||
1213 | else | ||
1214 | postmult = CPUFREQ_DEFAULT_MULT; | ||
1215 | cpu_frequency = frequency; | ||
1206 | 1216 | ||
1207 | /* Set run state to 24MHz */ | 1217 | /* Enable PLL? */ |
1218 | outl(inl(0x70000020) | (1<<30), 0x70000020); | ||
1219 | |||
1220 | /* Select 24MHz crystal as clock source? */ | ||
1208 | outl((inl(0x60006020) & 0x0fffff0f) | 0x20000020, 0x60006020); | 1221 | outl((inl(0x60006020) & 0x0fffff0f) | 0x20000020, 0x60006020); |
1209 | 1222 | ||
1210 | /* 75 MHz (24/8)*25 */ | 1223 | /* Clock frequency = (24/8)*postmult */ |
1211 | outl(0xaa021908, 0x60006034); | 1224 | outl(0xaa020000 | 8 | (postmult << 8), 0x60006034); |
1212 | udelay(2000); | 1225 | /* Wait for PLL relock? */ |
1226 | udelay(2000); | ||
1213 | 1227 | ||
1214 | outl((inl(0x60006020) & 0x0fffff0f) | 0x20000070, 0x60006020); | 1228 | /* Select PLL as clock source? */ |
1229 | outl((inl(0x60006020) & 0x0fffff0f) | 0x20000070, 0x60006020); | ||
1230 | } | ||
1231 | #else | ||
1232 | void ipod_set_cpu_frequency(void) | ||
1233 | { | ||
1234 | /* Enable PLL? */ | ||
1235 | outl(inl(0x70000020) | (1<<30), 0x70000020); | ||
1236 | |||
1237 | /* Select 24MHz crystal as clock source? */ | ||
1238 | outl((inl(0x60006020) & 0x0fffff0f) | 0x20000020, 0x60006020); | ||
1239 | |||
1240 | /* Clock frequency = (24/8)*25 = 75MHz */ | ||
1241 | outl(0xaa020000 | 8 | (25 << 8), 0x60006034); | ||
1242 | /* Wait for PLL relock? */ | ||
1243 | udelay(2000); | ||
1244 | |||
1245 | /* Select PLL as clock source? */ | ||
1246 | outl((inl(0x60006020) & 0x0fffff0f) | 0x20000070, 0x60006020); | ||
1215 | } | 1247 | } |
1216 | #endif | 1248 | #endif |
1217 | 1249 | ||
1250 | #endif /* BOOTLOADER */ | ||
1251 | |||
1218 | void system_init(void) | 1252 | void system_init(void) |
1219 | { | 1253 | { |
1220 | #ifndef BOOTLOADER | 1254 | #ifndef BOOTLOADER |
@@ -1230,8 +1264,10 @@ void system_init(void) | |||
1230 | outl(-1, 0x60001038); | 1264 | outl(-1, 0x60001038); |
1231 | outl(-1, 0x60001028); | 1265 | outl(-1, 0x60001028); |
1232 | outl(-1, 0x6000101c); | 1266 | outl(-1, 0x6000101c); |
1233 | ipod_set_cpu_speed(); | 1267 | #if !defined(APPLE_IPODNANO) && !defined(APPLE_IPODVIDEO) |
1234 | ipod_init_cache(); | 1268 | ipod_set_cpu_frequency(); |
1269 | #endif | ||
1270 | ipod_init_cache(); | ||
1235 | #endif | 1271 | #endif |
1236 | } | 1272 | } |
1237 | 1273 | ||