Commit deb66c45 authored by David S. Miller's avatar David S. Miller

[SPARC64] isa: Convert to use pci_device_to_OF_node().

Also, do not try to compute resources by hand, instead use
the pre-computed ones in the of_device.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1327e9b6
...@@ -24,27 +24,9 @@ static void __init report_dev(struct sparc_isa_device *isa_dev, int child) ...@@ -24,27 +24,9 @@ static void __init report_dev(struct sparc_isa_device *isa_dev, int child)
static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev) static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev)
{ {
const struct linux_prom_registers *pregs; struct of_device *op = of_find_device_by_node(isa_dev->prom_node);
unsigned long base, len;
int prop_len;
pregs = of_get_property(isa_dev->prom_node, "reg", &prop_len);
if (!pregs)
return;
/* Only the first one is interesting. */
len = pregs[0].reg_size;
base = (((unsigned long)pregs[0].which_io << 32) |
(unsigned long)pregs[0].phys_addr);
base += isa_dev->bus->parent->io_space.start;
isa_dev->resource.start = base;
isa_dev->resource.end = (base + len - 1UL);
isa_dev->resource.flags = IORESOURCE_IO;
isa_dev->resource.name = isa_dev->prom_node->name;
request_resource(&isa_dev->bus->parent->io_space, memcpy(&isa_dev->resource, &op->resource[0], sizeof(struct resource));
&isa_dev->resource);
} }
static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev) static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev)
...@@ -158,19 +140,10 @@ void __init isa_init(void) ...@@ -158,19 +140,10 @@ void __init isa_init(void)
pdev = NULL; pdev = NULL;
while ((pdev = pci_get_device(vendor, device, pdev)) != NULL) { while ((pdev = pci_get_device(vendor, device, pdev)) != NULL) {
struct pcidev_cookie *pdev_cookie;
struct pci_pbm_info *pbm;
struct sparc_isa_bridge *isa_br; struct sparc_isa_bridge *isa_br;
struct device_node *dp; struct device_node *dp;
pdev_cookie = pdev->sysdata; dp = pci_device_to_OF_node(pdev);
if (!pdev_cookie) {
printk("ISA: Warning, ISA bridge ignored due to "
"lack of OBP data.\n");
continue;
}
pbm = pdev_cookie->pbm;
dp = pdev_cookie->prom_node;
isa_br = kzalloc(sizeof(*isa_br), GFP_KERNEL); isa_br = kzalloc(sizeof(*isa_br), GFP_KERNEL);
if (!isa_br) { if (!isa_br) {
...@@ -195,10 +168,9 @@ void __init isa_init(void) ...@@ -195,10 +168,9 @@ void __init isa_init(void)
isa_br->next = isa_chain; isa_br->next = isa_chain;
isa_chain = isa_br; isa_chain = isa_br;
isa_br->parent = pbm;
isa_br->self = pdev; isa_br->self = pdev;
isa_br->index = index++; isa_br->index = index++;
isa_br->prom_node = pdev_cookie->prom_node; isa_br->prom_node = dp;
printk("isa%d:", isa_br->index); printk("isa%d:", isa_br->index);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#ifndef __SPARC64_ISA_H #ifndef __SPARC64_ISA_H
#define __SPARC64_ISA_H #define __SPARC64_ISA_H
#include <asm/pbm.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/of_device.h> #include <asm/of_device.h>
...@@ -29,7 +28,6 @@ struct sparc_isa_bridge { ...@@ -29,7 +28,6 @@ struct sparc_isa_bridge {
struct of_device ofdev; struct of_device ofdev;
struct sparc_isa_bridge *next; struct sparc_isa_bridge *next;
struct sparc_isa_device *devices; struct sparc_isa_device *devices;
struct pci_pbm_info *parent;
struct pci_dev *self; struct pci_dev *self;
int index; int index;
struct device_node *prom_node; struct device_node *prom_node;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment