summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2007-01-16 15:49:29 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2007-01-16 15:49:29 +0000
commit6309eabc6413acaa91a8e3dd94d3cb382a38dc14 (patch)
tree3a9a097d2d518bb348db7e78c58f808fdaba37b2
parent0fedaa205c78858d5b043f9fe432b5ba62b13fbe (diff)
downloadrockbox-6309eabc6413acaa91a8e3dd94d3cb382a38dc14.zip
rockbox-6309eabc6413acaa91a8e3dd94d3cb382a38dc14.tar.gz
rockbox-6309eabc6413acaa91a8e3dd94d3cb382a38dc14.tar.bz2
rockbox-6309eabc6413acaa91a8e3dd94d3cb382a38dc14.tar.xz
add cpu frequency scaling to the gigabeat. default/normal: 100MHz, boosted: 300MHz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12023 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/export/config-gigabeat.h3
-rw-r--r--firmware/export/system.h10
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c22
3 files changed, 33 insertions, 2 deletions
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index a12322e..6e22e8d 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -124,10 +124,9 @@
#define USB_GIGABEAT_STYLE
#define HAVE_HEADPHONE_DETECTION
+
/* Define this if you have adjustable CPU frequency */
-#if 0 /* TODO */
#define HAVE_ADJUSTABLE_CPU_FREQ
-#endif
#define BOOTFILE_EXT "gigabeat"
#define BOOTFILE "rockbox." BOOTFILE_EXT
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 86bbefb..688cf9b 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -273,6 +273,14 @@ static inline unsigned long swap32(unsigned long value)
/* TODO: Implement set_irq_level and check CPU frequencies */
+#if CONFIG_CPU == S3C2440
+
+#define CPUFREQ_DEFAULT 98784000
+#define CPUFREQ_NORMAL 98784000
+#define CPUFREQ_MAX 296352000
+
+#else
+
#define CPUFREQ_DEFAULT_MULT 8
#define CPUFREQ_DEFAULT 24000000
#define CPUFREQ_NORMAL_MULT 10
@@ -280,6 +288,8 @@ static inline unsigned long swap32(unsigned long value)
#define CPUFREQ_MAX_MULT 25
#define CPUFREQ_MAX 75000000
+#endif
+
static inline unsigned short swap16(unsigned short value)
/*
result[15..8] = value[ 7..0];
diff --git a/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c
index b922daa..0cb1666 100644
--- a/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c
@@ -68,4 +68,26 @@ void system_init(void)
}
+void set_cpu_frequency(long frequency)
+{
+ if (frequency == CPUFREQ_MAX)
+ {
+ /* FCLK: 300MHz, HCLK: 100MHz, PCLK: 50MHz */
+ /* MDIV: 97, PDIV: 1, SDIV: 2 */
+ /* HDIV: 3, PDIV: 1 */
+
+ MPLLCON = (97 << 12) | (1 << 4) | 2;
+ CLKDIVN = (3 << 1) | 1;
+ FREQ = CPUFREQ_MAX;
+ }
+ else
+ {
+ /* FCLK: 200MHz, HCLK: 100MHz, PCLK: 50MHz */
+ /* MDIV: 62, PDIV: 1, SDIV: 2 */
+ /* HDIV: 1, PDIV: 1 */
+ MPLLCON = (62 << 12) | (1 << 4) | 3;
+ CLKDIVN = (0 << 1) | 1;
+ FREQ = CPUFREQ_NORMAL;
+ }
+}