bcm53xx: basic support for Seama format in sysupgrade
[oweals/openwrt.git] / target / linux / bcm53xx / patches-4.4 / 088-PCI-iproc-Fix-BCMA-PCIe-bus-scanning-regression.patch
1 From c43e4b52cbf2267047f67c9f65de18ee1ab8bfa2 Mon Sep 17 00:00:00 2001
2 From: Ray Jui <rjui@broadcom.com>
3 Date: Wed, 27 Jan 2016 16:52:24 -0600
4 Subject: [PATCH] PCI: iproc: Fix BCMA PCIe bus scanning regression
5
6 Commit 943ebae781f5 ("PCI: iproc: Add PAXC interface support") causes
7 regression on EP device detection on BCMA based platforms.
8
9 Fix the issue by allowing multiple devices to be configured on the same
10 bus, for all PAXB based child buses.  In addition, add a check to prevent
11 non-zero function from being used on bus 0 (root bus).
12
13 Fixes: 943ebae781f5 ("PCI: iproc: Add PAXC interface support")
14 Reported-by: Rafal Milecki <zajec5@gmail.com>
15 Signed-off-by: Ray Jui <rjui@broadcom.com>
16 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
17 ---
18  drivers/pci/host/pcie-iproc.c | 28 +++++++++++-----------------
19  1 file changed, 11 insertions(+), 17 deletions(-)
20
21 --- a/drivers/pci/host/pcie-iproc.c
22 +++ b/drivers/pci/host/pcie-iproc.c
23 @@ -170,20 +170,6 @@ static inline void iproc_pcie_ob_write(s
24         writel(val, pcie->base + offset + (window * 8));
25  }
26  
27 -static inline bool iproc_pcie_device_is_valid(struct iproc_pcie *pcie,
28 -                                             unsigned int slot,
29 -                                             unsigned int fn)
30 -{
31 -       if (slot > 0)
32 -               return false;
33 -
34 -       /* PAXC can only support limited number of functions */
35 -       if (pcie->type == IPROC_PCIE_PAXC && fn >= MAX_NUM_PAXC_PF)
36 -               return false;
37 -
38 -       return true;
39 -}
40 -
41  /**
42   * Note access to the configuration registers are protected at the higher layer
43   * by 'pci_lock' in drivers/pci/access.c
44 @@ -199,11 +185,11 @@ static void __iomem *iproc_pcie_map_cfg_
45         u32 val;
46         u16 offset;
47  
48 -       if (!iproc_pcie_device_is_valid(pcie, slot, fn))
49 -               return NULL;
50 -
51         /* root complex access */
52         if (busno == 0) {
53 +               if (slot > 0 || fn > 0)
54 +                       return NULL;
55 +
56                 iproc_pcie_write_reg(pcie, IPROC_PCIE_CFG_IND_ADDR,
57                                      where & CFG_IND_ADDR_MASK);
58                 offset = iproc_pcie_reg_offset(pcie, IPROC_PCIE_CFG_IND_DATA);
59 @@ -213,6 +199,14 @@ static void __iomem *iproc_pcie_map_cfg_
60                         return (pcie->base + offset);
61         }
62  
63 +       /*
64 +        * PAXC is connected to an internally emulated EP within the SoC.  It
65 +        * allows only one device and supports a limited number of functions.
66 +        */
67 +       if (pcie->type == IPROC_PCIE_PAXC)
68 +               if (slot > 0 || fn >= MAX_NUM_PAXC_PF)
69 +                       return NULL;
70 +
71         /* EP device access */
72         val = (busno << CFG_ADDR_BUS_NUM_SHIFT) |
73                 (slot << CFG_ADDR_DEV_NUM_SHIFT) |