aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-realview
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-realview')
-rw-r--r--arch/arm/mach-realview/core.c38
-rw-r--r--arch/arm/mach-realview/core.h4
-rw-r--r--arch/arm/mach-realview/realview_eb.c13
3 files changed, 32 insertions, 23 deletions
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index f3cf5712091..131990d196f 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
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 6fcaeae16db..33dbbb41a66 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -55,6 +55,10 @@ extern void __iomem *gic_cpu_base_addr;
55extern void __iomem *twd_base_addr; 55extern void __iomem *twd_base_addr;
56extern unsigned int twd_size; 56extern unsigned int twd_size;
57#endif 57#endif
58extern void __iomem *timer0_va_base;
59extern void __iomem *timer1_va_base;
60extern void __iomem *timer2_va_base;
61extern void __iomem *timer3_va_base;
58 62
59extern void realview_leds_event(led_event_t ledevt); 63extern void realview_leds_event(led_event_t ledevt);
60extern void realview_timer_init(unsigned int timer_irq); 64extern void realview_timer_init(unsigned int timer_irq);
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 860e3ca833e..c5e5f07b5f5 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -66,13 +66,13 @@ static struct map_desc realview_eb_io_desc[] __initdata = {
66 .length = SZ_4K, 66 .length = SZ_4K,
67 .type = MT_DEVICE, 67 .type = MT_DEVICE,
68 }, { 68 }, {
69 .virtual = IO_ADDRESS(REALVIEW_TIMER0_1_BASE), 69 .virtual = IO_ADDRESS(REALVIEW_EB_TIMER0_1_BASE),
70 .pfn = __phys_to_pfn(REALVIEW_TIMER0_1_BASE), 70 .pfn = __phys_to_pfn(REALVIEW_EB_TIMER0_1_BASE),
71 .length = SZ_4K, 71 .length = SZ_4K,
72 .type = MT_DEVICE, 72 .type = MT_DEVICE,
73 }, { 73 }, {
74 .virtual = IO_ADDRESS(REALVIEW_TIMER2_3_BASE), 74 .virtual = IO_ADDRESS(REALVIEW_EB_TIMER2_3_BASE),
75 .pfn = __phys_to_pfn(REALVIEW_TIMER2_3_BASE), 75 .pfn = __phys_to_pfn(REALVIEW_EB_TIMER2_3_BASE),
76 .length = SZ_4K, 76 .length = SZ_4K,
77 .type = MT_DEVICE, 77 .type = MT_DEVICE,
78 }, 78 },
@@ -337,6 +337,11 @@ static void __init realview_eb_timer_init(void)
337{ 337{
338 unsigned int timer_irq; 338 unsigned int timer_irq;
339 339
340 timer0_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE);
341 timer1_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE) + 0x20;
342 timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE);
343 timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20;
344
340 if (core_tile_eb11mp()) { 345 if (core_tile_eb11mp()) {
341#ifdef CONFIG_LOCAL_TIMERS 346#ifdef CONFIG_LOCAL_TIMERS
342 twd_base_addr = __io_address(REALVIEW_EB11MP_TWD_BASE); 347 twd_base_addr = __io_address(REALVIEW_EB11MP_TWD_BASE);