aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2012-08-01 11:15:32 -0400
committerRalf Baechle <ralf@linux-mips.org>2012-08-01 12:10:06 -0400
commit95cf1468f712df516cc471adcd1c861df4e3d371 (patch)
tree36aa730653e3fe6b114d57e9b00374393d472533 /arch/mips/kernel/cpufreq/loongson2_cpufreq.c
parent4b00951f6f2fd335f063e553b474fe4648b3307d (diff)
MIPS: Loongson 2: Sort out clock managment.
For unexplainable reasons the Loongson 2 clock API was implemented in a module so fixing this involved shifting large amounts of code around. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/cpufreq/loongson2_cpufreq.c')
-rw-r--r--arch/mips/kernel/cpufreq/loongson2_cpufreq.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
index ae5db206347c..e7c98e2b78b6 100644
--- a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
+++ b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
@@ -19,7 +19,7 @@
19 19
20#include <asm/clock.h> 20#include <asm/clock.h>
21 21
22#include <loongson.h> 22#include <asm/mach-loongson/loongson.h>
23 23
24static uint nowait; 24static uint nowait;
25 25
@@ -181,6 +181,25 @@ static struct platform_driver platform_driver = {
181 .id_table = platform_device_ids, 181 .id_table = platform_device_ids,
182}; 182};
183 183
184/*
185 * This is the simple version of Loongson-2 wait, Maybe we need do this in
186 * interrupt disabled context.
187 */
188
189static DEFINE_SPINLOCK(loongson2_wait_lock);
190
191static void loongson2_cpu_wait(void)
192{
193 unsigned long flags;
194 u32 cpu_freq;
195
196 spin_lock_irqsave(&loongson2_wait_lock, flags);
197 cpu_freq = LOONGSON_CHIPCFG0;
198 LOONGSON_CHIPCFG0 &= ~0x7; /* Put CPU into wait mode */
199 LOONGSON_CHIPCFG0 = cpu_freq; /* Restore CPU state */
200 spin_unlock_irqrestore(&loongson2_wait_lock, flags);
201}
202
184static int __init cpufreq_init(void) 203static int __init cpufreq_init(void)
185{ 204{
186 int ret; 205 int ret;