19db40451d2ce3ea5656fbf250146f50b0fe1bb1
[openwrt/openwrt.git] / target / linux / imx6 / patches-3.14 / 0005-PCI-designware-Use-new-OF-interrupt-mapping-when-pos.patch
1 From 804f57b1a63c7435fe43b36942581cc6c79ebb5c Mon Sep 17 00:00:00 2001
2 From: Lucas Stach <l.stach@pengutronix.de>
3 Date: Wed, 5 Mar 2014 14:25:51 +0100
4 Subject: [PATCH] PCI: designware: Use new OF interrupt mapping when possible
5
6 Use new OF interrupt mapping (of_irq_parse_and_map_pci()) when possible.
7 This is the recommended method of doing the IRQ mapping. For old
8 devicetrees we fall back to the previous practice.
9
10 This makes INTB, INTC, and INTD work on i.MX.
11
12 Tested-by: Tim Harvey <tharvey@gateworks.com>
13 Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
14 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
15 Reviewed-by: Marek Vasut <marex@denx.de>
16 Acked-by: Arnd Bergmann <arnd@arndb.de>
17 Acked-by: Jingoo Han <jg1.han@samsung.com>
18 ---
19 drivers/pci/host/pcie-designware.c | 12 +++++++++---
20 1 file changed, 9 insertions(+), 3 deletions(-)
21
22 --- a/drivers/pci/host/pcie-designware.c
23 +++ b/drivers/pci/host/pcie-designware.c
24 @@ -17,6 +17,7 @@
25 #include <linux/module.h>
26 #include <linux/msi.h>
27 #include <linux/of_address.h>
28 +#include <linux/of_pci.h>
29 #include <linux/pci.h>
30 #include <linux/pci_regs.h>
31 #include <linux/types.h>
32 @@ -492,7 +493,7 @@ int __init dw_pcie_host_init(struct pcie
33 dw_pci.nr_controllers = 1;
34 dw_pci.private_data = (void **)&pp;
35
36 - pci_common_init(&dw_pci);
37 + pci_common_init_dev(pp->dev, &dw_pci);
38 pci_assign_unassigned_resources();
39 #ifdef CONFIG_PCI_DOMAINS
40 dw_pci.domain++;
41 @@ -725,7 +726,7 @@ static struct pci_bus *dw_pcie_scan_bus(
42
43 if (pp) {
44 pp->root_bus_nr = sys->busnr;
45 - bus = pci_scan_root_bus(NULL, sys->busnr, &dw_pcie_ops,
46 + bus = pci_scan_root_bus(pp->dev, sys->busnr, &dw_pcie_ops,
47 sys, &sys->resources);
48 } else {
49 bus = NULL;
50 @@ -738,8 +739,13 @@ static struct pci_bus *dw_pcie_scan_bus(
51 static int dw_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
52 {
53 struct pcie_port *pp = sys_to_pcie(dev->bus->sysdata);
54 + int irq;
55
56 - return pp->irq;
57 + irq = of_irq_parse_and_map_pci(dev, slot, pin);
58 + if (!irq)
59 + irq = pp->irq;
60 +
61 + return irq;
62 }
63
64 static void dw_pcie_add_bus(struct pci_bus *bus)