Message ID | 1514996874-14741-1-git-send-email-koen.vandeputte@ncentric.com |
---|---|
State | Superseded |
Headers | show |
Series | [LEDE-DEV] imx6: fix pcie scanning on boot | expand |
Some additional info on this: The issue is caused by the imx6 PCIe Root Complex which is not properly configured on boot. The subordinate should be set to 0xff (maximum bus nr that is reachable downstream) lspci -v: [ Node 3 | node-3 ] lspci -v 00:00.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0, IRQ 298 Memory at 01000000 (32-bit, non-prefetchable) [size=1M] Bus: primary=00, secondary=01, subordinate=01, sec-latency=0 ... The kernel patch mentioned in the patch limits downstream devices to the subord of the master, which in this case limits the busnr's to 1. This stops the scanning process as soon as busnr 1 is used (which is the assigned bus in the plx) After checking the reference manual, I've found a register which can be written during imx6 PCIe init to alter this value. Applying this patch shows this: lspci -v: [ Node 3 | node-3 ] lspci -v 00:00.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0, IRQ 298 Memory at 01000000 (32-bit, non-prefetchable) [size=1M] Bus: primary=00, secondary=01, subordinate=ff, sec-latency=0 ... PCIe bus scanning now shows that all devices are discovered again, and a huge amount of warnings & errors have vanished. I'll send patches to upstream kernel & u-boot to fix the BNR register value on reset, and provide a backport to LEDE. (from kernel patch) Koen
diff --git a/target/linux/imx6/patches-4.9/220-fix-pcie-scanning.patch b/target/linux/imx6/patches-4.9/220-fix-pcie-scanning.patch new file mode 100644 index 0000000..351ab30 --- /dev/null +++ b/target/linux/imx6/patches-4.9/220-fix-pcie-scanning.patch @@ -0,0 +1,32 @@ +Upstream commit ("PCI: Do not allocate more buses than available in parent") +limits the amount of busses being allocated upon scanning the PCIe bus. + +This breaks PCIe scanning on the Gateworks Ventana, causing no devices to be found. + +Temp fix this by basically reverting the upstream commit. + +https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=v4.9.74&id=9a4bf05126f42c2632729ab0da503021d74ed454 + + +--- a/drivers/pci/probe.c ++++ b/drivers/pci/probe.c +@@ -932,8 +932,7 @@ int pci_scan_bridge(struct pci_bus *bus, + child = pci_add_new_bus(bus, dev, max+1); + if (!child) + goto out; +- pci_bus_insert_busn_res(child, max+1, +- bus->busn_res.end); ++ pci_bus_insert_busn_res(child, max+1, 0xff); + } + max++; + buses = (buses & 0xff000000) +@@ -2138,9 +2137,6 @@ unsigned int pci_scan_child_bus(struct p + if (max - bus->busn_res.start < pci_hotplug_bus_size - 1) + max = bus->busn_res.start + pci_hotplug_bus_size - 1; + +- /* Do not allocate more buses than we have room left */ +- if (max > bus->busn_res.end) +- max = bus->busn_res.end; + } + + /*
Upstream commit "PCI: Do not allocate more buses than available in parent" limits the amount of busses being allocated upon scanning the PCIe bus. [1] This commit was introduced in kernel 4.9.71 This breaks PCIe scanning on the Gateworks Ventana, causing no devices to be found. Temp fix this by basically reverting the upstream commit. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux- stable.git/commit/?h=v4.9.74&id=9a4bf05126f42c2632729ab0da503021d74ed454 Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com> --- .../imx6/patches-4.9/220-fix-pcie-scanning.patch | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 target/linux/imx6/patches-4.9/220-fix-pcie-scanning.patch