aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu/clock-cpg.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-05-13 04:38:11 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-05-13 04:38:11 -0400
commit253b0887b3736160feac9ccdcf146a2073e41463 (patch)
treefb7e0776555cff9275760293c10c13e8c8f365fe /arch/sh/kernel/cpu/clock-cpg.c
parent100890c55e326a9acb4429593c5ad2012c194564 (diff)
sh: clkfwk: Rework legacy CPG clock handling.
This moves out the old legacy CPG clocks to their own file, and converts over the existing users. With these clocks going away and each CPU dealing with them on their own, CPUs can gradually move over to the new interface. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/clock-cpg.c')
-rw-r--r--arch/sh/kernel/cpu/clock-cpg.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c
new file mode 100644
index 00000000000..b4ca2004844
--- /dev/null
+++ b/arch/sh/kernel/cpu/clock-cpg.c
@@ -0,0 +1,60 @@
1#include <linux/clk.h>
2#include <linux/compiler.h>
3#include <asm/clock.h>
4
5static struct clk master_clk = {
6 .name = "master_clk",
7 .flags = CLK_ENABLE_ON_INIT,
8 .rate = CONFIG_SH_PCLK_FREQ,
9};
10
11static struct clk peripheral_clk = {
12 .name = "peripheral_clk",
13 .parent = &master_clk,
14 .flags = CLK_ENABLE_ON_INIT,
15};
16
17static struct clk bus_clk = {
18 .name = "bus_clk",
19 .parent = &master_clk,
20 .flags = CLK_ENABLE_ON_INIT,
21};
22
23static struct clk cpu_clk = {
24 .name = "cpu_clk",
25 .parent = &master_clk,
26 .flags = CLK_ENABLE_ON_INIT,
27};
28
29/*
30 * The ordering of these clocks matters, do not change it.
31 */
32static struct clk *onchip_clocks[] = {
33 &master_clk,
34 &peripheral_clk,
35 &bus_clk,
36 &cpu_clk,
37};
38
39int __init __deprecated cpg_clk_init(void)
40{
41 int i, ret = 0;
42
43 for (i = 0; i < ARRAY_SIZE(onchip_clocks); i++) {
44 struct clk *clk = onchip_clocks[i];
45 arch_init_clk_ops(&clk->ops, i);
46 if (clk->ops)
47 ret |= clk_register(clk);
48 }
49
50 return ret;
51}
52
53/*
54 * Placeholder for compatability, until the lazy CPUs do this
55 * on their own.
56 */
57int __init __weak arch_clk_init(void)
58{
59 return cpg_clk_init();
60}