aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-realview/core.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2008-04-18 17:43:11 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2008-04-18 17:43:11 -0400
commit80192735e4b01a2e4d437699f2e9b5b93dfab13c (patch)
tree1096c3278bc60c925f1818c776e4b3e88c20a23c /arch/arm/mach-realview/core.c
parenta44ddfd5bf5354281eebd0f0ae0d6dcf8818fc5c (diff)
RealView: Move the timer definitions into the EB specific files
This patch moves the timer definitions from platform.h into board-eb.h as they are different on PB11MPCore and PB1176. It also adds timerX_va_base variables in core.c which are set by the realview_eb_timer_init function before invoking realview_timer_init. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm/mach-realview/core.c')
-rw-r--r--arch/arm/mach-realview/core.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index f3cf5712091c..131990d196f5 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -444,10 +444,10 @@ void realview_leds_event(led_event_t ledevt)
444/* 444/*
445 * Where is the timer (VA)? 445 * Where is the timer (VA)?
446 */ 446 */
447#define TIMER0_VA_BASE __io_address(REALVIEW_TIMER0_1_BASE) 447void __iomem *timer0_va_base;
448#define TIMER1_VA_BASE (__io_address(REALVIEW_TIMER0_1_BASE) + 0x20) 448void __iomem *timer1_va_base;
449#define TIMER2_VA_BASE __io_address(REALVIEW_TIMER2_3_BASE) 449void __iomem *timer2_va_base;
450#define TIMER3_VA_BASE (__io_address(REALVIEW_TIMER2_3_BASE) + 0x20) 450void __iomem *timer3_va_base;
451 451
452/* 452/*
453 * How long is the timer interval? 453 * How long is the timer interval?
@@ -474,7 +474,7 @@ static void timer_set_mode(enum clock_event_mode mode,
474 474
475 switch(mode) { 475 switch(mode) {
476 case CLOCK_EVT_MODE_PERIODIC: 476 case CLOCK_EVT_MODE_PERIODIC:
477 writel(TIMER_RELOAD, TIMER0_VA_BASE + TIMER_LOAD); 477 writel(TIMER_RELOAD, timer0_va_base + TIMER_LOAD);
478 478
479 ctrl = TIMER_CTRL_PERIODIC; 479 ctrl = TIMER_CTRL_PERIODIC;
480 ctrl |= TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_ENABLE; 480 ctrl |= TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_ENABLE;
@@ -490,16 +490,16 @@ static void timer_set_mode(enum clock_event_mode mode,
490 ctrl = 0; 490 ctrl = 0;
491 } 491 }
492 492
493 writel(ctrl, TIMER0_VA_BASE + TIMER_CTRL); 493 writel(ctrl, timer0_va_base + TIMER_CTRL);
494} 494}
495 495
496static int timer_set_next_event(unsigned long evt, 496static int timer_set_next_event(unsigned long evt,
497 struct clock_event_device *unused) 497 struct clock_event_device *unused)
498{ 498{
499 unsigned long ctrl = readl(TIMER0_VA_BASE + TIMER_CTRL); 499 unsigned long ctrl = readl(timer0_va_base + TIMER_CTRL);
500 500
501 writel(evt, TIMER0_VA_BASE + TIMER_LOAD); 501 writel(evt, timer0_va_base + TIMER_LOAD);
502 writel(ctrl | TIMER_CTRL_ENABLE, TIMER0_VA_BASE + TIMER_CTRL); 502 writel(ctrl | TIMER_CTRL_ENABLE, timer0_va_base + TIMER_CTRL);
503 503
504 return 0; 504 return 0;
505} 505}
@@ -535,7 +535,7 @@ static irqreturn_t realview_timer_interrupt(int irq, void *dev_id)
535 struct clock_event_device *evt = &timer0_clockevent; 535 struct clock_event_device *evt = &timer0_clockevent;
536 536
537 /* clear the interrupt */ 537 /* clear the interrupt */
538 writel(1, TIMER0_VA_BASE + TIMER_INTCLR); 538 writel(1, timer0_va_base + TIMER_INTCLR);
539 539
540 evt->event_handler(evt); 540 evt->event_handler(evt);
541 541
@@ -550,7 +550,7 @@ static struct irqaction realview_timer_irq = {
550 550
551static cycle_t realview_get_cycles(void) 551static cycle_t realview_get_cycles(void)
552{ 552{
553 return ~readl(TIMER3_VA_BASE + TIMER_VALUE); 553 return ~readl(timer3_va_base + TIMER_VALUE);
554} 554}
555 555
556static struct clocksource clocksource_realview = { 556static struct clocksource clocksource_realview = {
@@ -565,11 +565,11 @@ static struct clocksource clocksource_realview = {
565static void __init realview_clocksource_init(void) 565static void __init realview_clocksource_init(void)
566{ 566{
567 /* setup timer 0 as free-running clocksource */ 567 /* setup timer 0 as free-running clocksource */
568 writel(0, TIMER3_VA_BASE + TIMER_CTRL); 568 writel(0, timer3_va_base + TIMER_CTRL);
569 writel(0xffffffff, TIMER3_VA_BASE + TIMER_LOAD); 569 writel(0xffffffff, timer3_va_base + TIMER_LOAD);
570 writel(0xffffffff, TIMER3_VA_BASE + TIMER_VALUE); 570 writel(0xffffffff, timer3_va_base + TIMER_VALUE);
571 writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC, 571 writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
572 TIMER3_VA_BASE + TIMER_CTRL); 572 timer3_va_base + TIMER_CTRL);
573 573
574 clocksource_realview.mult = 574 clocksource_realview.mult =
575 clocksource_khz2mult(1000, clocksource_realview.shift); 575 clocksource_khz2mult(1000, clocksource_realview.shift);
@@ -606,10 +606,10 @@ void __init realview_timer_init(unsigned int timer_irq)
606 /* 606 /*
607 * Initialise to a known state (all timers off) 607 * Initialise to a known state (all timers off)
608 */ 608 */
609 writel(0, TIMER0_VA_BASE + TIMER_CTRL); 609 writel(0, timer0_va_base + TIMER_CTRL);
610 writel(0, TIMER1_VA_BASE + TIMER_CTRL); 610 writel(0, timer1_va_base + TIMER_CTRL);
611 writel(0, TIMER2_VA_BASE + TIMER_CTRL); 611 writel(0, timer2_va_base + TIMER_CTRL);
612 writel(0, TIMER3_VA_BASE + TIMER_CTRL); 612 writel(0, timer3_va_base + TIMER_CTRL);
613 613
614 /* 614 /*
615 * Make irqs happen for the system timer 615 * Make irqs happen for the system timer