[openwrt/openwrt] kernel: backport dwc pci enumeration fix

LEDE Commits lede-commits at lists.infradead.org
Mon Feb 19 00:33:42 PST 2018

blogic pushed a commit to openwrt/openwrt.git, branch master:

commit 3282e7189fb95af98db48f599cd6188455da8797
Author: Tim Harvey <tharvey at gateworks.com>
AuthorDate: Thu Feb 15 08:34:35 2018 -0800

    kernel: backport dwc pci enumeration fix
    Backport of:  http://patchwork.ozlabs.org/patch/860701/
    Signed-off-by: Tim Harvey <tharvey at gateworks.com>
    Tested-by: Koen Vandeputte <koen.vandeputte at ncentric.com>
 .../pending-4.14/812-pci-dwc-fix-enumeration.patch | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/target/linux/generic/pending-4.14/812-pci-dwc-fix-enumeration.patch b/target/linux/generic/pending-4.14/812-pci-dwc-fix-enumeration.patch
new file mode 100644
index 0000000..42985ef
--- /dev/null
+++ b/target/linux/generic/pending-4.14/812-pci-dwc-fix-enumeration.patch
@@ -0,0 +1,62 @@
+From patchwork Tue Jan  9 14:42:21 2018
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: PCI: dwc: fix enumeration end when reaching root subordinate
+From: Koen Vandeputte <koen.vandeputte at ncentric.com>
+X-Patchwork-Id: 10152443
+Message-Id: <1515508941-20055-1-git-send-email-koen.vandeputte at ncentric.com>
+To: linux-pci at vger.kernel.org
+Cc: bhelgaas at google.com, lorenzo.pieralisi at arm.com,
+ Joao.Pinto at synopsys.com, jingoohan1 at gmail.com, niklas.cassel at axis.com,
+ Koen Vandeputte <koen.vandeputte at ncentric.com>,
+ Mika Westerberg <mika.westerberg at linux.intel.com>
+Date: Tue,  9 Jan 2018 15:42:21 +0100
+The subordinate value indicates the highest bus number which can be
+reached downstream though a certain device.
+Commit a20c7f36bd3d ("PCI: Do not allocate more buses than available in
+ensures that downstream devices cannot assign busnumbers higher than the
+upstream device subordinate number, which was indeed illogical.
+By default, dw_pcie_setup_rc() inits the Root Complex subordinate to a
+value of 0x01.
+Due to this combined with above commit, enumeration stops digging deeper
+downstream as soon as bus num 0x01 has been assigned, which is always
+the case for a bridge device.
+This results in all devices behind a bridge bus to remain undetected, as
+these would be connected to bus 0x02 or higher.
+Fix this by initializing the RC to a subordinate value of 0xff, meaning
+that all busses [0x00-0xff] are reachable through this RC.
+Fixes: a20c7f36bd3d ("PCI: Do not allocate more buses than available in
+Signed-off-by: Koen Vandeputte <koen.vandeputte at ncentric.com>
+Tested-by: Niklas Cassel <niklas.cassel at axis.com>
+Cc: Mika Westerberg <mika.westerberg at linux.intel.com>
+Will send separate patches to stable as this file got moved/renamed
+ drivers/pci/dwc/pcie-designware-host.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+diff --git a/drivers/pci/dwc/pcie-designware-host.c b/drivers/pci/dwc/pcie-designware-host.c
+index bf558df5b7b3..2b5470173196 100644
+--- a/drivers/pci/dwc/pcie-designware-host.c
++++ b/drivers/pci/dwc/pcie-designware-host.c
+@@ -616,7 +616,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
+ 	/* setup bus numbers */
+ 	val = dw_pcie_readl_dbi(pci, PCI_PRIMARY_BUS);
+ 	val &= 0xff000000;
+-	val |= 0x00010100;
++	val |= 0x00ff0100;
+ 	dw_pcie_writel_dbi(pci, PCI_PRIMARY_BUS, val);
+ 	/* setup command register */

More information about the lede-commits mailing list