diff options
Diffstat (limited to 'drivers/of/of_pci_irq.c')
-rw-r--r-- | drivers/of/of_pci_irq.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c index d86076431af6..8736bc7676c5 100644 --- a/drivers/of/of_pci_irq.c +++ b/drivers/of/of_pci_irq.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/export.h> | 4 | #include <linux/export.h> |
5 | 5 | ||
6 | /** | 6 | /** |
7 | * of_irq_map_pci - Resolve the interrupt for a PCI device | 7 | * of_irq_parse_pci - Resolve the interrupt for a PCI device |
8 | * @pdev: the device whose interrupt is to be resolved | 8 | * @pdev: the device whose interrupt is to be resolved |
9 | * @out_irq: structure of_irq filled by this function | 9 | * @out_irq: structure of_irq filled by this function |
10 | * | 10 | * |
@@ -14,7 +14,7 @@ | |||
14 | * PCI tree until an device-node is found, at which point it will finish | 14 | * PCI tree until an device-node is found, at which point it will finish |
15 | * resolving using the OF tree walking. | 15 | * resolving using the OF tree walking. |
16 | */ | 16 | */ |
17 | int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) | 17 | int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) |
18 | { | 18 | { |
19 | struct device_node *dn, *ppnode; | 19 | struct device_node *dn, *ppnode; |
20 | struct pci_dev *ppdev; | 20 | struct pci_dev *ppdev; |
@@ -29,7 +29,7 @@ int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) | |||
29 | */ | 29 | */ |
30 | dn = pci_device_to_OF_node(pdev); | 30 | dn = pci_device_to_OF_node(pdev); |
31 | if (dn) { | 31 | if (dn) { |
32 | rc = of_irq_map_one(dn, 0, out_irq); | 32 | rc = of_irq_parse_one(dn, 0, out_irq); |
33 | if (!rc) | 33 | if (!rc) |
34 | return rc; | 34 | return rc; |
35 | } | 35 | } |
@@ -84,9 +84,37 @@ int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) | |||
84 | pdev = ppdev; | 84 | pdev = ppdev; |
85 | } | 85 | } |
86 | 86 | ||
87 | out_irq->np = ppnode; | ||
88 | out_irq->args_count = 1; | ||
89 | out_irq->args[0] = lspec; | ||
87 | lspec_be = cpu_to_be32(lspec); | 90 | lspec_be = cpu_to_be32(lspec); |
88 | laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); | 91 | laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); |
89 | laddr[1] = laddr[2] = cpu_to_be32(0); | 92 | laddr[1] = laddr[2] = cpu_to_be32(0); |
90 | return of_irq_map_raw(ppnode, &lspec_be, 1, laddr, out_irq); | 93 | return of_irq_parse_raw(laddr, out_irq); |
91 | } | 94 | } |
92 | EXPORT_SYMBOL_GPL(of_irq_map_pci); | 95 | EXPORT_SYMBOL_GPL(of_irq_parse_pci); |
96 | |||
97 | /** | ||
98 | * of_irq_parse_and_map_pci() - Decode a PCI irq from the device tree and map to a virq | ||
99 | * @dev: The pci device needing an irq | ||
100 | * @slot: PCI slot number; passed when used as map_irq callback. Unused | ||
101 | * @pin: PCI irq pin number; passed when used as map_irq callback. Unused | ||
102 | * | ||
103 | * @slot and @pin are unused, but included in the function so that this | ||
104 | * function can be used directly as the map_irq callback to pci_fixup_irqs(). | ||
105 | */ | ||
106 | int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) | ||
107 | { | ||
108 | struct of_phandle_args oirq; | ||
109 | int ret; | ||
110 | |||
111 | ret = of_irq_parse_pci(dev, &oirq); | ||
112 | if (ret) { | ||
113 | dev_err(&dev->dev, "of_irq_parse_pci() failed with rc=%d\n", ret); | ||
114 | return 0; /* Proper return code 0 == NO_IRQ */ | ||
115 | } | ||
116 | |||
117 | return irq_create_of_mapping(&oirq); | ||
118 | } | ||
119 | EXPORT_SYMBOL_GPL(of_irq_parse_and_map_pci); | ||
120 | |||