]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - arch/arm/mach-integrator/core.c
ARM: Fix Versatile&Integrator includes to behave in the same way as Realview
[linux-2.6.git] / arch / arm / mach-integrator / core.c
index 797c7fddaa0d55a17c6159b748baa6400a985ba5..096f899625f88a258e83f253025aa0b9c4e61292 100644 (file)
 #include <linux/device.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
-
-#include <asm/hardware.h>
+#include <linux/termios.h>
+#include <linux/amba/bus.h>
+#include <linux/amba/serial.h>
+#include <linux/io.h>
+
+#include <asm/clkdev.h>
+#include <mach/clkdev.h>
+#include <mach/hardware.h>
+#include <mach/platform.h>
 #include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/hardware/amba.h>
 #include <asm/hardware/arm_timer.h>
-#include <asm/arch/cm.h>
+#include <mach/cm.h>
 #include <asm/system.h>
 #include <asm/leds.h>
 #include <asm/mach/time.h>
 
 #include "common.h"
 
+static struct amba_pl010_data integrator_uart_data;
+
 static struct amba_device rtc_device = {
        .dev            = {
-               .bus_id = "mb:15",
+               .init_name = "mb:15",
        },
        .res            = {
                .start  = INTEGRATOR_RTC_BASE,
@@ -43,7 +51,8 @@ static struct amba_device rtc_device = {
 
 static struct amba_device uart0_device = {
        .dev            = {
-               .bus_id = "mb:16",
+               .init_name = "mb:16",
+               .platform_data = &integrator_uart_data,
        },
        .res            = {
                .start  = INTEGRATOR_UART0_BASE,
@@ -56,7 +65,8 @@ static struct amba_device uart0_device = {
 
 static struct amba_device uart1_device = {
        .dev            = {
-               .bus_id = "mb:17",
+               .init_name = "mb:17",
+               .platform_data = &integrator_uart_data,
        },
        .res            = {
                .start  = INTEGRATOR_UART1_BASE,
@@ -69,7 +79,7 @@ static struct amba_device uart1_device = {
 
 static struct amba_device kmi0_device = {
        .dev            = {
-               .bus_id = "mb:18",
+               .init_name = "mb:18",
        },
        .res            = {
                .start  = KMI0_BASE,
@@ -82,7 +92,7 @@ static struct amba_device kmi0_device = {
 
 static struct amba_device kmi1_device = {
        .dev            = {
-               .bus_id = "mb:19",
+               .init_name = "mb:19",
        },
        .res            = {
                .start  = KMI1_BASE,
@@ -101,10 +111,42 @@ static struct amba_device *amba_devs[] __initdata = {
        &kmi1_device,
 };
 
+/*
+ * These are fixed clocks.
+ */
+static struct clk clk24mhz = {
+       .rate   = 24000000,
+};
+
+static struct clk uartclk = {
+       .rate   = 14745600,
+};
+
+static struct clk_lookup lookups[] = {
+       {       /* UART0 */
+               .dev_id         = "mb:16",
+               .clk            = &uartclk,
+       }, {    /* UART1 */
+               .dev_id         = "mb:17",
+               .clk            = &uartclk,
+       }, {    /* KMI0 */
+               .dev_id         = "mb:18",
+               .clk            = &clk24mhz,
+       }, {    /* KMI1 */
+               .dev_id         = "mb:19",
+               .clk            = &clk24mhz,
+       }, {    /* MMCI - IntegratorCP */
+               .dev_id         = "mb:1c",
+               .clk            = &uartclk,
+       }
+};
+
 static int __init integrator_init(void)
 {
        int i;
 
+       clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
        for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
                struct amba_device *d = amba_devs[i];
                amba_device_register(d, &iomem_resource);
@@ -115,6 +157,46 @@ static int __init integrator_init(void)
 
 arch_initcall(integrator_init);
 
+/*
+ * On the Integrator platform, the port RTS and DTR are provided by
+ * bits in the following SC_CTRLS register bits:
+ *        RTS  DTR
+ *  UART0  7    6
+ *  UART1  5    4
+ */
+#define SC_CTRLC       (IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLC_OFFSET)
+#define SC_CTRLS       (IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLS_OFFSET)
+
+static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
+{
+       unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
+
+       if (dev == &uart0_device) {
+               rts_mask = 1 << 4;
+               dtr_mask = 1 << 5;
+       } else {
+               rts_mask = 1 << 6;
+               dtr_mask = 1 << 7;
+       }
+
+       if (mctrl & TIOCM_RTS)
+               ctrlc |= rts_mask;
+       else
+               ctrls |= rts_mask;
+
+       if (mctrl & TIOCM_DTR)
+               ctrlc |= dtr_mask;
+       else
+               ctrls |= dtr_mask;
+
+       __raw_writel(ctrls, SC_CTRLS);
+       __raw_writel(ctrlc, SC_CTRLC);
+}
+
+static struct amba_pl010_data integrator_uart_data = {
+       .set_mctrl = integrator_uart_set_mctrl,
+};
+
 #define CM_CTRL        IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET
 
 static DEFINE_SPINLOCK(cm_lock);
@@ -201,42 +283,21 @@ unsigned long integrator_gettimeoffset(void)
  * IRQ handler for the timer
  */
 static irqreturn_t
-integrator_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+integrator_timer_interrupt(int irq, void *dev_id)
 {
-       write_seqlock(&xtime_lock);
-
        /*
         * clear the interrupt
         */
        writel(1, TIMER1_VA_BASE + TIMER_INTCLR);
 
-       /*
-        * the clock tick routines are only processed on the
-        * primary CPU
-        */
-       if (hard_smp_processor_id() == 0) {
-               nmi_tick();
-               timer_tick(regs);
-#ifdef CONFIG_SMP
-               smp_send_timer();
-#endif
-       }
-
-#ifdef CONFIG_SMP
-       /*
-        * this is the ARM equivalent of the APIC timer interrupt
-        */
-       update_process_times(user_mode(regs));
-#endif /* CONFIG_SMP */
-
-       write_sequnlock(&xtime_lock);
+       timer_tick();
 
        return IRQ_HANDLED;
 }
 
 static struct irqaction integrator_timer_irq = {
        .name           = "Integrator Timer Tick",
-       .flags          = SA_INTERRUPT | SA_TIMER,
+       .flags          = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
        .handler        = integrator_timer_interrupt,
 };