diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-11-08 15:05:55 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-11-27 07:38:21 -0500 |
commit | cf30fb4a4f2d261a6527a654a7fdc8636f1e5b16 (patch) | |
tree | 2bb46da438fe09e8c8bc14ad21e1755d8e1ed9f3 /arch/arm/mach-realview/core.c | |
parent | 0318e693d3a56836632bf1a2cfdafb7f34bcc703 (diff) |
[ARM] realview: convert to clkdev and lookup clocks by device name
People often point to the Integrator/Versatile/Realview
implementations to justify using the consumer name as the sole
selector for clocks.
Eliminate this excuse by changing the Realview implementation, so
it provides a better example of how it should be done.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-realview/core.c')
-rw-r--r-- | arch/arm/mach-realview/core.c | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 2f04d54711e..2491374818e 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/clockchips.h> | 29 | #include <linux/clockchips.h> |
30 | #include <linux/io.h> | 30 | #include <linux/io.h> |
31 | 31 | ||
32 | #include <asm/clkdev.h> | ||
32 | #include <asm/system.h> | 33 | #include <asm/system.h> |
33 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
34 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
@@ -188,13 +189,60 @@ static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco) | |||
188 | writel(0, sys_lock); | 189 | writel(0, sys_lock); |
189 | } | 190 | } |
190 | 191 | ||
191 | struct clk realview_clcd_clk = { | 192 | static struct clk oscvco_clk = { |
192 | .name = "CLCDCLK", | ||
193 | .params = &realview_oscvco_params, | 193 | .params = &realview_oscvco_params, |
194 | .setvco = realview_oscvco_set, | 194 | .setvco = realview_oscvco_set, |
195 | }; | 195 | }; |
196 | 196 | ||
197 | /* | 197 | /* |
198 | * These are fixed clocks. | ||
199 | */ | ||
200 | static struct clk ref24_clk = { | ||
201 | .rate = 24000000, | ||
202 | }; | ||
203 | |||
204 | static struct clk_lookup lookups[] = { | ||
205 | { /* UART0 */ | ||
206 | .dev_id = "dev:f1", | ||
207 | .clk = &ref24_clk, | ||
208 | }, { /* UART1 */ | ||
209 | .dev_id = "dev:f2", | ||
210 | .clk = &ref24_clk, | ||
211 | }, { /* UART2 */ | ||
212 | .dev_id = "dev:f3", | ||
213 | .clk = &ref24_clk, | ||
214 | }, { /* UART3 */ | ||
215 | .dev_id = "fpga:09", | ||
216 | .clk = &ref24_clk, | ||
217 | }, { /* KMI0 */ | ||
218 | .dev_id = "fpga:06", | ||
219 | .clk = &ref24_clk, | ||
220 | }, { /* KMI1 */ | ||
221 | .dev_id = "fpga:07", | ||
222 | .clk = &ref24_clk, | ||
223 | }, { /* MMC0 */ | ||
224 | .dev_id = "fpga:05", | ||
225 | .clk = &ref24_clk, | ||
226 | }, { /* EB:CLCD */ | ||
227 | .dev_id = "dev:20", | ||
228 | .clk = &oscvco_clk, | ||
229 | }, { /* PB:CLCD */ | ||
230 | .dev_id = "issp:20", | ||
231 | .clk = &oscvco_clk, | ||
232 | } | ||
233 | }; | ||
234 | |||
235 | static int __init clk_init(void) | ||
236 | { | ||
237 | int i; | ||
238 | |||
239 | for (i = 0; i < ARRAY_SIZE(lookups); i++) | ||
240 | clkdev_add(&lookups[i]); | ||
241 | return 0; | ||
242 | } | ||
243 | arch_initcall(clk_init); | ||
244 | |||
245 | /* | ||
198 | * CLCD support. | 246 | * CLCD support. |
199 | */ | 247 | */ |
200 | #define SYS_CLCD_NLCDIOON (1 << 2) | 248 | #define SYS_CLCD_NLCDIOON (1 << 2) |