rpcd: iwinfo plugin fixes
[openwrt.git] / target / linux / bcm53xx / patches-4.1 / 033-0001-PCI-iproc-enable-arm64-support-for-iProc-PCIe.patch
1 From db9d6d790968fd6df9faa7fa1f51967e05afd492 Mon Sep 17 00:00:00 2001
2 From: Ray Jui <rjui@broadcom.com>
3 Date: Mon, 27 Jul 2015 15:42:18 -0700
4 Subject: [PATCH 1/4] PCI: iproc: enable arm64 support for iProc PCIe
5
6 PCI: iproc: Add arm64 support
7
8 Add arm64 support to the iProc PCIe driver.
9
10 Note that on arm32, bus->sysdata points to the arm32-specific
11 pci_sys_data struct, and pci_sys_data.private_data contains the
12 iproc_pcie pointer. For arm64, there's nothing corresponding to
13 pci_sys_data, so we keep the iproc_pcie pointer directly in
14 bus->sysdata.
15
16 In addition, arm64 does IRQ mapping in pcibios_add_device(), so it
17 doesn't need pci_fixup_irqs() as arm32 does.
18
19 Signed-off-by: Ray Jui <rjui@broadcom.com>
20 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
21 Reviewed-by: Scott Branden <sbranden@broadcom.com>
22 Acked-by: Bjorn Helgaas <bhelgaas@google.com>
23 Signed-off-by: Olof Johansson <olof@lixom.net>
24 ---
25  drivers/pci/host/pcie-iproc.c | 27 ++++++++++++++++++++-------
26  drivers/pci/host/pcie-iproc.h |  4 +++-
27  2 files changed, 23 insertions(+), 8 deletions(-)
28
29 --- a/drivers/pci/host/pcie-iproc.c
30 +++ b/drivers/pci/host/pcie-iproc.c
31 @@ -58,9 +58,17 @@
32  #define SYS_RC_INTX_EN               0x330
33  #define SYS_RC_INTX_MASK             0xf
34  
35 -static inline struct iproc_pcie *sys_to_pcie(struct pci_sys_data *sys)
36 +static inline struct iproc_pcie *iproc_data(struct pci_bus *bus)
37  {
38 -       return sys->private_data;
39 +       struct iproc_pcie *pcie;
40 +#ifdef CONFIG_ARM
41 +       struct pci_sys_data *sys = bus->sysdata;
42 +
43 +       pcie = sys->private_data;
44 +#else
45 +       pcie = bus->sysdata;
46 +#endif
47 +       return pcie;
48  }
49  
50  /**
51 @@ -71,8 +79,7 @@ static void __iomem *iproc_pcie_map_cfg_
52                                             unsigned int devfn,
53                                             int where)
54  {
55 -       struct pci_sys_data *sys = bus->sysdata;
56 -       struct iproc_pcie *pcie = sys_to_pcie(sys);
57 +       struct iproc_pcie *pcie = iproc_data(bus);
58         unsigned slot = PCI_SLOT(devfn);
59         unsigned fn = PCI_FUNC(devfn);
60         unsigned busno = bus->number;
61 @@ -186,6 +193,7 @@ static void iproc_pcie_enable(struct ipr
62  int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
63  {
64         int ret;
65 +       void *sysdata;
66         struct pci_bus *bus;
67  
68         if (!pcie || !pcie->dev || !pcie->base)
69 @@ -205,10 +213,13 @@ int iproc_pcie_setup(struct iproc_pcie *
70  
71         iproc_pcie_reset(pcie);
72  
73 +#ifdef CONFIG_ARM
74         pcie->sysdata.private_data = pcie;
75 -
76 -       bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops,
77 -                                 &pcie->sysdata, res);
78 +       sysdata = &pcie->sysdata;
79 +#else
80 +       sysdata = pcie;
81 +#endif
82 +       bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, sysdata, res);
83         if (!bus) {
84                 dev_err(pcie->dev, "unable to create PCI root bus\n");
85                 ret = -ENOMEM;
86 @@ -226,7 +237,9 @@ int iproc_pcie_setup(struct iproc_pcie *
87  
88         pci_scan_child_bus(bus);
89         pci_assign_unassigned_bus_resources(bus);
90 +#ifdef CONFIG_ARM
91         pci_fixup_irqs(pci_common_swizzle, pcie->map_irq);
92 +#endif
93         pci_bus_add_devices(bus);
94  
95         return 0;
96 --- a/drivers/pci/host/pcie-iproc.h
97 +++ b/drivers/pci/host/pcie-iproc.h
98 @@ -21,7 +21,7 @@
99   * @dev: pointer to device data structure
100   * @base: PCIe host controller I/O register base
101   * @resources: linked list of all PCI resources
102 - * @sysdata: Per PCI controller data
103 + * @sysdata: Per PCI controller data (ARM-specific)
104   * @root_bus: pointer to root bus
105   * @phy: optional PHY device that controls the Serdes
106   * @irqs: interrupt IDs
107 @@ -29,7 +29,9 @@
108  struct iproc_pcie {
109         struct device *dev;
110         void __iomem *base;
111 +#ifdef CONFIG_ARM
112         struct pci_sys_data sysdata;
113 +#endif
114         struct pci_bus *root_bus;
115         struct phy *phy;
116         int irqs[IPROC_PCIE_MAX_NUM_IRQS];