aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/of_pci_irq.c25
-rw-r--r--drivers/pci/host/pci-mvebu.c14
2 files changed, 26 insertions, 13 deletions
diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c
index 303afebc247a..8e92acd8253f 100644
--- a/drivers/of/of_pci_irq.c
+++ b/drivers/of/of_pci_irq.c
@@ -94,3 +94,28 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq
94 return of_irq_parse_raw(laddr, out_irq); 94 return of_irq_parse_raw(laddr, out_irq);
95} 95}
96EXPORT_SYMBOL_GPL(of_irq_parse_pci); 96EXPORT_SYMBOL_GPL(of_irq_parse_pci);
97
98/**
99 * of_irq_parse_and_map_pci() - Decode a PCI irq from the device tree and map to a virq
100 * @dev: The pci device needing an irq
101 * @slot: PCI slot number; passed when used as map_irq callback. Unused
102 * @pin: PCI irq pin number; passed when used as map_irq callback. Unused
103 *
104 * @slot and @pin are unused, but included in the function so that this
105 * function can be used directly as the map_irq callback to pci_fixup_irqs().
106 */
107int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
108{
109 struct of_phandle_args oirq;
110 int ret;
111
112 ret = of_irq_parse_pci(dev, &oirq);
113 if (ret) {
114 dev_err(&dev->dev, "of_irq_parse_pci() failed with rc=%d\n", ret);
115 return 0; /* Proper return code 0 == NO_IRQ */
116 }
117
118 return irq_create_of_mapping(&oirq);
119}
120EXPORT_SYMBOL_GPL(of_irq_parse_and_map_pci);
121
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 3a8d01ec50f7..07ddb3a13c6e 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -645,18 +645,6 @@ static int __init mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
645 return 1; 645 return 1;
646} 646}
647 647
648static int __init mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
649{
650 struct of_phandle_args oirq;
651 int ret;
652
653 ret = of_irq_parse_pci(dev, &oirq);
654 if (ret)
655 return ret;
656
657 return irq_create_of_mapping(&oirq);
658}
659
660static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys) 648static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
661{ 649{
662 struct mvebu_pcie *pcie = sys_to_pcie(sys); 650 struct mvebu_pcie *pcie = sys_to_pcie(sys);
@@ -705,7 +693,7 @@ static void __init mvebu_pcie_enable(struct mvebu_pcie *pcie)
705 hw.private_data = (void **)&pcie; 693 hw.private_data = (void **)&pcie;
706 hw.setup = mvebu_pcie_setup; 694 hw.setup = mvebu_pcie_setup;
707 hw.scan = mvebu_pcie_scan_bus; 695 hw.scan = mvebu_pcie_scan_bus;
708 hw.map_irq = mvebu_pcie_map_irq; 696 hw.map_irq = of_irq_parse_and_map_pci;
709 hw.ops = &mvebu_pcie_ops; 697 hw.ops = &mvebu_pcie_ops;
710 hw.align_resource = mvebu_pcie_align_resource; 698 hw.align_resource = mvebu_pcie_align_resource;
711 699