diff options
Diffstat (limited to 'arch/microblaze/pci/pci-common.c')
-rw-r--r-- | arch/microblaze/pci/pci-common.c | 73 |
1 files changed, 2 insertions, 71 deletions
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index 1b93bf0892a0..66804adcacf0 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/of.h> | 30 | #include <linux/of.h> |
31 | #include <linux/of_address.h> | 31 | #include <linux/of_address.h> |
32 | #include <linux/of_irq.h> | ||
32 | #include <linux/of_pci.h> | 33 | #include <linux/of_pci.h> |
33 | #include <linux/export.h> | 34 | #include <linux/export.h> |
34 | 35 | ||
@@ -193,76 +194,6 @@ void pcibios_set_master(struct pci_dev *dev) | |||
193 | } | 194 | } |
194 | 195 | ||
195 | /* | 196 | /* |
196 | * Reads the interrupt pin to determine if interrupt is use by card. | ||
197 | * If the interrupt is used, then gets the interrupt line from the | ||
198 | * openfirmware and sets it in the pci_dev and pci_config line. | ||
199 | */ | ||
200 | int pci_read_irq_line(struct pci_dev *pci_dev) | ||
201 | { | ||
202 | struct of_irq oirq; | ||
203 | unsigned int virq; | ||
204 | |||
205 | /* The current device-tree that iSeries generates from the HV | ||
206 | * PCI informations doesn't contain proper interrupt routing, | ||
207 | * and all the fallback would do is print out crap, so we | ||
208 | * don't attempt to resolve the interrupts here at all, some | ||
209 | * iSeries specific fixup does it. | ||
210 | * | ||
211 | * In the long run, we will hopefully fix the generated device-tree | ||
212 | * instead. | ||
213 | */ | ||
214 | pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev)); | ||
215 | |||
216 | #ifdef DEBUG | ||
217 | memset(&oirq, 0xff, sizeof(oirq)); | ||
218 | #endif | ||
219 | /* Try to get a mapping from the device-tree */ | ||
220 | if (of_irq_map_pci(pci_dev, &oirq)) { | ||
221 | u8 line, pin; | ||
222 | |||
223 | /* If that fails, lets fallback to what is in the config | ||
224 | * space and map that through the default controller. We | ||
225 | * also set the type to level low since that's what PCI | ||
226 | * interrupts are. If your platform does differently, then | ||
227 | * either provide a proper interrupt tree or don't use this | ||
228 | * function. | ||
229 | */ | ||
230 | if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &pin)) | ||
231 | return -1; | ||
232 | if (pin == 0) | ||
233 | return -1; | ||
234 | if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_LINE, &line) || | ||
235 | line == 0xff || line == 0) { | ||
236 | return -1; | ||
237 | } | ||
238 | pr_debug(" No map ! Using line %d (pin %d) from PCI config\n", | ||
239 | line, pin); | ||
240 | |||
241 | virq = irq_create_mapping(NULL, line); | ||
242 | if (virq) | ||
243 | irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); | ||
244 | } else { | ||
245 | pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", | ||
246 | oirq.size, oirq.specifier[0], oirq.specifier[1], | ||
247 | of_node_full_name(oirq.controller)); | ||
248 | |||
249 | virq = irq_create_of_mapping(oirq.controller, oirq.specifier, | ||
250 | oirq.size); | ||
251 | } | ||
252 | if (!virq) { | ||
253 | pr_debug(" Failed to map !\n"); | ||
254 | return -1; | ||
255 | } | ||
256 | |||
257 | pr_debug(" Mapped to linux irq %d\n", virq); | ||
258 | |||
259 | pci_dev->irq = virq; | ||
260 | |||
261 | return 0; | ||
262 | } | ||
263 | EXPORT_SYMBOL(pci_read_irq_line); | ||
264 | |||
265 | /* | ||
266 | * Platform support for /proc/bus/pci/X/Y mmap()s, | 197 | * Platform support for /proc/bus/pci/X/Y mmap()s, |
267 | * modelled on the sparc64 implementation by Dave Miller. | 198 | * modelled on the sparc64 implementation by Dave Miller. |
268 | * -- paulus. | 199 | * -- paulus. |
@@ -960,7 +891,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus) | |||
960 | dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET; | 891 | dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET; |
961 | 892 | ||
962 | /* Read default IRQs and fixup if necessary */ | 893 | /* Read default IRQs and fixup if necessary */ |
963 | pci_read_irq_line(dev); | 894 | dev->irq = of_irq_parse_and_map_pci(dev, 0, 0); |
964 | } | 895 | } |
965 | } | 896 | } |
966 | 897 | ||