diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2011-08-04 06:57:04 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2012-03-13 09:29:58 -0400 |
commit | 7c380f273cf09b202e4bc9cbe137aef1870b8a20 (patch) | |
tree | 1731276247100c90a24462f08bf1c722e1573c39 /arch/arm | |
parent | a45c983f85328be9d0540a6b8250609dbf16872c (diff) |
ARM: plat-versatile: convert to twd_local_timer_register() interface
Add support for the new smp_twd runtime registration interface
to the RealView/VE platforms, and remove the old compile-time support.
Tested on EB11MP.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-realview/realview_eb.c | 27 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_pb11mp.c | 21 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_pbx.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/ct-ca9x4.c | 17 | ||||
-rw-r--r-- | arch/arm/plat-versatile/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-versatile/localtimer.c | 53 |
6 files changed, 68 insertions, 71 deletions
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index 9578145f2df0..a2e959037954 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
37 | #include <asm/hardware/gic.h> | 37 | #include <asm/hardware/gic.h> |
38 | #include <asm/hardware/cache-l2x0.h> | 38 | #include <asm/hardware/cache-l2x0.h> |
39 | #include <asm/localtimer.h> | 39 | #include <asm/smp_twd.h> |
40 | 40 | ||
41 | #include <asm/mach/arch.h> | 41 | #include <asm/mach/arch.h> |
42 | #include <asm/mach/map.h> | 42 | #include <asm/mach/map.h> |
@@ -383,6 +383,23 @@ static void realview_eb11mp_fixup(void) | |||
383 | realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB; | 383 | realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB; |
384 | } | 384 | } |
385 | 385 | ||
386 | #ifdef CONFIG_HAVE_ARM_TWD | ||
387 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, | ||
388 | REALVIEW_EB11MP_TWD_BASE, | ||
389 | IRQ_LOCALTIMER); | ||
390 | |||
391 | static void __init realview_eb_twd_init(void) | ||
392 | { | ||
393 | if (core_tile_eb11mp() || core_tile_a9mp()) { | ||
394 | int err = twd_local_timer_register(&twd_local_timer); | ||
395 | if (err) | ||
396 | pr_err("twd_local_timer_register failed %d\n", err); | ||
397 | } | ||
398 | } | ||
399 | #else | ||
400 | #define realview_eb_twd_init() do { } while(0) | ||
401 | #endif | ||
402 | |||
386 | static void __init realview_eb_timer_init(void) | 403 | static void __init realview_eb_timer_init(void) |
387 | { | 404 | { |
388 | unsigned int timer_irq; | 405 | unsigned int timer_irq; |
@@ -392,15 +409,13 @@ static void __init realview_eb_timer_init(void) | |||
392 | timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE); | 409 | timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE); |
393 | timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20; | 410 | timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20; |
394 | 411 | ||
395 | if (core_tile_eb11mp() || core_tile_a9mp()) { | 412 | if (core_tile_eb11mp() || core_tile_a9mp()) |
396 | #ifdef CONFIG_LOCAL_TIMERS | ||
397 | twd_base = __io_address(REALVIEW_EB11MP_TWD_BASE); | ||
398 | #endif | ||
399 | timer_irq = IRQ_EB11MP_TIMER0_1; | 413 | timer_irq = IRQ_EB11MP_TIMER0_1; |
400 | } else | 414 | else |
401 | timer_irq = IRQ_EB_TIMER0_1; | 415 | timer_irq = IRQ_EB_TIMER0_1; |
402 | 416 | ||
403 | realview_timer_init(timer_irq); | 417 | realview_timer_init(timer_irq); |
418 | realview_eb_twd_init(); | ||
404 | } | 419 | } |
405 | 420 | ||
406 | static struct sys_timer realview_eb_timer = { | 421 | static struct sys_timer realview_eb_timer = { |
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c index 2147335f66f5..3bea5bd0221d 100644 --- a/arch/arm/mach-realview/realview_pb11mp.c +++ b/arch/arm/mach-realview/realview_pb11mp.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
37 | #include <asm/hardware/gic.h> | 37 | #include <asm/hardware/gic.h> |
38 | #include <asm/hardware/cache-l2x0.h> | 38 | #include <asm/hardware/cache-l2x0.h> |
39 | #include <asm/localtimer.h> | 39 | #include <asm/smp_twd.h> |
40 | 40 | ||
41 | #include <asm/mach/arch.h> | 41 | #include <asm/mach/arch.h> |
42 | #include <asm/mach/flash.h> | 42 | #include <asm/mach/flash.h> |
@@ -290,6 +290,21 @@ static void __init gic_init_irq(void) | |||
290 | gic_cascade_irq(1, IRQ_TC11MP_PB_IRQ1); | 290 | gic_cascade_irq(1, IRQ_TC11MP_PB_IRQ1); |
291 | } | 291 | } |
292 | 292 | ||
293 | #ifdef CONFIG_HAVE_ARM_TWD | ||
294 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, | ||
295 | REALVIEW_TC11MP_TWD_BASE, | ||
296 | IRQ_LOCALTIMER); | ||
297 | |||
298 | static void __init realview_pb11mp_twd_init(void) | ||
299 | { | ||
300 | int err = twd_local_timer_register(&twd_local_timer); | ||
301 | if (err) | ||
302 | pr_err("twd_local_timer_register failed %d\n", err); | ||
303 | } | ||
304 | #else | ||
305 | #define realview_pb11mp_twd_init() do {} while(0) | ||
306 | #endif | ||
307 | |||
293 | static void __init realview_pb11mp_timer_init(void) | 308 | static void __init realview_pb11mp_timer_init(void) |
294 | { | 309 | { |
295 | timer0_va_base = __io_address(REALVIEW_PB11MP_TIMER0_1_BASE); | 310 | timer0_va_base = __io_address(REALVIEW_PB11MP_TIMER0_1_BASE); |
@@ -297,10 +312,8 @@ static void __init realview_pb11mp_timer_init(void) | |||
297 | timer2_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE); | 312 | timer2_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE); |
298 | timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20; | 313 | timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20; |
299 | 314 | ||
300 | #ifdef CONFIG_LOCAL_TIMERS | ||
301 | twd_base = __io_address(REALVIEW_TC11MP_TWD_BASE); | ||
302 | #endif | ||
303 | realview_timer_init(IRQ_TC11MP_TIMER0_1); | 315 | realview_timer_init(IRQ_TC11MP_TIMER0_1); |
316 | realview_pb11mp_twd_init(); | ||
304 | } | 317 | } |
305 | 318 | ||
306 | static struct sys_timer realview_pb11mp_timer = { | 319 | static struct sys_timer realview_pb11mp_timer = { |
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c index ac715645b860..6ddcc6147bfa 100644 --- a/arch/arm/mach-realview/realview_pbx.c +++ b/arch/arm/mach-realview/realview_pbx.c | |||
@@ -298,6 +298,21 @@ static void __init gic_init_irq(void) | |||
298 | } | 298 | } |
299 | } | 299 | } |
300 | 300 | ||
301 | #ifdef CONFIG_HAVE_ARM_TWD | ||
302 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, | ||
303 | REALVIEW_PBX_TILE_TWD_BASE, | ||
304 | IRQ_LOCALTIMER); | ||
305 | |||
306 | static void __init realview_pbx_twd_init(void) | ||
307 | { | ||
308 | int err = twd_local_timer_register(&twd_local_timer); | ||
309 | if (err) | ||
310 | pr_err("twd_local_timer_register failed %d\n", err); | ||
311 | } | ||
312 | #else | ||
313 | #define realview_pbx_twd_init() do { } while(0) | ||
314 | #endif | ||
315 | |||
301 | static void __init realview_pbx_timer_init(void) | 316 | static void __init realview_pbx_timer_init(void) |
302 | { | 317 | { |
303 | timer0_va_base = __io_address(REALVIEW_PBX_TIMER0_1_BASE); | 318 | timer0_va_base = __io_address(REALVIEW_PBX_TIMER0_1_BASE); |
@@ -305,11 +320,8 @@ static void __init realview_pbx_timer_init(void) | |||
305 | timer2_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE); | 320 | timer2_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE); |
306 | timer3_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE) + 0x20; | 321 | timer3_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE) + 0x20; |
307 | 322 | ||
308 | #ifdef CONFIG_LOCAL_TIMERS | ||
309 | if (core_tile_pbx11mp() || core_tile_pbxa9mp()) | ||
310 | twd_base = __io_address(REALVIEW_PBX_TILE_TWD_BASE); | ||
311 | #endif | ||
312 | realview_timer_init(IRQ_PBX_TIMER0_1); | 323 | realview_timer_init(IRQ_PBX_TIMER0_1); |
324 | realview_pbx_twd_init(); | ||
313 | } | 325 | } |
314 | 326 | ||
315 | static struct sys_timer realview_pbx_timer = { | 327 | static struct sys_timer realview_pbx_timer = { |
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c index a2f7d5d3ca40..e5abe85fefa0 100644 --- a/arch/arm/mach-vexpress/ct-ca9x4.c +++ b/arch/arm/mach-vexpress/ct-ca9x4.c | |||
@@ -42,15 +42,26 @@ static struct map_desc ct_ca9x4_io_desc[] __initdata = { | |||
42 | static void __init ct_ca9x4_map_io(void) | 42 | static void __init ct_ca9x4_map_io(void) |
43 | { | 43 | { |
44 | iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc)); | 44 | iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc)); |
45 | #ifdef CONFIG_LOCAL_TIMERS | ||
46 | twd_base = ioremap(A9_MPCORE_TWD, SZ_32); | ||
47 | #endif | ||
48 | } | 45 | } |
49 | 46 | ||
47 | #ifdef CONFIG_HAVE_ARM_TWD | ||
48 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, A9_MPCORE_TWD, IRQ_LOCALTIMER); | ||
49 | |||
50 | static void __init ca9x4_twd_init(void) | ||
51 | { | ||
52 | int err = twd_local_timer_register(&twd_local_timer); | ||
53 | if (err) | ||
54 | pr_err("twd_local_timer_register failed %d\n", err); | ||
55 | } | ||
56 | #else | ||
57 | #define ca9x4_twd_init() do {} while(0) | ||
58 | #endif | ||
59 | |||
50 | static void __init ct_ca9x4_init_irq(void) | 60 | static void __init ct_ca9x4_init_irq(void) |
51 | { | 61 | { |
52 | gic_init(0, 29, ioremap(A9_MPCORE_GIC_DIST, SZ_4K), | 62 | gic_init(0, 29, ioremap(A9_MPCORE_GIC_DIST, SZ_4K), |
53 | ioremap(A9_MPCORE_GIC_CPU, SZ_256)); | 63 | ioremap(A9_MPCORE_GIC_CPU, SZ_256)); |
64 | ca9x4_twd_init(); | ||
54 | } | 65 | } |
55 | 66 | ||
56 | static void ct_ca9x4_clcd_enable(struct clcd_fb *fb) | 67 | static void ct_ca9x4_clcd_enable(struct clcd_fb *fb) |
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile index 69714db47c33..a5cb1945bdcc 100644 --- a/arch/arm/plat-versatile/Makefile +++ b/arch/arm/plat-versatile/Makefile | |||
@@ -1,5 +1,4 @@ | |||
1 | obj-y := clock.o | 1 | obj-y := clock.o |
2 | obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o | ||
3 | obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o | 2 | obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o |
4 | obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o | 3 | obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o |
5 | obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o | 4 | obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o |
diff --git a/arch/arm/plat-versatile/localtimer.c b/arch/arm/plat-versatile/localtimer.c deleted file mode 100644 index e15668793159..000000000000 --- a/arch/arm/plat-versatile/localtimer.c +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-versatile/localtimer.c | ||
3 | * | ||
4 | * Copyright (C) 2002 ARM Ltd. | ||
5 | * All Rights Reserved | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/smp.h> | ||
13 | #include <linux/clockchips.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | |||
17 | #include <asm/smp_twd.h> | ||
18 | #include <asm/localtimer.h> | ||
19 | #include <mach/irqs.h> | ||
20 | |||
21 | const static struct of_device_id twd_of_match[] __initconst = { | ||
22 | { .compatible = "arm,cortex-a9-twd-timer", }, | ||
23 | { .compatible = "arm,cortex-a5-twd-timer", }, | ||
24 | { .compatible = "arm,arm11mp-twd-timer", }, | ||
25 | { }, | ||
26 | }; | ||
27 | |||
28 | /* | ||
29 | * Setup the local clock events for a CPU. | ||
30 | */ | ||
31 | int __cpuinit local_timer_setup(struct clock_event_device *evt) | ||
32 | { | ||
33 | #if defined(CONFIG_OF) | ||
34 | static int dt_node_probed; | ||
35 | |||
36 | /* Look for TWD node only once */ | ||
37 | if (!dt_node_probed) { | ||
38 | struct device_node *node = of_find_matching_node(NULL, | ||
39 | twd_of_match); | ||
40 | |||
41 | if (node) | ||
42 | twd_base = of_iomap(node, 0); | ||
43 | |||
44 | dt_node_probed = 1; | ||
45 | } | ||
46 | #endif | ||
47 | if (!twd_base) | ||
48 | return -ENXIO; | ||
49 | |||
50 | evt->irq = IRQ_LOCALTIMER; | ||
51 | twd_timer_setup(evt); | ||
52 | return 0; | ||
53 | } | ||