Merge to kernel-2.6.20-1.2949.fc6.vs2.2.0.1
[linux-2.6.git] / arch / arm / mach-h720x / cpu-h7202.c
index 4b6968e..703870f 100644 (file)
@@ -5,7 +5,7 @@
  *               2003 Robert Schwebel <r.schwebel@pengutronix.de>
  *               2004 Sascha Hauer    <s.hauer@pengutronix.de>
  *
- * processor specific stuff for the Hynix h7201
+ * processor specific stuff for the Hynix h7202
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -48,7 +48,8 @@ static struct platform_device h7202ps2_device = {
 
 static struct plat_serial8250_port serial_platform_data[] = {
        {
-               .membase        = SERIAL0_BASE,
+               .membase        = (void*)SERIAL0_VIRT,
+               .mapbase        = SERIAL0_BASE,
                .irq            = IRQ_UART0,
                .uartclk        = 2*1843200,
                .regshift       = 2,
@@ -56,15 +57,18 @@ static struct plat_serial8250_port serial_platform_data[] = {
                .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
        },
        {
-               .membase        = SERIAL1_BASE,
+               .membase        = (void*)SERIAL1_VIRT,
+               .mapbase        = SERIAL1_BASE,
                .irq            = IRQ_UART1,
                .uartclk        = 2*1843200,
                .regshift       = 2,
                .iotype         = UPIO_MEM,
                .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
        },
+#ifdef CONFIG_H7202_SERIAL23
        {
-               .membase        = SERIAL2_BASE,
+               .membase        = (void*)SERIAL2_VIRT,
+               .mapbase        = SERIAL2_BASE,
                .irq            = IRQ_UART2,
                .uartclk        = 2*1843200,
                .regshift       = 2,
@@ -72,19 +76,21 @@ static struct plat_serial8250_port serial_platform_data[] = {
                .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
        },
        {
-               .membase        = SERIAL3_BASE,
+               .membase        = (void*)SERIAL3_VIRT,
+               .mapbase        = SERIAL3_BASE,
                .irq            = IRQ_UART3,
                .uartclk        = 2*1843200,
                .regshift       = 2,
                .iotype         = UPIO_MEM,
                .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
        },
+#endif
        { },
 };
 
 static struct platform_device serial_device = {
        .name                   = "serial8250",
-       .id                     = 0,
+       .id                     = PLAT8250_DEV_PLATFORM,
        .dev                    = {
                .platform_data  = serial_platform_data,
        },
@@ -100,8 +106,7 @@ static struct platform_device *devices[] __initdata = {
  * we have to handle all timer interrupts in one place.
  */
 static void
-h7202_timerx_demux_handler(unsigned int irq_unused, struct irqdesc *desc,
-                       struct pt_regs *regs)
+h7202_timerx_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
 {
        unsigned int mask, irq;
 
@@ -109,7 +114,7 @@ h7202_timerx_demux_handler(unsigned int irq_unused, struct irqdesc *desc,
 
        if ( mask & TSTAT_T0INT ) {
                write_seqlock(&xtime_lock);
-               timer_tick(regs);
+               timer_tick();
                write_sequnlock(&xtime_lock);
                if( mask == TSTAT_T0INT )
                        return;
@@ -120,7 +125,7 @@ h7202_timerx_demux_handler(unsigned int irq_unused, struct irqdesc *desc,
        desc = irq_desc + irq;
        while (mask) {
                if (mask & 1)
-                       desc->handle(irq, desc, regs);
+                       desc_handle_irq(irq, desc);
                irq++;
                desc++;
                mask >>= 1;
@@ -131,9 +136,9 @@ h7202_timerx_demux_handler(unsigned int irq_unused, struct irqdesc *desc,
  * Timer interrupt handler
  */
 static irqreturn_t
-h7202_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+h7202_timer_interrupt(int irq, void *dev_id)
 {
-       h7202_timerx_demux_handler(0, NULL, regs);
+       h7202_timerx_demux_handler(0, NULL);
        return IRQ_HANDLED;
 }
 
@@ -157,7 +162,7 @@ static void inline unmask_timerx_irq (u32 irq)
        CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) |= bit;
 }
 
-static struct irqchip h7202_timerx_chip = {
+static struct irq_chip h7202_timerx_chip = {
        .ack = mask_timerx_irq,
        .mask = mask_timerx_irq,
        .unmask = unmask_timerx_irq,
@@ -165,8 +170,8 @@ static struct irqchip h7202_timerx_chip = {
 
 static struct irqaction h7202_timer_irq = {
        .name           = "h7202 Timer Tick",
-       .flags          = SA_INTERRUPT,
-       .handler        = h7202_timer_interrupt
+       .flags          = IRQF_DISABLED | IRQF_TIMER,
+       .handler        = h7202_timer_interrupt,
 };
 
 /*
@@ -197,7 +202,7 @@ void __init h7202_init_irq (void)
                          irq < IRQ_CHAINED_TIMERX(NR_TIMERX_IRQS); irq++) {
                mask_timerx_irq(irq);
                set_irq_chip(irq, &h7202_timerx_chip);
-               set_irq_handler(irq, do_edge_IRQ);
+               set_irq_handler(irq, handle_edge_irq);
                set_irq_flags(irq, IRQF_VALID );
        }
        set_irq_chained_handler(IRQ_TIMERX, h7202_timerx_demux_handler);
@@ -210,5 +215,13 @@ void __init init_hw_h7202(void)
        /* Enable clocks */
        CPU_REG (PMU_BASE, PMU_PLL_CTRL) |= PLL_2_EN | PLL_1_EN | PLL_3_MUTE;
 
+       CPU_REG (SERIAL0_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
+       CPU_REG (SERIAL1_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
+#ifdef CONFIG_H7202_SERIAL23
+       CPU_REG (SERIAL2_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
+       CPU_REG (SERIAL3_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
+       CPU_IO (GPIO_AMULSEL) = AMULSEL_USIN2 | AMULSEL_USOUT2 |
+                               AMULSEL_USIN3 | AMULSEL_USOUT3;
+#endif
        (void) platform_add_devices(devices, ARRAY_SIZE(devices));
 }