Browse Source

PCI: designware: Use new OF interrupt mapping when possible

Use new OF interrupt mapping (of_irq_parse_and_map_pci()) when possible.
This is the recommended method of doing the IRQ mapping.  For old
devicetrees we fall back to the previous practice.

This makes INTB, INTC, and INTD work on i.MX.

Tested-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Lucas Stach 11 years ago
parent
commit
f86b3e3927
1 changed files with 9 additions and 3 deletions
  1. 9 3
      drivers/pci/host/pcie-designware.c

+ 9 - 3
drivers/pci/host/pcie-designware.c

@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/msi.h>
 #include <linux/msi.h>
 #include <linux/of_address.h>
 #include <linux/of_address.h>
+#include <linux/of_pci.h>
 #include <linux/pci.h>
 #include <linux/pci.h>
 #include <linux/pci_regs.h>
 #include <linux/pci_regs.h>
 #include <linux/types.h>
 #include <linux/types.h>
@@ -490,7 +491,7 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
 	dw_pci.nr_controllers = 1;
 	dw_pci.nr_controllers = 1;
 	dw_pci.private_data = (void **)&pp;
 	dw_pci.private_data = (void **)&pp;
 
 
-	pci_common_init(&dw_pci);
+	pci_common_init_dev(pp->dev, &dw_pci);
 	pci_assign_unassigned_resources();
 	pci_assign_unassigned_resources();
 #ifdef CONFIG_PCI_DOMAINS
 #ifdef CONFIG_PCI_DOMAINS
 	dw_pci.domain++;
 	dw_pci.domain++;
@@ -723,7 +724,7 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
 
 
 	if (pp) {
 	if (pp) {
 		pp->root_bus_nr = sys->busnr;
 		pp->root_bus_nr = sys->busnr;
-		bus = pci_scan_root_bus(NULL, sys->busnr, &dw_pcie_ops,
+		bus = pci_scan_root_bus(pp->dev, sys->busnr, &dw_pcie_ops,
 					sys, &sys->resources);
 					sys, &sys->resources);
 	} else {
 	} else {
 		bus = NULL;
 		bus = NULL;
@@ -736,8 +737,13 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
 static int dw_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 static int dw_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 {
 {
 	struct pcie_port *pp = sys_to_pcie(dev->bus->sysdata);
 	struct pcie_port *pp = sys_to_pcie(dev->bus->sysdata);
+	int irq;
 
 
-	return pp->irq;
+	irq = of_irq_parse_and_map_pci(dev, slot, pin);
+	if (!irq)
+		irq = pp->irq;
+
+	return irq;
 }
 }
 
 
 static void dw_pcie_add_bus(struct pci_bus *bus)
 static void dw_pcie_add_bus(struct pci_bus *bus)