diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-02-28 21:01:38 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 04:55:05 -0400 |
commit | deb66c4521e119442aa266553e8cbfc86eb71232 (patch) | |
tree | c98485097187792065b9f2968d9b6fc0e6ca3fae /arch/sparc64/kernel/isa.c | |
parent | 1327e9b62fc88e64ffbbd42d61fccd34e521bb86 (diff) |
[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: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/isa.c')
-rw-r--r-- | arch/sparc64/kernel/isa.c | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c index 791eeb7e3873..6a6882e57ff2 100644 --- a/arch/sparc64/kernel/isa.c +++ b/arch/sparc64/kernel/isa.c | |||
@@ -24,27 +24,9 @@ static void __init report_dev(struct sparc_isa_device *isa_dev, int child) | |||
24 | 24 | ||
25 | static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev) | 25 | static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev) |
26 | { | 26 | { |
27 | const struct linux_prom_registers *pregs; | 27 | struct of_device *op = of_find_device_by_node(isa_dev->prom_node); |
28 | unsigned long base, len; | ||
29 | int prop_len; | ||
30 | |||
31 | pregs = of_get_property(isa_dev->prom_node, "reg", &prop_len); | ||
32 | if (!pregs) | ||
33 | return; | ||
34 | |||
35 | /* Only the first one is interesting. */ | ||
36 | len = pregs[0].reg_size; | ||
37 | base = (((unsigned long)pregs[0].which_io << 32) | | ||
38 | (unsigned long)pregs[0].phys_addr); | ||
39 | base += isa_dev->bus->parent->io_space.start; | ||
40 | |||
41 | isa_dev->resource.start = base; | ||
42 | isa_dev->resource.end = (base + len - 1UL); | ||
43 | isa_dev->resource.flags = IORESOURCE_IO; | ||
44 | isa_dev->resource.name = isa_dev->prom_node->name; | ||
45 | 28 | ||
46 | request_resource(&isa_dev->bus->parent->io_space, | 29 | memcpy(&isa_dev->resource, &op->resource[0], sizeof(struct resource)); |
47 | &isa_dev->resource); | ||
48 | } | 30 | } |
49 | 31 | ||
50 | static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev) | 32 | static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev) |
@@ -158,19 +140,10 @@ void __init isa_init(void) | |||
158 | 140 | ||
159 | pdev = NULL; | 141 | pdev = NULL; |
160 | while ((pdev = pci_get_device(vendor, device, pdev)) != NULL) { | 142 | while ((pdev = pci_get_device(vendor, device, pdev)) != NULL) { |
161 | struct pcidev_cookie *pdev_cookie; | ||
162 | struct pci_pbm_info *pbm; | ||
163 | struct sparc_isa_bridge *isa_br; | 143 | struct sparc_isa_bridge *isa_br; |
164 | struct device_node *dp; | 144 | struct device_node *dp; |
165 | 145 | ||
166 | pdev_cookie = pdev->sysdata; | 146 | dp = pci_device_to_OF_node(pdev); |
167 | if (!pdev_cookie) { | ||
168 | printk("ISA: Warning, ISA bridge ignored due to " | ||
169 | "lack of OBP data.\n"); | ||
170 | continue; | ||
171 | } | ||
172 | pbm = pdev_cookie->pbm; | ||
173 | dp = pdev_cookie->prom_node; | ||
174 | 147 | ||
175 | isa_br = kzalloc(sizeof(*isa_br), GFP_KERNEL); | 148 | isa_br = kzalloc(sizeof(*isa_br), GFP_KERNEL); |
176 | if (!isa_br) { | 149 | if (!isa_br) { |
@@ -195,10 +168,9 @@ void __init isa_init(void) | |||
195 | isa_br->next = isa_chain; | 168 | isa_br->next = isa_chain; |
196 | isa_chain = isa_br; | 169 | isa_chain = isa_br; |
197 | 170 | ||
198 | isa_br->parent = pbm; | ||
199 | isa_br->self = pdev; | 171 | isa_br->self = pdev; |
200 | isa_br->index = index++; | 172 | isa_br->index = index++; |
201 | isa_br->prom_node = pdev_cookie->prom_node; | 173 | isa_br->prom_node = dp; |
202 | 174 | ||
203 | printk("isa%d:", isa_br->index); | 175 | printk("isa%d:", isa_br->index); |
204 | 176 | ||