aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2008-02-04 11:43:02 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-02-04 12:52:26 -0500
commit8cc4c5488a28fe6a1f834e99317bb762798600f7 (patch)
treeccd8a04655dbb87500d982c5be6a01831bcef6b7 /arch/arm
parentc4057f5260650f165054bc56e16acc4aa0510d4f (diff)
[ARM] 4820/1: RealView: Select the timer IRQ at run-time
This patch sets the timer IRQ at run-time by moving the sys_timer structure and the timer_init function to the realview_eb.c file. This allows multiple RealView platforms to be compiled in the same kernel image. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-realview/core.c15
-rw-r--r--arch/arm/mach-realview/core.h3
-rw-r--r--arch/arm/mach-realview/realview_eb.c19
3 files changed, 24 insertions, 13 deletions
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 29514ac94f34..98aefc9f4df3 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -39,7 +39,6 @@
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41#include <asm/mach/irq.h> 41#include <asm/mach/irq.h>
42#include <asm/mach/time.h>
43#include <asm/mach/map.h> 42#include <asm/mach/map.h>
44#include <asm/mach/mmc.h> 43#include <asm/mach/mmc.h>
45 44
@@ -513,12 +512,12 @@ static struct clock_event_device timer0_clockevent = {
513 .set_mode = timer_set_mode, 512 .set_mode = timer_set_mode,
514 .set_next_event = timer_set_next_event, 513 .set_next_event = timer_set_next_event,
515 .rating = 300, 514 .rating = 300,
516 .irq = IRQ_TIMERINT0_1,
517 .cpumask = CPU_MASK_ALL, 515 .cpumask = CPU_MASK_ALL,
518}; 516};
519 517
520static void __init realview_clockevents_init(void) 518static void __init realview_clockevents_init(unsigned int timer_irq)
521{ 519{
520 timer0_clockevent.irq = timer_irq;
522 timer0_clockevent.mult = 521 timer0_clockevent.mult =
523 div_sc(1000000, NSEC_PER_SEC, timer0_clockevent.shift); 522 div_sc(1000000, NSEC_PER_SEC, timer0_clockevent.shift);
524 timer0_clockevent.max_delta_ns = 523 timer0_clockevent.max_delta_ns =
@@ -581,7 +580,7 @@ static void __init realview_clocksource_init(void)
581/* 580/*
582 * Set up the clock source and clock events devices 581 * Set up the clock source and clock events devices
583 */ 582 */
584static void __init realview_timer_init(void) 583void __init realview_timer_init(unsigned int timer_irq)
585{ 584{
586 u32 val; 585 u32 val;
587 586
@@ -616,12 +615,8 @@ static void __init realview_timer_init(void)
616 /* 615 /*
617 * Make irqs happen for the system timer 616 * Make irqs happen for the system timer
618 */ 617 */
619 setup_irq(IRQ_TIMERINT0_1, &realview_timer_irq); 618 setup_irq(timer_irq, &realview_timer_irq);
620 619
621 realview_clocksource_init(); 620 realview_clocksource_init();
622 realview_clockevents_init(); 621 realview_clockevents_init(timer_irq);
623} 622}
624
625struct sys_timer realview_timer = {
626 .init = realview_timer_init,
627};
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 1c091372be6c..16c9d45ce2c2 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -27,8 +27,6 @@
27#include <asm/leds.h> 27#include <asm/leds.h>
28#include <asm/io.h> 28#include <asm/io.h>
29 29
30extern struct sys_timer realview_timer;
31
32#define AMBA_DEVICE(name,busid,base,plat) \ 30#define AMBA_DEVICE(name,busid,base,plat) \
33static struct amba_device name##_device = { \ 31static struct amba_device name##_device = { \
34 .dev = { \ 32 .dev = { \
@@ -55,5 +53,6 @@ extern struct clcd_board clcd_plat_data;
55extern void __iomem *gic_cpu_base_addr; 53extern void __iomem *gic_cpu_base_addr;
56 54
57extern void realview_leds_event(led_event_t ledevt); 55extern void realview_leds_event(led_event_t ledevt);
56extern void realview_timer_init(unsigned int timer_irq);
58 57
59#endif 58#endif
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index f36af1335024..20b05f2ed61c 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -36,6 +36,7 @@
36#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/mmc.h> 38#include <asm/mach/mmc.h>
39#include <asm/mach/time.h>
39 40
40#include <asm/arch/board-eb.h> 41#include <asm/arch/board-eb.h>
41#include <asm/arch/irqs.h> 42#include <asm/arch/irqs.h>
@@ -304,6 +305,22 @@ static void realview_eb11mp_fixup(void)
304 realview_eb_smc91x_resources[1].end = IRQ_EB11MP_ETH; 305 realview_eb_smc91x_resources[1].end = IRQ_EB11MP_ETH;
305} 306}
306 307
308static void __init realview_eb_timer_init(void)
309{
310 unsigned int timer_irq;
311
312 if (core_tile_eb11mp())
313 timer_irq = IRQ_EB11MP_TIMER0_1;
314 else
315 timer_irq = IRQ_EB_TIMER0_1;
316
317 realview_timer_init(timer_irq);
318}
319
320static struct sys_timer realview_eb_timer = {
321 .init = realview_eb_timer_init,
322};
323
307static void __init realview_eb_init(void) 324static void __init realview_eb_init(void)
308{ 325{
309 int i; 326 int i;
@@ -339,6 +356,6 @@ MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
339 .boot_params = 0x00000100, 356 .boot_params = 0x00000100,
340 .map_io = realview_eb_map_io, 357 .map_io = realview_eb_map_io,
341 .init_irq = gic_init_irq, 358 .init_irq = gic_init_irq,
342 .timer = &realview_timer, 359 .timer = &realview_eb_timer,
343 .init_machine = realview_eb_init, 360 .init_machine = realview_eb_init,
344MACHINE_END 361MACHINE_END