imx6: backport IMX6DL DVFS support from 3.15
[openwrt.git] / target / linux / imx6 / patches-3.14 / 0060-pci_designware_use-new-OF-interrupt-mapping-when-possible.patch
1 commit 62fe03d1dd629a98c6da86cabb2a98b85e89d516
2 Author: Lucas Stach <l.stach@pengutronix.de>
3 Date:   Wed Mar 5 14:25:51 2014 +0100
4
5     PCI: designware: use new OF interrupt mapping when possible
6     
7     This is the recommended method of doing the IRQ
8     mapping. For old devicetrees we fall back to the
9     previous practice.
10     
11     Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
12     Acked-by: Arnd Bergmann <arnd@arndb.de>
13     Acked-by: Jingoo Han <jg1.han@samsung.com>
14     Reviewed-by: Marek Vasut <marex@denx.de>
15
16 --- a/drivers/pci/host/pcie-designware.c
17 +++ b/drivers/pci/host/pcie-designware.c
18 @@ -17,6 +17,7 @@
19  #include <linux/module.h>
20  #include <linux/msi.h>
21  #include <linux/of_address.h>
22 +#include <linux/of_pci.h>
23  #include <linux/pci.h>
24  #include <linux/pci_regs.h>
25  #include <linux/types.h>
26 @@ -492,7 +493,7 @@ int __init dw_pcie_host_init(struct pcie
27         dw_pci.nr_controllers = 1;
28         dw_pci.private_data = (void **)&pp;
29  
30 -       pci_common_init(&dw_pci);
31 +       pci_common_init_dev(pp->dev, &dw_pci);
32         pci_assign_unassigned_resources();
33  #ifdef CONFIG_PCI_DOMAINS
34         dw_pci.domain++;
35 @@ -725,7 +726,7 @@ static struct pci_bus *dw_pcie_scan_bus(
36  
37         if (pp) {
38                 pp->root_bus_nr = sys->busnr;
39 -               bus = pci_scan_root_bus(NULL, sys->busnr, &dw_pcie_ops,
40 +               bus = pci_scan_root_bus(pp->dev, sys->busnr, &dw_pcie_ops,
41                                         sys, &sys->resources);
42         } else {
43                 bus = NULL;
44 @@ -738,8 +739,13 @@ static struct pci_bus *dw_pcie_scan_bus(
45  static int dw_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
46  {
47         struct pcie_port *pp = sys_to_pcie(dev->bus->sysdata);
48 +       int irq;
49  
50 -       return pp->irq;
51 +       irq = of_irq_parse_and_map_pci(dev, slot, pin);
52 +       if (!irq)
53 +               irq = pp->irq;
54 +
55 +       return irq;
56  }
57  
58  static void dw_pcie_add_bus(struct pci_bus *bus)