fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / arm / mach-integrator / integrator_cp.c
index e0a01ee..913f64b 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/list.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/sysdev.h>
+#include <linux/amba/bus.h>
+#include <linux/amba/kmi.h>
+#include <linux/amba/clcd.h>
 
 #include <asm/hardware.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
-#include <asm/hardware/amba.h>
-#include <asm/hardware/amba_kmi.h>
-#include <asm/hardware/amba_clcd.h>
 #include <asm/hardware/icst525.h>
 
 #include <asm/arch/cm.h>
  */
 
 static struct map_desc intcp_io_desc[] __initdata = {
- { IO_ADDRESS(INTEGRATOR_HDR_BASE),   INTEGRATOR_HDR_BASE,   SZ_4K,  MT_DEVICE },
- { IO_ADDRESS(INTEGRATOR_SC_BASE),    INTEGRATOR_SC_BASE,    SZ_4K,  MT_DEVICE },
- { IO_ADDRESS(INTEGRATOR_EBI_BASE),   INTEGRATOR_EBI_BASE,   SZ_4K,  MT_DEVICE },
- { IO_ADDRESS(INTEGRATOR_CT_BASE),    INTEGRATOR_CT_BASE,    SZ_4K,  MT_DEVICE },
- { IO_ADDRESS(INTEGRATOR_IC_BASE),    INTEGRATOR_IC_BASE,    SZ_4K,  MT_DEVICE },
- { IO_ADDRESS(INTEGRATOR_UART0_BASE), INTEGRATOR_UART0_BASE, SZ_4K,  MT_DEVICE },
- { IO_ADDRESS(INTEGRATOR_UART1_BASE), INTEGRATOR_UART1_BASE, SZ_4K,  MT_DEVICE },
- { IO_ADDRESS(INTEGRATOR_DBG_BASE),   INTEGRATOR_DBG_BASE,   SZ_4K,  MT_DEVICE },
- { IO_ADDRESS(INTEGRATOR_GPIO_BASE),  INTEGRATOR_GPIO_BASE,  SZ_4K,  MT_DEVICE },
- { 0xfca00000, 0xca000000, SZ_4K, MT_DEVICE },
- { 0xfcb00000, 0xcb000000, SZ_4K, MT_DEVICE },
+       {
+               .virtual        = IO_ADDRESS(INTEGRATOR_HDR_BASE),
+               .pfn            = __phys_to_pfn(INTEGRATOR_HDR_BASE),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = IO_ADDRESS(INTEGRATOR_SC_BASE),
+               .pfn            = __phys_to_pfn(INTEGRATOR_SC_BASE),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = IO_ADDRESS(INTEGRATOR_EBI_BASE),
+               .pfn            = __phys_to_pfn(INTEGRATOR_EBI_BASE),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = IO_ADDRESS(INTEGRATOR_CT_BASE),
+               .pfn            = __phys_to_pfn(INTEGRATOR_CT_BASE),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = IO_ADDRESS(INTEGRATOR_IC_BASE),
+               .pfn            = __phys_to_pfn(INTEGRATOR_IC_BASE),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = IO_ADDRESS(INTEGRATOR_UART0_BASE),
+               .pfn            = __phys_to_pfn(INTEGRATOR_UART0_BASE),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = IO_ADDRESS(INTEGRATOR_UART1_BASE),
+               .pfn            = __phys_to_pfn(INTEGRATOR_UART1_BASE),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = IO_ADDRESS(INTEGRATOR_DBG_BASE),
+               .pfn            = __phys_to_pfn(INTEGRATOR_DBG_BASE),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = IO_ADDRESS(INTEGRATOR_GPIO_BASE),
+               .pfn            = __phys_to_pfn(INTEGRATOR_GPIO_BASE),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = 0xfca00000,
+               .pfn            = __phys_to_pfn(0xca000000),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = 0xfcb00000,
+               .pfn            = __phys_to_pfn(0xcb000000),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE
+       }
 };
 
 static void __init intcp_map_io(void)
@@ -111,7 +156,8 @@ static void cic_unmask_irq(unsigned int irq)
        cic_writel(1 << irq, INTCP_VA_CIC_BASE + IRQ_ENABLE_SET);
 }
 
-static struct irqchip cic_chip = {
+static struct irq_chip cic_chip = {
+       .name   = "CIC",
        .ack    = cic_mask_irq,
        .mask   = cic_mask_irq,
        .unmask = cic_unmask_irq,
@@ -129,7 +175,8 @@ static void pic_unmask_irq(unsigned int irq)
        pic_writel(1 << irq, INTCP_VA_PIC_BASE + IRQ_ENABLE_SET);
 }
 
-static struct irqchip pic_chip = {
+static struct irq_chip pic_chip = {
+       .name   = "PIC",
        .ack    = pic_mask_irq,
        .mask   = pic_mask_irq,
        .unmask = pic_unmask_irq,
@@ -147,19 +194,20 @@ static void sic_unmask_irq(unsigned int irq)
        sic_writel(1 << irq, INTCP_VA_SIC_BASE + IRQ_ENABLE_SET);
 }
 
-static struct irqchip sic_chip = {
+static struct irq_chip sic_chip = {
+       .name   = "SIC",
        .ack    = sic_mask_irq,
        .mask   = sic_mask_irq,
        .unmask = sic_unmask_irq,
 };
 
 static void
-sic_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
+sic_handle_irq(unsigned int irq, struct irq_desc *desc)
 {
        unsigned long status = sic_readl(INTCP_VA_SIC_BASE + IRQ_STATUS);
 
        if (status == 0) {
-               do_bad_IRQ(irq, desc, regs);
+               do_bad_IRQ(irq, desc);
                return;
        }
 
@@ -170,7 +218,7 @@ sic_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
                irq += IRQ_SIC_START;
 
                desc = irq_desc + irq;
-               desc->handle(irq, desc, regs);
+               desc_handle_irq(irq, desc);
        } while (status);
 }
 
@@ -187,12 +235,10 @@ static void __init intcp_init_irq(void)
        for (i = IRQ_PIC_START; i <= IRQ_PIC_END; i++) {
                if (i == 11)
                        i = 22;
-               if (i == IRQ_CP_CPPLDINT)
-                       i++;
                if (i == 29)
                        break;
                set_irq_chip(i, &pic_chip);
-               set_irq_handler(i, do_level_IRQ);
+               set_irq_handler(i, handle_level_irq);
                set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
        }
 
@@ -201,7 +247,7 @@ static void __init intcp_init_irq(void)
 
        for (i = IRQ_CIC_START; i <= IRQ_CIC_END; i++) {
                set_irq_chip(i, &cic_chip);
-               set_irq_handler(i, do_level_IRQ);
+               set_irq_handler(i, handle_level_irq);
                set_irq_flags(i, IRQF_VALID);
        }
 
@@ -210,12 +256,11 @@ static void __init intcp_init_irq(void)
 
        for (i = IRQ_SIC_START; i <= IRQ_SIC_END; i++) {
                set_irq_chip(i, &sic_chip);
-               set_irq_handler(i, do_level_IRQ);
+               set_irq_handler(i, handle_level_irq);
                set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
        }
 
-       set_irq_handler(IRQ_CP_CPPLDINT, sic_handle_irq);
-       pic_unmask_irq(IRQ_CP_CPPLDINT);
+       set_irq_chained_handler(IRQ_CP_CPPLDINT, sic_handle_irq);
 }
 
 /*
@@ -424,7 +469,9 @@ static void cp_clcd_enable(struct clcd_fb *fb)
        if (fb->fb.var.bits_per_pixel <= 8)
                val = CM_CTRL_LCDMUXSEL_VGA_8421BPP;
        else if (fb->fb.var.bits_per_pixel <= 16)
-               val = CM_CTRL_LCDMUXSEL_VGA_16BPP;
+               val = CM_CTRL_LCDMUXSEL_VGA_16BPP
+                       | CM_CTRL_LCDEN0 | CM_CTRL_LCDEN1
+                       | CM_CTRL_STATIC1 | CM_CTRL_STATIC2;
        else
                val = 0; /* no idea for this, don't trust the docs */
 
@@ -532,11 +579,12 @@ static struct sys_timer cp_timer = {
 };
 
 MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
-       MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd")
-       BOOT_MEM(0x00000000, 0x16000000, 0xf1600000)
-       BOOT_PARAMS(0x00000100)
-       MAPIO(intcp_map_io)
-       INITIRQ(intcp_init_irq)
+       /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
+       .phys_io        = 0x16000000,
+       .io_pg_offst    = ((0xf1600000) >> 18) & 0xfffc,
+       .boot_params    = 0x00000100,
+       .map_io         = intcp_map_io,
+       .init_irq       = intcp_init_irq,
        .timer          = &cp_timer,
-       INIT_MACHINE(intcp_init)
+       .init_machine   = intcp_init,
 MACHINE_END