kernel: backport dwc pci enumeration fix
[openwrt/openwrt.git] / target / linux / generic / pending-4.14 / 812-pci-dwc-fix-enumeration.patch
1 From patchwork Tue Jan 9 14:42:21 2018
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 Subject: PCI: dwc: fix enumeration end when reaching root subordinate
6 From: Koen Vandeputte <koen.vandeputte@ncentric.com>
7 X-Patchwork-Id: 10152443
8 Message-Id: <1515508941-20055-1-git-send-email-koen.vandeputte@ncentric.com>
9 To: linux-pci@vger.kernel.org
10 Cc: bhelgaas@google.com, lorenzo.pieralisi@arm.com,
11 Joao.Pinto@synopsys.com, jingoohan1@gmail.com, niklas.cassel@axis.com,
12 Koen Vandeputte <koen.vandeputte@ncentric.com>,
13 Mika Westerberg <mika.westerberg@linux.intel.com>
14 Date: Tue, 9 Jan 2018 15:42:21 +0100
15
16 The subordinate value indicates the highest bus number which can be
17 reached downstream though a certain device.
18
19 Commit a20c7f36bd3d ("PCI: Do not allocate more buses than available in
20 parent")
21 ensures that downstream devices cannot assign busnumbers higher than the
22 upstream device subordinate number, which was indeed illogical.
23
24 By default, dw_pcie_setup_rc() inits the Root Complex subordinate to a
25 value of 0x01.
26
27 Due to this combined with above commit, enumeration stops digging deeper
28 downstream as soon as bus num 0x01 has been assigned, which is always
29 the case for a bridge device.
30
31 This results in all devices behind a bridge bus to remain undetected, as
32 these would be connected to bus 0x02 or higher.
33
34 Fix this by initializing the RC to a subordinate value of 0xff, meaning
35 that all busses [0x00-0xff] are reachable through this RC.
36
37 Fixes: a20c7f36bd3d ("PCI: Do not allocate more buses than available in
38 parent")
39 Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
40 Tested-by: Niklas Cassel <niklas.cassel@axis.com>
41 Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
42 ---
43
44 Will send separate patches to stable as this file got moved/renamed
45
46
47 drivers/pci/dwc/pcie-designware-host.c | 2 +-
48 1 file changed, 1 insertion(+), 1 deletion(-)
49
50 diff --git a/drivers/pci/dwc/pcie-designware-host.c b/drivers/pci/dwc/pcie-designware-host.c
51 index bf558df5b7b3..2b5470173196 100644
52 --- a/drivers/pci/dwc/pcie-designware-host.c
53 +++ b/drivers/pci/dwc/pcie-designware-host.c
54 @@ -616,7 +616,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
55 /* setup bus numbers */
56 val = dw_pcie_readl_dbi(pci, PCI_PRIMARY_BUS);
57 val &= 0xff000000;
58 - val |= 0x00010100;
59 + val |= 0x00ff0100;
60 dw_pcie_writel_dbi(pci, PCI_PRIMARY_BUS, val);
61
62 /* setup command register */