fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / arm / mach-ixp2000 / ixdp2x00.c
index cda60b7..52b368b 100644 (file)
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
  */
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/interrupt.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/bitops.h>
 #include <linux/pci.h>
-#include <linux/interrupt.h>
-#include <linux/mm.h>
-#include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -45,6 +41,9 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/arch.h>
 
+#include <asm/arch/gpio.h>
+
+
 /*************************************************************************
  * IXDP2x00 IRQ Initialization
  *************************************************************************/
@@ -81,7 +80,7 @@ static void ixdp2x00_irq_mask(unsigned int irq)
 
        dummy = *board_irq_mask;
        dummy |=  IXP2000_BOARD_IRQ_MASK(irq);
-       ixp2000_reg_write(board_irq_mask, dummy);
+       ixp2000_reg_wrb(board_irq_mask, dummy);
 
 #ifdef CONFIG_ARCH_IXDP2400
        if (machine_is_ixdp2400())
@@ -94,20 +93,20 @@ static void ixdp2x00_irq_unmask(unsigned int irq)
        unsigned long dummy;
        static struct slowport_cfg old_cfg;
 
-#ifdef CONFGI_ARCH_IXDP2400
+#ifdef CONFIG_ARCH_IXDP2400
        if (machine_is_ixdp2400())
                ixp2000_acquire_slowport(&slowport_cpld_cfg, &old_cfg);
 #endif
 
        dummy = *board_irq_mask;
        dummy &=  ~IXP2000_BOARD_IRQ_MASK(irq);
-       ixp2000_reg_write(board_irq_mask, dummy);
+       ixp2000_reg_wrb(board_irq_mask, dummy);
 
        if (machine_is_ixdp2400()) 
                ixp2000_release_slowport(&old_cfg);
 }
 
-static void ixdp2x00_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
+static void ixdp2x00_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
         volatile u32 ex_interrupt = 0;
        static struct slowport_cfg old_cfg;
@@ -130,17 +129,17 @@ static void ixdp2x00_irq_handler(unsigned int irq, struct irqdesc *desc, struct
 
        for(i = 0; i < board_irq_count; i++) {
                if(ex_interrupt & (1 << i))  {
-                       struct irqdesc *cpld_desc;
+                       struct irq_desc *cpld_desc;
                        int cpld_irq = IXP2000_BOARD_IRQ(0) + i;
                        cpld_desc = irq_desc + cpld_irq;
-                       cpld_desc->handle(cpld_irq, cpld_desc, regs);
+                       desc_handle_irq(cpld_irq, cpld_desc);
                }
        }
 
        desc->chip->unmask(irq);
 }
 
-static struct irqchip ixdp2x00_cpld_irq_chip = {
+static struct irq_chip ixdp2x00_cpld_irq_chip = {
        .ack    = ixdp2x00_irq_mask,
        .mask   = ixdp2x00_irq_mask,
        .unmask = ixdp2x00_irq_unmask
@@ -163,12 +162,12 @@ void ixdp2x00_init_irq(volatile unsigned long *stat_reg, volatile unsigned long
 
        for(irq = IXP2000_BOARD_IRQ(0); irq < IXP2000_BOARD_IRQ(board_irq_count); irq++) {
                set_irq_chip(irq, &ixdp2x00_cpld_irq_chip);
-               set_irq_handler(irq, do_level_IRQ);
+               set_irq_handler(irq, handle_level_irq);
                set_irq_flags(irq, IRQF_VALID);
        }
 
        /* Hook into PCI interrupt */
-       set_irq_chained_handler(IRQ_IXP2000_PCIB, &ixdp2x00_irq_handler);
+       set_irq_chained_handler(IRQ_IXP2000_PCIB, ixdp2x00_irq_handler);
 }
 
 /*************************************************************************
@@ -176,7 +175,7 @@ void ixdp2x00_init_irq(volatile unsigned long *stat_reg, volatile unsigned long
  *************************************************************************/
 static struct map_desc ixdp2x00_io_desc __initdata = {
        .virtual        = IXDP2X00_VIRT_CPLD_BASE, 
-       .physical       = IXDP2X00_PHYS_CPLD_BASE,
+       .pfn            = __phys_to_pfn(IXDP2X00_PHYS_CPLD_BASE),
        .length         = IXDP2X00_CPLD_SIZE,
        .type           = MT_DEVICE
 };
@@ -197,7 +196,7 @@ void __init ixdp2x00_map_io(void)
  * Linux is a common design in telecom systems. The problem is that instead 
  * of all the devices being controlled by a single host, different
  * devices are controlles by different NPUs on the same bus, leading to
- * multiple hosts on the bus.i The exact bus layout looks like:
+ * multiple hosts on the bus. The exact bus layout looks like:
  *
  *                   Bus 0
  *    Master NPU <-------------------+-------------------> Slave NPU
@@ -213,9 +212,9 @@ void __init ixdp2x00_map_io(void)
  *             ... Dev    PMC       Media     Eth0   Eth1 ...
  *
  * The master controlls all but Eth1, which is controlled by the
- * slave. What this measn is that the both the master and the slave
+ * slave. What this means is that the both the master and the slave
  * have to scan the bus, but only one of them can enumerate the bus.
- * In addition, after the bus is scaned, each kernel must remove
+ * In addition, after the bus is scanned, each kernel must remove
  * the device(s) it does not control from the PCI dev list otherwise
  * a driver on each NPU will try to manage it and we will have horrible
  * conflicts. Oh..and the slave NPU needs to see the master NPU
@@ -242,11 +241,14 @@ void ixdp2x00_slave_pci_postinit(void)
        /*
         * Remove PMC device is there is one
         */
-       if((dev = pci_find_slot(1, IXDP2X00_PMC_DEVFN)))
+       if((dev = pci_get_bus_and_slot(1, IXDP2X00_PMC_DEVFN))) {
                pci_remove_bus_device(dev);
+               pci_dev_put(dev);
+       }
 
-       dev = pci_find_slot(0, IXDP2X00_21555_DEVFN);
+       dev = pci_get_bus_and_slot(0, IXDP2X00_21555_DEVFN);
        pci_remove_bus_device(dev);
+       pci_dev_put(dev);
 }
 
 /**************************************************************************
@@ -303,5 +305,6 @@ void __init ixdp2x00_init_machine(void)
        gpio_line_config(IXDP2X00_GPIO_I2C_ENABLE, GPIO_OUT);
 
        platform_add_devices(ixdp2x00_devices, ARRAY_SIZE(ixdp2x00_devices));
+       ixp2000_uart_init();
 }