Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / parisc / lasi.c
index 6e67ea0..cb3d281 100644 (file)
  *      (at your option) any later version.
  *
  *     by Alan Cox <alan@redhat.com> and 
- *        Alex deVries <adevries@thepuffingroup.com> 
+ *        Alex deVries <alex@onefishtwo.ca>
  */
 
 #include <linux/errno.h>
 #include <linux/init.h>
-#include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/pm.h>
-#include <linux/slab.h>
 #include <linux/types.h>
 
 #include <asm/io.h>
 #define LASI_IO_CONF   0x7FFFE /* LASI primary configuration register */
 #define LASI_IO_CONF2  0x7FFFF /* LASI secondary configuration register */
 
-static int lasi_choose_irq(struct parisc_device *dev)
+static void lasi_choose_irq(struct parisc_device *dev, void *ctrl)
 {
        int irq;
 
-       /*
-       ** "irq" bits below are numbered relative to most significant bit.
-       */
        switch (dev->id.sversion) {
-               case 0x74:      irq = 24; break; /* Centronics */
-               case 0x7B:      irq = 18; break; /* Audio */
-               case 0x81:      irq = 17; break; /* Lasi itself */
-               case 0x82:      irq = 22; break; /* SCSI */
-               case 0x83:      irq = 11; break; /* Floppy */
-               case 0x84:      irq =  5; break; /* PS/2 Keyboard */
-               case 0x87:      irq = 13; break; /* ISDN */
-               case 0x8A:      irq = 23; break; /* LAN */
-               case 0x8C:      irq = 26; break; /* RS232 */
-               case 0x8D:      irq = (dev->hw_path == 13) ? 15 : 14;
-                                               break; /* Telephone */
-               default:        irq = -1; break; /* unknown */
+               case 0x74:      irq =  7; break; /* Centronics */
+               case 0x7B:      irq = 13; break; /* Audio */
+               case 0x81:      irq = 14; break; /* Lasi itself */
+               case 0x82:      irq =  9; break; /* SCSI */
+               case 0x83:      irq = 20; break; /* Floppy */
+               case 0x84:      irq = 26; break; /* PS/2 Keyboard */
+               case 0x87:      irq = 18; break; /* ISDN */
+               case 0x8A:      irq =  8; break; /* LAN */
+               case 0x8C:      irq =  5; break; /* RS232 */
+               case 0x8D:      irq = (dev->hw_path == 13) ? 16 : 17; break;
+                                                /* Telephone */
+               default:        return;          /* unknown */
        }
 
-       return irq;
+       gsc_asic_assign_irq(ctrl, irq, &dev->irq);
 }
 
 static void __init
-lasi_init_irq(struct busdevice *this_lasi)
+lasi_init_irq(struct gsc_asic *this_lasi)
 {
        unsigned long lasi_base = this_lasi->hpa;
 
@@ -142,7 +138,7 @@ void __init lasi_led_init(unsigned long lasi_hpa)
                break;
        }
 
-       register_led_driver(DISPLAY_MODEL_LASI, LED_CMD_REG_NONE, (char *)datareg);
+       register_led_driver(DISPLAY_MODEL_LASI, LED_CMD_REG_NONE, datareg);
 }
 #endif
 
@@ -154,7 +150,7 @@ void __init lasi_led_init(unsigned long lasi_hpa)
  * 
  */
 
-static unsigned long lasi_power_off_hpa;
+static unsigned long lasi_power_off_hpa __read_mostly;
 
 static void lasi_power_off(void)
 {
@@ -170,16 +166,17 @@ static void lasi_power_off(void)
 int __init
 lasi_init_chip(struct parisc_device *dev)
 {
-       struct busdevice *lasi;
+       extern void (*chassis_power_off)(void);
+       struct gsc_asic *lasi;
        struct gsc_irq gsc_irq;
-       int irq, ret;
+       int ret;
 
-       lasi = kmalloc(sizeof(struct busdevice), GFP_KERNEL);
+       lasi = kzalloc(sizeof(*lasi), GFP_KERNEL);
        if (!lasi)
                return -ENOMEM;
 
        lasi->name = "Lasi";
-       lasi->hpa = dev->hpa;
+       lasi->hpa = dev->hpa.start;
 
        /* Check the 4-bit (yes, only 4) version register */
        lasi->version = gsc_readl(lasi->hpa + LASI_VER) & 0xf;
@@ -193,43 +190,40 @@ lasi_init_chip(struct parisc_device *dev)
        lasi_init_irq(lasi);
 
        /* the IRQ lasi should use */
-       irq = gsc_alloc_irq(&gsc_irq);
-       if (irq < 0) {
+       dev->irq = gsc_alloc_irq(&gsc_irq);
+       if (dev->irq < 0) {
                printk(KERN_ERR "%s(): cannot get GSC irq\n",
                                __FUNCTION__);
                kfree(lasi);
                return -EBUSY;
        }
 
-       ret = request_irq(gsc_irq.irq, busdev_barked, 0, "lasi", lasi);
+       lasi->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
+
+       ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "lasi", lasi);
        if (ret < 0) {
                kfree(lasi);
                return ret;
        }
 
-       /* Save this for debugging later */
-       lasi->parent_irq = gsc_irq.irq;
-       lasi->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
-
        /* enable IRQ's for devices below LASI */
        gsc_writel(lasi->eim, lasi->hpa + OFFSET_IAR);
 
        /* Done init'ing, register this driver */
-       ret = gsc_common_irqsetup(dev, lasi);
+       ret = gsc_common_setup(dev, lasi);
        if (ret) {
                kfree(lasi);
                return ret;
        }    
 
-       fixup_child_irqs(dev, lasi->busdev_region->data.irqbase,
-                       lasi_choose_irq);
+       gsc_fixup_irqs(dev, lasi, lasi_choose_irq);
 
        /* initialize the power off function */
        /* FIXME: Record the LASI HPA for the power off function.  This should
         * ensure that only the first LASI (the one controlling the power off)
         * should set the HPA here */
        lasi_power_off_hpa = lasi->hpa;
-       pm_power_off = lasi_power_off;
+       chassis_power_off = lasi_power_off;
        
        return ret;
 }
@@ -240,7 +234,7 @@ static struct parisc_device_id lasi_tbl[] = {
 };
 
 struct parisc_driver lasi_driver = {
-       .name =         "Lasi",
+       .name =         "lasi",
        .id_table =     lasi_tbl,
        .probe =        lasi_init_chip,
 };