]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sparc64/kernel/ebus.c
[SPARC64]: Fix 'niu' complex IRQ probing.
[linux-2.6-omap-h63xx.git] / arch / sparc64 / kernel / ebus.c
index 1962bfa4ef3d0cdfd4118cf1da19efac9ca5fbca..04ab81cb4f483f24e78c6d74c40e044d29383203 100644 (file)
 #include <linux/string.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/pci.h>
 
 #include <asm/system.h>
 #include <asm/page.h>
-#include <asm/pbm.h>
 #include <asm/ebus.h>
 #include <asm/oplib.h>
 #include <asm/prom.h>
 #include <asm/of_device.h>
 #include <asm/bpp.h>
 #include <asm/irq.h>
+#include <asm/io.h>
 
 /* EBUS dma library. */
 
@@ -361,6 +362,7 @@ static int __init child_regs_nonstandard(struct linux_ebus_device *dev)
 static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *dev)
 {
        struct linux_ebus_child *child;
+       struct dev_archdata *sd;
        struct of_device *op;
        int i, len;
 
@@ -373,7 +375,10 @@ static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_de
                dev->num_addrs = 0;
                dev->num_irqs = 0;
        } else {
-               (void) of_get_property(dp, "reg", &len);
+               const int *regs = of_get_property(dp, "reg", &len);
+
+               if (!regs)
+                       len = 0;
                dev->num_addrs = len / sizeof(struct linux_prom_registers);
 
                for (i = 0; i < dev->num_addrs; i++)
@@ -386,6 +391,12 @@ static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_de
                        dev->irqs[i] = op->irqs[i];
        }
 
+       sd = &dev->ofdev.dev.archdata;
+       sd->prom_node = dp;
+       sd->op = &dev->ofdev;
+       sd->iommu = dev->bus->ofdev.dev.parent->archdata.iommu;
+       sd->stc = dev->bus->ofdev.dev.parent->archdata.stc;
+
        dev->ofdev.node = dp;
        dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
        dev->ofdev.dev.bus = &ebus_bus_type;
@@ -438,11 +449,9 @@ static struct pci_dev *find_next_ebus(struct pci_dev *start, int *is_rio_p)
 
 void __init ebus_init(void)
 {
-       struct pci_pbm_info *pbm;
        struct linux_ebus_device *dev;
        struct linux_ebus *ebus;
        struct pci_dev *pdev;
-       struct pcidev_cookie *cookie;
        struct device_node *dp;
        int is_rio;
        int num_ebus = 0;
@@ -453,8 +462,7 @@ void __init ebus_init(void)
                return;
        }
 
-       cookie = pdev->sysdata;
-       dp = cookie->prom_node;
+       dp = pci_device_to_OF_node(pdev);
 
        ebus_chain = ebus = ebus_alloc(sizeof(struct linux_ebus));
        ebus->next = NULL;
@@ -480,8 +488,7 @@ void __init ebus_init(void)
                                break;
                        }
                        ebus->is_rio = is_rio;
-                       cookie = pdev->sysdata;
-                       dp = cookie->prom_node;
+                       dp = pci_device_to_OF_node(pdev);
                        continue;
                }
                printk("ebus%d:", num_ebus);
@@ -489,7 +496,6 @@ void __init ebus_init(void)
                ebus->index = num_ebus;
                ebus->prom_node = dp;
                ebus->self = pdev;
-               ebus->parent = pbm = cookie->pbm;
 
                ebus->ofdev.node = dp;
                ebus->ofdev.dev.parent = &pdev->dev;
@@ -531,8 +537,7 @@ void __init ebus_init(void)
                if (!pdev)
                        break;
 
-               cookie = pdev->sysdata;
-               dp = cookie->prom_node;
+               dp = pci_device_to_OF_node(pdev);
 
                ebus->next = ebus_alloc(sizeof(struct linux_ebus));
                ebus = ebus->next;