fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / arm / mach-integrator / integrator_ap.c
index 1d59766..7228075 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/slab.h>
 #include <linux/string.h>
 #include <linux/sysdev.h>
+#include <linux/amba/bus.h>
+#include <linux/amba/kmi.h>
 
 #include <asm/hardware.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/setup.h>
+#include <asm/param.h>         /* HZ */
 #include <asm/mach-types.h>
-#include <asm/hardware/amba.h>
-#include <asm/hardware/amba_kmi.h>
 
 #include <asm/arch/lm.h>
 
@@ -40,7 +41,9 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/map.h>
+#include <asm/mach/time.h>
 
+#include "common.h"
 
 /* 
  * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
@@ -66,7 +69,6 @@
  * f1200000    12000000        EBI registers
  * f1300000    13000000        Counter/Timer
  * f1400000    14000000        Interrupt controller
- * f1500000    15000000        RTC
  * f1600000    16000000        UART 0
  * f1700000    17000000        UART 1
  * f1a00000    1a000000        Debug LEDs
  */
 
 static struct map_desc ap_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_RTC_BASE),   INTEGRATOR_RTC_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 },
- { PCI_MEMORY_VADDR,                  PHYS_PCI_MEM_BASE,     SZ_16M, MT_DEVICE },
- { PCI_CONFIG_VADDR,                  PHYS_PCI_CONFIG_BASE,  SZ_16M, MT_DEVICE },
- { PCI_V3_VADDR,                      PHYS_PCI_V3_BASE,      SZ_64K, MT_DEVICE },
- { PCI_IO_VADDR,                      PHYS_PCI_IO_BASE,      SZ_64K, 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        = PCI_MEMORY_VADDR,
+               .pfn            = __phys_to_pfn(PHYS_PCI_MEM_BASE),
+               .length         = SZ_16M,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = PCI_CONFIG_VADDR,
+               .pfn            = __phys_to_pfn(PHYS_PCI_CONFIG_BASE),
+               .length         = SZ_16M,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = PCI_V3_VADDR,
+               .pfn            = __phys_to_pfn(PHYS_PCI_V3_BASE),
+               .length         = SZ_64K,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = PCI_IO_VADDR,
+               .pfn            = __phys_to_pfn(PHYS_PCI_IO_BASE),
+               .length         = SZ_64K,
+               .type           = MT_DEVICE
+       }
 };
 
 static void __init ap_map_io(void)
@@ -107,7 +161,8 @@ static void sc_unmask_irq(unsigned int irq)
        writel(1 << irq, VA_IC_BASE + IRQ_ENABLE_SET);
 }
 
-static struct irqchip sc_chip = {
+static struct irq_chip sc_chip = {
+       .name   = "SC",
        .ack    = sc_mask_irq,
        .mask   = sc_mask_irq,
        .unmask = sc_unmask_irq,
@@ -128,7 +183,7 @@ static void __init ap_init_irq(void)
        for (i = 0; i < NR_IRQS; i++) {
                if (((1 << i) & INTEGRATOR_SC_VALID_INT) != 0) {
                        set_irq_chip(i, &sc_chip);
-                       set_irq_handler(i, do_level_IRQ);
+                       set_irq_handler(i, handle_level_irq);
                        set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
                }
        }
@@ -137,7 +192,7 @@ static void __init ap_init_irq(void)
 #ifdef CONFIG_PM
 static unsigned long ic_irq_enable;
 
-static int irq_suspend(struct sys_device *dev, u32 state)
+static int irq_suspend(struct sys_device *dev, pm_message_t state)
 {
        ic_irq_enable = readl(VA_IC_BASE + IRQ_ENABLE);
        return 0;
@@ -256,7 +311,7 @@ static void __init ap_init(void)
        unsigned long sc_dec;
        int i;
 
-       platform_add_device(&cfi_flash_device);
+       platform_device_register(&cfi_flash_device);
 
        sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
        for (i = 0; i < 4; i++) {
@@ -265,12 +320,10 @@ static void __init ap_init(void)
                if ((sc_dec & (16 << i)) == 0)
                        continue;
 
-               lmdev = kmalloc(sizeof(struct lm_device), GFP_KERNEL);
+               lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
                if (!lmdev)
                        continue;
 
-               memset(lmdev, 0, sizeof(struct lm_device));
-
                lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
                lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
                lmdev->resource.flags = IORESOURCE_MEM;
@@ -281,11 +334,23 @@ static void __init ap_init(void)
        }
 }
 
+static void __init ap_init_timer(void)
+{
+       integrator_time_init(1000000 * TICKS_PER_uSEC / HZ, 0);
+}
+
+static struct sys_timer ap_timer = {
+       .init           = ap_init_timer,
+       .offset         = integrator_gettimeoffset,
+};
+
 MACHINE_START(INTEGRATOR, "ARM-Integrator")
-       MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd")
-       BOOT_MEM(0x00000000, 0x16000000, 0xf1600000)
-       BOOT_PARAMS(0x00000100)
-       MAPIO(ap_map_io)
-       INITIRQ(ap_init_irq)
-       INIT_MACHINE(ap_init)
+       /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
+       .phys_io        = 0x16000000,
+       .io_pg_offst    = ((0xf1600000) >> 18) & 0xfffc,
+       .boot_params    = 0x00000100,
+       .map_io         = ap_map_io,
+       .init_irq       = ap_init_irq,
+       .timer          = &ap_timer,
+       .init_machine   = ap_init,
 MACHINE_END