]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-realview/core.c
Merge branch 'x86/gart' into x86/core
[linux-2.6-omap-h63xx.git] / arch / arm / mach-realview / core.c
index 6c68deed84dc1e5eae9d6670c7e5a707a6652b6c..131990d196f5cc2c7fc70da2f840ed4b26ef28eb 100644 (file)
@@ -39,7 +39,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/irq.h>
-#include <asm/mach/time.h>
 #include <asm/mach/map.h>
 #include <asm/mach/mmc.h>
 
@@ -50,6 +49,9 @@
 
 #define REALVIEW_REFCOUNTER    (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET)
 
+/* used by entry-macro.S */
+void __iomem *gic_cpu_base_addr;
+
 /*
  * This is the RealView sched_clock implementation.  This has
  * a resolution of 41.7ns, and a maximum value of about 179s.
@@ -107,41 +109,20 @@ static struct flash_platform_data realview_flash_data = {
        .set_vpp                = realview_flash_set_vpp,
 };
 
-static struct resource realview_flash_resource = {
-       .start                  = REALVIEW_FLASH_BASE,
-       .end                    = REALVIEW_FLASH_BASE + REALVIEW_FLASH_SIZE,
-       .flags                  = IORESOURCE_MEM,
-};
-
 struct platform_device realview_flash_device = {
        .name                   = "armflash",
        .id                     = 0,
        .dev                    = {
                .platform_data  = &realview_flash_data,
        },
-       .num_resources          = 1,
-       .resource               = &realview_flash_resource,
-};
-
-static struct resource realview_smc91x_resources[] = {
-       [0] = {
-               .start          = REALVIEW_ETH_BASE,
-               .end            = REALVIEW_ETH_BASE + SZ_64K - 1,
-               .flags          = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start          = IRQ_ETH,
-               .end            = IRQ_ETH,
-               .flags          = IORESOURCE_IRQ,
-       },
 };
 
-struct platform_device realview_smc91x_device = {
-       .name           = "smc91x",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(realview_smc91x_resources),
-       .resource       = realview_smc91x_resources,
-};
+int realview_flash_register(struct resource *res, u32 num)
+{
+       realview_flash_device.resource = res;
+       realview_flash_device.num_resources = num;
+       return platform_device_register(&realview_flash_device);
+}
 
 static struct resource realview_i2c_resource = {
        .start          = REALVIEW_I2C_BASE,
@@ -463,10 +444,10 @@ void realview_leds_event(led_event_t ledevt)
 /*
  * Where is the timer (VA)?
  */
-#define TIMER0_VA_BASE          __io_address(REALVIEW_TIMER0_1_BASE)
-#define TIMER1_VA_BASE         (__io_address(REALVIEW_TIMER0_1_BASE) + 0x20)
-#define TIMER2_VA_BASE          __io_address(REALVIEW_TIMER2_3_BASE)
-#define TIMER3_VA_BASE         (__io_address(REALVIEW_TIMER2_3_BASE) + 0x20)
+void __iomem *timer0_va_base;
+void __iomem *timer1_va_base;
+void __iomem *timer2_va_base;
+void __iomem *timer3_va_base;
 
 /*
  * How long is the timer interval?
@@ -493,7 +474,7 @@ static void timer_set_mode(enum clock_event_mode mode,
 
        switch(mode) {
        case CLOCK_EVT_MODE_PERIODIC:
-               writel(TIMER_RELOAD, TIMER0_VA_BASE + TIMER_LOAD);
+               writel(TIMER_RELOAD, timer0_va_base + TIMER_LOAD);
 
                ctrl = TIMER_CTRL_PERIODIC;
                ctrl |= TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_ENABLE;
@@ -509,16 +490,16 @@ static void timer_set_mode(enum clock_event_mode mode,
                ctrl = 0;
        }
 
-       writel(ctrl, TIMER0_VA_BASE + TIMER_CTRL);
+       writel(ctrl, timer0_va_base + TIMER_CTRL);
 }
 
 static int timer_set_next_event(unsigned long evt,
                                struct clock_event_device *unused)
 {
-       unsigned long ctrl = readl(TIMER0_VA_BASE + TIMER_CTRL);
+       unsigned long ctrl = readl(timer0_va_base + TIMER_CTRL);
 
-       writel(evt, TIMER0_VA_BASE + TIMER_LOAD);
-       writel(ctrl | TIMER_CTRL_ENABLE, TIMER0_VA_BASE + TIMER_CTRL);
+       writel(evt, timer0_va_base + TIMER_LOAD);
+       writel(ctrl | TIMER_CTRL_ENABLE, timer0_va_base + TIMER_CTRL);
 
        return 0;
 }
@@ -530,12 +511,12 @@ static struct clock_event_device timer0_clockevent =       {
        .set_mode       = timer_set_mode,
        .set_next_event = timer_set_next_event,
        .rating         = 300,
-       .irq            = IRQ_TIMERINT0_1,
        .cpumask        = CPU_MASK_ALL,
 };
 
-static void __init realview_clockevents_init(void)
+static void __init realview_clockevents_init(unsigned int timer_irq)
 {
+       timer0_clockevent.irq = timer_irq;
        timer0_clockevent.mult =
                div_sc(1000000, NSEC_PER_SEC, timer0_clockevent.shift);
        timer0_clockevent.max_delta_ns =
@@ -554,7 +535,7 @@ static irqreturn_t realview_timer_interrupt(int irq, void *dev_id)
        struct clock_event_device *evt = &timer0_clockevent;
 
        /* clear the interrupt */
-       writel(1, TIMER0_VA_BASE + TIMER_INTCLR);
+       writel(1, timer0_va_base + TIMER_INTCLR);
 
        evt->event_handler(evt);
 
@@ -569,7 +550,7 @@ static struct irqaction realview_timer_irq = {
 
 static cycle_t realview_get_cycles(void)
 {
-       return ~readl(TIMER3_VA_BASE + TIMER_VALUE);
+       return ~readl(timer3_va_base + TIMER_VALUE);
 }
 
 static struct clocksource clocksource_realview = {
@@ -584,11 +565,11 @@ static struct clocksource clocksource_realview = {
 static void __init realview_clocksource_init(void)
 {
        /* setup timer 0 as free-running clocksource */
-       writel(0, TIMER3_VA_BASE + TIMER_CTRL);
-       writel(0xffffffff, TIMER3_VA_BASE + TIMER_LOAD);
-       writel(0xffffffff, TIMER3_VA_BASE + TIMER_VALUE);
+       writel(0, timer3_va_base + TIMER_CTRL);
+       writel(0xffffffff, timer3_va_base + TIMER_LOAD);
+       writel(0xffffffff, timer3_va_base + TIMER_VALUE);
        writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
-               TIMER3_VA_BASE + TIMER_CTRL);
+               timer3_va_base + TIMER_CTRL);
 
        clocksource_realview.mult =
                clocksource_khz2mult(1000, clocksource_realview.shift);
@@ -596,12 +577,20 @@ static void __init realview_clocksource_init(void)
 }
 
 /*
- * Set up timer interrupt, and return the current time in seconds.
+ * Set up the clock source and clock events devices
  */
-static void __init realview_timer_init(void)
+void __init realview_timer_init(unsigned int timer_irq)
 {
        u32 val;
 
+#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
+       /*
+        * The dummy clock device has to be registered before the main device
+        * so that the latter will broadcast the clock events
+        */
+       local_timer_setup(smp_processor_id());
+#endif
+
        /* 
         * set clock frequency: 
         *      REALVIEW_REFCLK is 32KHz
@@ -617,20 +606,16 @@ static void __init realview_timer_init(void)
        /*
         * Initialise to a known state (all timers off)
         */
-       writel(0, TIMER0_VA_BASE + TIMER_CTRL);
-       writel(0, TIMER1_VA_BASE + TIMER_CTRL);
-       writel(0, TIMER2_VA_BASE + TIMER_CTRL);
-       writel(0, TIMER3_VA_BASE + TIMER_CTRL);
+       writel(0, timer0_va_base + TIMER_CTRL);
+       writel(0, timer1_va_base + TIMER_CTRL);
+       writel(0, timer2_va_base + TIMER_CTRL);
+       writel(0, timer3_va_base + TIMER_CTRL);
 
        /* 
         * Make irqs happen for the system timer
         */
-       setup_irq(IRQ_TIMERINT0_1, &realview_timer_irq);
+       setup_irq(timer_irq, &realview_timer_irq);
 
        realview_clocksource_init();
-       realview_clockevents_init();
+       realview_clockevents_init(timer_irq);
 }
-
-struct sys_timer realview_timer = {
-       .init           = realview_timer_init,
-};