fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / arm / mach-sa1100 / neponset.c
index e3dc138..075d4d1 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/tty.h>
 #include <linux/ioport.h>
 #include <linux/serial_core.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/slab.h>
 
 #include <asm/hardware.h>
  * is rather unfortunate.
  */
 static void
-neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
+neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
        unsigned int irr;
 
        while (1) {
-               struct irqdesc *d;
+               struct irq_desc *d;
 
                /*
                 * Acknowledge the parent IRQ.
@@ -59,14 +59,22 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg
                if (irr & (IRR_ETHERNET | IRR_USAR)) {
                        desc->chip->mask(irq);
 
+                       /*
+                        * Ack the interrupt now to prevent re-entering
+                        * this neponset handler.  Again, this is safe
+                        * since we'll check the IRR register prior to
+                        * leaving.
+                        */
+                       desc->chip->ack(irq);
+
                        if (irr & IRR_ETHERNET) {
                                d = irq_desc + IRQ_NEPONSET_SMC9196;
-                               d->handle(IRQ_NEPONSET_SMC9196, d, regs);
+                               desc_handle_irq(IRQ_NEPONSET_SMC9196, d);
                        }
 
                        if (irr & IRR_USAR) {
                                d = irq_desc + IRQ_NEPONSET_USAR;
-                               d->handle(IRQ_NEPONSET_USAR, d, regs);
+                               desc_handle_irq(IRQ_NEPONSET_USAR, d);
                        }
 
                        desc->chip->unmask(irq);
@@ -74,7 +82,7 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg
 
                if (irr & IRR_SA1111) {
                        d = irq_desc + IRQ_NEPONSET_SA1111;
-                       d->handle(IRQ_NEPONSET_SA1111, d, regs);
+                       desc_handle_irq(IRQ_NEPONSET_SA1111, d);
                }
        }
 }
@@ -137,7 +145,7 @@ static struct sa1100_port_fns neponset_port_fns __initdata = {
        .get_mctrl      = neponset_get_mctrl,
 };
 
-static int neponset_probe(struct device *dev)
+static int neponset_probe(struct platform_device *dev)
 {
        sa1100_register_uart_fns(&neponset_port_fns);
 
@@ -160,9 +168,9 @@ static int neponset_probe(struct device *dev)
         * Setup other Neponset IRQs.  SA1111 will be done by the
         * generic SA1111 code.
         */
-       set_irq_handler(IRQ_NEPONSET_SMC9196, do_simple_IRQ);
+       set_irq_handler(IRQ_NEPONSET_SMC9196, handle_simple_irq);
        set_irq_flags(IRQ_NEPONSET_SMC9196, IRQF_VALID | IRQF_PROBE);
-       set_irq_handler(IRQ_NEPONSET_USAR, do_simple_IRQ);
+       set_irq_handler(IRQ_NEPONSET_USAR, handle_simple_irq);
        set_irq_flags(IRQ_NEPONSET_USAR, IRQF_VALID | IRQF_PROBE);
 
        /*
@@ -178,33 +186,27 @@ static int neponset_probe(struct device *dev)
 /*
  * LDM power management.
  */
-static int neponset_suspend(struct device *dev, u32 state, u32 level)
+static int neponset_suspend(struct platform_device *dev, pm_message_t state)
 {
        /*
         * Save state.
         */
-       if (level == SUSPEND_SAVE_STATE ||
-           level == SUSPEND_DISABLE ||
-           level == SUSPEND_POWER_DOWN) {
-               if (!dev->power.saved_state)
-                       dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
-               if (!dev->power.saved_state)
-                       return -ENOMEM;
-
-               *(unsigned int *)dev->power.saved_state = NCR_0;
-       }
+       if (!dev->dev.power.saved_state)
+               dev->dev.power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
+       if (!dev->dev.power.saved_state)
+               return -ENOMEM;
+
+       *(unsigned int *)dev->dev.power.saved_state = NCR_0;
 
        return 0;
 }
 
-static int neponset_resume(struct device *dev, u32 level)
+static int neponset_resume(struct platform_device *dev)
 {
-       if (level == RESUME_RESTORE_STATE || level == RESUME_ENABLE) {
-               if (dev->power.saved_state) {
-                       NCR_0 = *(unsigned int *)dev->power.saved_state;
-                       kfree(dev->power.saved_state);
-                       dev->power.saved_state = NULL;
-               }
+       if (dev->dev.power.saved_state) {
+               NCR_0 = *(unsigned int *)dev->dev.power.saved_state;
+               kfree(dev->dev.power.saved_state);
+               dev->dev.power.saved_state = NULL;
        }
 
        return 0;
@@ -215,12 +217,13 @@ static int neponset_resume(struct device *dev, u32 level)
 #define neponset_resume  NULL
 #endif
 
-static struct device_driver neponset_device_driver = {
-       .name           = "neponset",
-       .bus            = &platform_bus_type,
+static struct platform_driver neponset_device_driver = {
        .probe          = neponset_probe,
        .suspend        = neponset_suspend,
        .resume         = neponset_resume,
+       .driver         = {
+               .name   = "neponset",
+       },
 };
 
 static struct resource neponset_resources[] = {
@@ -266,6 +269,7 @@ static struct platform_device sa1111_device = {
 
 static struct resource smc91x_resources[] = {
        [0] = {
+               .name   = "smc91x-regs",
                .start  = SA1100_CS3_PHYS,
                .end    = SA1100_CS3_PHYS + 0x01ffffff,
                .flags  = IORESOURCE_MEM,
@@ -276,6 +280,7 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_IRQ,
        },
        [2] = {
+               .name   = "smc91x-attrib",
                .start  = SA1100_CS3_PHYS + 0x02000000,
                .end    = SA1100_CS3_PHYS + 0x03ffffff,
                .flags  = IORESOURCE_MEM,
@@ -297,7 +302,7 @@ static struct platform_device *devices[] __initdata = {
 
 static int __init neponset_init(void)
 {
-       driver_register(&neponset_device_driver);
+       platform_driver_register(&neponset_device_driver);
 
        /*
         * The Neponset is only present on the Assabet machine type.
@@ -329,9 +334,17 @@ static int __init neponset_init(void)
 subsys_initcall(neponset_init);
 
 static struct map_desc neponset_io_desc[] __initdata = {
- /* virtual     physical    length type */
-  { 0xf3000000, 0x10000000, SZ_1M, MT_DEVICE }, /* System Registers */
-  { 0xf4000000, 0x40000000, SZ_1M, MT_DEVICE }  /* SA-1111 */
+       {       /* System Registers */
+               .virtual        =  0xf3000000,
+               .pfn            = __phys_to_pfn(0x10000000),
+               .length         = SZ_1M,
+               .type           = MT_DEVICE
+       }, {    /* SA-1111 */
+               .virtual        =  0xf4000000,
+               .pfn            = __phys_to_pfn(0x40000000),
+               .length         = SZ_1M,
+               .type           = MT_DEVICE
+       }
 };
 
 void __init neponset_map_io(void)