diff options
-rw-r--r-- | arch/arm/boot/dts/integratorcp.dts | 6 | ||||
-rw-r--r-- | arch/arm/common/timer-sp.c | 35 | ||||
-rw-r--r-- | arch/arm/mach-integrator/integrator_cp.c | 34 |
3 files changed, 38 insertions, 37 deletions
diff --git a/arch/arm/boot/dts/integratorcp.dts b/arch/arm/boot/dts/integratorcp.dts index 8b119399025a..ff1aea0ee043 100644 --- a/arch/arm/boot/dts/integratorcp.dts +++ b/arch/arm/boot/dts/integratorcp.dts | |||
@@ -24,15 +24,15 @@ | |||
24 | }; | 24 | }; |
25 | 25 | ||
26 | timer0: timer@13000000 { | 26 | timer0: timer@13000000 { |
27 | compatible = "arm,sp804", "arm,primecell"; | 27 | compatible = "arm,integrator-cp-timer"; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | timer1: timer@13000100 { | 30 | timer1: timer@13000100 { |
31 | compatible = "arm,sp804", "arm,primecell"; | 31 | compatible = "arm,integrator-cp-timer"; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | timer2: timer@13000200 { | 34 | timer2: timer@13000200 { |
35 | compatible = "arm,sp804", "arm,primecell"; | 35 | compatible = "arm,integrator-cp-timer"; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | pic: pic@14000000 { | 38 | pic: pic@14000000 { |
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c index ded926f7c4e8..ddc740769601 100644 --- a/arch/arm/common/timer-sp.c +++ b/arch/arm/common/timer-sp.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include <asm/sched_clock.h> | 32 | #include <asm/sched_clock.h> |
33 | #include <asm/hardware/arm_timer.h> | 33 | #include <asm/hardware/arm_timer.h> |
34 | #include <asm/hardware/timer-sp.h> | ||
34 | 35 | ||
35 | static long __init sp804_get_clock_rate(struct clk *clk) | 36 | static long __init sp804_get_clock_rate(struct clk *clk) |
36 | { | 37 | { |
@@ -262,3 +263,37 @@ err: | |||
262 | iounmap(base); | 263 | iounmap(base); |
263 | } | 264 | } |
264 | CLOCKSOURCE_OF_DECLARE(sp804, "arm,sp804", sp804_of_init); | 265 | CLOCKSOURCE_OF_DECLARE(sp804, "arm,sp804", sp804_of_init); |
266 | |||
267 | static void __init integrator_cp_of_init(struct device_node *np) | ||
268 | { | ||
269 | static int init_count = 0; | ||
270 | void __iomem *base; | ||
271 | int irq; | ||
272 | const char *name = of_get_property(np, "compatible", NULL); | ||
273 | |||
274 | base = of_iomap(np, 0); | ||
275 | if (WARN_ON(!base)) | ||
276 | return; | ||
277 | |||
278 | /* Ensure timer is disabled */ | ||
279 | writel(0, base + TIMER_CTRL); | ||
280 | |||
281 | if (init_count == 2 || !of_device_is_available(np)) | ||
282 | goto err; | ||
283 | |||
284 | if (!init_count) | ||
285 | sp804_clocksource_init(base, name); | ||
286 | else { | ||
287 | irq = irq_of_parse_and_map(np, 0); | ||
288 | if (irq <= 0) | ||
289 | goto err; | ||
290 | |||
291 | sp804_clockevents_init(base, irq, name); | ||
292 | } | ||
293 | |||
294 | init_count++; | ||
295 | return; | ||
296 | err: | ||
297 | iounmap(base); | ||
298 | } | ||
299 | CLOCKSOURCE_OF_DECLARE(intcp, "arm,integrator-cp-timer", integrator_cp_of_init); | ||
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index 2b0db82a5381..5781f3cfeeaa 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c | |||
@@ -250,39 +250,6 @@ static void __init intcp_init_early(void) | |||
250 | } | 250 | } |
251 | 251 | ||
252 | #ifdef CONFIG_OF | 252 | #ifdef CONFIG_OF |
253 | |||
254 | static void __init cp_of_timer_init(void) | ||
255 | { | ||
256 | struct device_node *node; | ||
257 | const char *path; | ||
258 | void __iomem *base; | ||
259 | int err; | ||
260 | int irq; | ||
261 | |||
262 | err = of_property_read_string(of_aliases, | ||
263 | "arm,timer-primary", &path); | ||
264 | if (WARN_ON(err)) | ||
265 | return; | ||
266 | node = of_find_node_by_path(path); | ||
267 | base = of_iomap(node, 0); | ||
268 | if (WARN_ON(!base)) | ||
269 | return; | ||
270 | writel(0, base + TIMER_CTRL); | ||
271 | sp804_clocksource_init(base, node->name); | ||
272 | |||
273 | err = of_property_read_string(of_aliases, | ||
274 | "arm,timer-secondary", &path); | ||
275 | if (WARN_ON(err)) | ||
276 | return; | ||
277 | node = of_find_node_by_path(path); | ||
278 | base = of_iomap(node, 0); | ||
279 | if (WARN_ON(!base)) | ||
280 | return; | ||
281 | irq = irq_of_parse_and_map(node, 0); | ||
282 | writel(0, base + TIMER_CTRL); | ||
283 | sp804_clockevents_init(base, irq, node->name); | ||
284 | } | ||
285 | |||
286 | static const struct of_device_id fpga_irq_of_match[] __initconst = { | 253 | static const struct of_device_id fpga_irq_of_match[] __initconst = { |
287 | { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, }, | 254 | { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, }, |
288 | { /* Sentinel */ } | 255 | { /* Sentinel */ } |
@@ -386,7 +353,6 @@ DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)") | |||
386 | .init_early = intcp_init_early, | 353 | .init_early = intcp_init_early, |
387 | .init_irq = intcp_init_irq_of, | 354 | .init_irq = intcp_init_irq_of, |
388 | .handle_irq = fpga_handle_irq, | 355 | .handle_irq = fpga_handle_irq, |
389 | .init_time = cp_of_timer_init, | ||
390 | .init_machine = intcp_init_of, | 356 | .init_machine = intcp_init_of, |
391 | .restart = integrator_restart, | 357 | .restart = integrator_restart, |
392 | .dt_compat = intcp_dt_board_compat, | 358 | .dt_compat = intcp_dt_board_compat, |