diff options
Diffstat (limited to 'arch/arm/mach-sa1100/clock.c')
-rw-r--r-- | arch/arm/mach-sa1100/clock.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c index 9fa6a990cf03..03c75a811cb0 100644 --- a/arch/arm/mach-sa1100/clock.c +++ b/arch/arm/mach-sa1100/clock.c | |||
@@ -15,10 +15,12 @@ | |||
15 | #include <linux/clkdev.h> | 15 | #include <linux/clkdev.h> |
16 | 16 | ||
17 | #include <mach/hardware.h> | 17 | #include <mach/hardware.h> |
18 | #include <mach/generic.h> | ||
18 | 19 | ||
19 | struct clkops { | 20 | struct clkops { |
20 | void (*enable)(struct clk *); | 21 | void (*enable)(struct clk *); |
21 | void (*disable)(struct clk *); | 22 | void (*disable)(struct clk *); |
23 | unsigned long (*get_rate)(struct clk *); | ||
22 | }; | 24 | }; |
23 | 25 | ||
24 | struct clk { | 26 | struct clk { |
@@ -33,13 +35,6 @@ struct clk clk_##_name = { \ | |||
33 | 35 | ||
34 | static DEFINE_SPINLOCK(clocks_lock); | 36 | static DEFINE_SPINLOCK(clocks_lock); |
35 | 37 | ||
36 | /* Dummy clk routine to build generic kernel parts that may be using them */ | ||
37 | unsigned long clk_get_rate(struct clk *clk) | ||
38 | { | ||
39 | return 0; | ||
40 | } | ||
41 | EXPORT_SYMBOL(clk_get_rate); | ||
42 | |||
43 | static void clk_gpio27_enable(struct clk *clk) | 38 | static void clk_gpio27_enable(struct clk *clk) |
44 | { | 39 | { |
45 | /* | 40 | /* |
@@ -58,6 +53,19 @@ static void clk_gpio27_disable(struct clk *clk) | |||
58 | GAFR &= ~GPIO_32_768kHz; | 53 | GAFR &= ~GPIO_32_768kHz; |
59 | } | 54 | } |
60 | 55 | ||
56 | static void clk_cpu_enable(struct clk *clk) | ||
57 | { | ||
58 | } | ||
59 | |||
60 | static void clk_cpu_disable(struct clk *clk) | ||
61 | { | ||
62 | } | ||
63 | |||
64 | static unsigned long clk_cpu_get_rate(struct clk *clk) | ||
65 | { | ||
66 | return sa11x0_getspeed(0) * 1000; | ||
67 | } | ||
68 | |||
61 | int clk_enable(struct clk *clk) | 69 | int clk_enable(struct clk *clk) |
62 | { | 70 | { |
63 | unsigned long flags; | 71 | unsigned long flags; |
@@ -87,16 +95,37 @@ void clk_disable(struct clk *clk) | |||
87 | } | 95 | } |
88 | EXPORT_SYMBOL(clk_disable); | 96 | EXPORT_SYMBOL(clk_disable); |
89 | 97 | ||
98 | unsigned long clk_get_rate(struct clk *clk) | ||
99 | { | ||
100 | if (clk && clk->ops && clk->ops->get_rate) | ||
101 | return clk->ops->get_rate(clk); | ||
102 | |||
103 | return 0; | ||
104 | } | ||
105 | EXPORT_SYMBOL(clk_get_rate); | ||
106 | |||
90 | const struct clkops clk_gpio27_ops = { | 107 | const struct clkops clk_gpio27_ops = { |
91 | .enable = clk_gpio27_enable, | 108 | .enable = clk_gpio27_enable, |
92 | .disable = clk_gpio27_disable, | 109 | .disable = clk_gpio27_disable, |
93 | }; | 110 | }; |
94 | 111 | ||
112 | const struct clkops clk_cpu_ops = { | ||
113 | .enable = clk_cpu_enable, | ||
114 | .disable = clk_cpu_disable, | ||
115 | .get_rate = clk_cpu_get_rate, | ||
116 | }; | ||
117 | |||
95 | static DEFINE_CLK(gpio27, &clk_gpio27_ops); | 118 | static DEFINE_CLK(gpio27, &clk_gpio27_ops); |
96 | 119 | ||
120 | static DEFINE_CLK(cpu, &clk_cpu_ops); | ||
121 | |||
97 | static struct clk_lookup sa11xx_clkregs[] = { | 122 | static struct clk_lookup sa11xx_clkregs[] = { |
98 | CLKDEV_INIT("sa1111.0", NULL, &clk_gpio27), | 123 | CLKDEV_INIT("sa1111.0", NULL, &clk_gpio27), |
99 | CLKDEV_INIT("sa1100-rtc", NULL, NULL), | 124 | CLKDEV_INIT("sa1100-rtc", NULL, NULL), |
125 | CLKDEV_INIT("sa11x0-fb", NULL, &clk_cpu), | ||
126 | CLKDEV_INIT("sa11x0-pcmcia", NULL, &clk_cpu), | ||
127 | /* sa1111 names devices using internal offsets, PCMCIA is at 0x1800 */ | ||
128 | CLKDEV_INIT("1800", NULL, &clk_cpu), | ||
100 | }; | 129 | }; |
101 | 130 | ||
102 | static int __init sa11xx_clk_init(void) | 131 | static int __init sa11xx_clk_init(void) |