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
6 Commit 943ebae781f5 ("PCI: iproc: Add PAXC interface support") causes
7 regression on EP device detection on BCMA based platforms.
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).
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>
18 drivers/pci/host/pcie-iproc.c | 28 +++++++++++-----------------
19 1 file changed, 11 insertions(+), 17 deletions(-)
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));
27 -static inline bool iproc_pcie_device_is_valid(struct iproc_pcie *pcie,
34 - /* PAXC can only support limited number of functions */
35 - if (pcie->type == IPROC_PCIE_PAXC && fn >= MAX_NUM_PAXC_PF)
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_
48 - if (!iproc_pcie_device_is_valid(pcie, slot, fn))
51 /* root complex access */
53 + if (slot > 0 || fn > 0)
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);
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.
67 + if (pcie->type == IPROC_PCIE_PAXC)
68 + if (slot > 0 || fn >= MAX_NUM_PAXC_PF)
71 /* EP device access */
72 val = (busno << CFG_ADDR_BUS_NUM_SHIFT) |
73 (slot << CFG_ADDR_DEV_NUM_SHIFT) |