diff options
author | Wu Zhangjin <wuzhangjin@gmail.com> | 2009-11-16 12:32:59 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-12-16 20:57:20 -0500 |
commit | f8ede0f700f5478851f242f291d203cde54ca6cf (patch) | |
tree | 37fba17288bcd12468c454eb6c585d72fb6f9770 /arch/mips/loongson/common | |
parent | 9726b43a4d7aaa5b30f559e78768aeb3d17bc224 (diff) |
MIPS: Loongson 2F: Add CPU frequency scaling support
Loongson 2F supports CPU clock scaling. When put it into wait mode by
setting the frequency as ZERO it will stay in this mode until an external
interrupt wakes the CPU again.
To enable clock scaling support, an external timer of a known stable rate
is required.
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: cpufreq@vger.kernel.org,
Cc: Dave Jones <davej@redhat.com>,
Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
Cc: yanh@lemote.com
Cc: huhb@lemote.com,
Patchwork: http://patchwork.linux-mips.org/patch/660/
Patchwork: http://patchwork.linux-mips.org/patch/751/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/loongson/common')
-rw-r--r-- | arch/mips/loongson/common/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/loongson/common/env.c | 3 | ||||
-rw-r--r-- | arch/mips/loongson/common/platform.c | 30 |
3 files changed, 34 insertions, 1 deletions
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile index a21724d50e2c..8d71892413df 100644 --- a/arch/mips/loongson/common/Makefile +++ b/arch/mips/loongson/common/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \ | 5 | obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \ |
6 | pci.o bonito-irq.o mem.o machtype.o uart_base.o | 6 | pci.o bonito-irq.o mem.o machtype.o platform.o uart_base.o |
7 | 7 | ||
8 | # | 8 | # |
9 | # Early printk support | 9 | # Early printk support |
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c index b9ef50385541..196d947d929a 100644 --- a/arch/mips/loongson/common/env.c +++ b/arch/mips/loongson/common/env.c | |||
@@ -17,11 +17,14 @@ | |||
17 | * Free Software Foundation; either version 2 of the License, or (at your | 17 | * Free Software Foundation; either version 2 of the License, or (at your |
18 | * option) any later version. | 18 | * option) any later version. |
19 | */ | 19 | */ |
20 | #include <linux/module.h> | ||
21 | |||
20 | #include <asm/bootinfo.h> | 22 | #include <asm/bootinfo.h> |
21 | 23 | ||
22 | #include <loongson.h> | 24 | #include <loongson.h> |
23 | 25 | ||
24 | unsigned long bus_clock, cpu_clock_freq; | 26 | unsigned long bus_clock, cpu_clock_freq; |
27 | EXPORT_SYMBOL(cpu_clock_freq); | ||
25 | unsigned long memsize, highmemsize; | 28 | unsigned long memsize, highmemsize; |
26 | 29 | ||
27 | /* pmon passes arguments in 32bit pointers */ | 30 | /* pmon passes arguments in 32bit pointers */ |
diff --git a/arch/mips/loongson/common/platform.c b/arch/mips/loongson/common/platform.c new file mode 100644 index 000000000000..be81777eb94d --- /dev/null +++ b/arch/mips/loongson/common/platform.c | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Lemote Inc. | ||
3 | * Author: Wu Zhangjin, wuzj@lemote.com | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <linux/err.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | |||
14 | static struct platform_device loongson2_cpufreq_device = { | ||
15 | .name = "loongson2_cpufreq", | ||
16 | .id = -1, | ||
17 | }; | ||
18 | |||
19 | static int __init loongson2_cpufreq_init(void) | ||
20 | { | ||
21 | struct cpuinfo_mips *c = ¤t_cpu_data; | ||
22 | |||
23 | /* Only 2F revision and it's successors support CPUFreq */ | ||
24 | if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON2F) | ||
25 | return platform_device_register(&loongson2_cpufreq_device); | ||
26 | |||
27 | return -ENODEV; | ||
28 | } | ||
29 | |||
30 | arch_initcall(loongson2_cpufreq_init); | ||