812-pci-dwc-fix-enumeration.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 <[email protected]>
  7. X-Patchwork-Id: 10152443
  8. Message-Id: <[email protected]>
  9. To: [email protected]
  10. Cc: [email protected], [email protected],
  11. [email protected], [email protected], [email protected],
  12. Koen Vandeputte <[email protected]>,
  13. Mika Westerberg <[email protected]>
  14. Date: Tue, 9 Jan 2018 15:42:21 +0100
  15. The subordinate value indicates the highest bus number which can be
  16. reached downstream though a certain device.
  17. Commit a20c7f36bd3d ("PCI: Do not allocate more buses than available in
  18. parent")
  19. ensures that downstream devices cannot assign busnumbers higher than the
  20. upstream device subordinate number, which was indeed illogical.
  21. By default, dw_pcie_setup_rc() inits the Root Complex subordinate to a
  22. value of 0x01.
  23. Due to this combined with above commit, enumeration stops digging deeper
  24. downstream as soon as bus num 0x01 has been assigned, which is always
  25. the case for a bridge device.
  26. This results in all devices behind a bridge bus to remain undetected, as
  27. these would be connected to bus 0x02 or higher.
  28. Fix this by initializing the RC to a subordinate value of 0xff, meaning
  29. that all busses [0x00-0xff] are reachable through this RC.
  30. Fixes: a20c7f36bd3d ("PCI: Do not allocate more buses than available in
  31. parent")
  32. Signed-off-by: Koen Vandeputte <[email protected]>
  33. Tested-by: Niklas Cassel <[email protected]>
  34. Cc: Mika Westerberg <[email protected]>
  35. ---
  36. Will send separate patches to stable as this file got moved/renamed
  37. drivers/pci/dwc/pcie-designware-host.c | 2 +-
  38. 1 file changed, 1 insertion(+), 1 deletion(-)
  39. --- a/drivers/pci/dwc/pcie-designware-host.c
  40. +++ b/drivers/pci/dwc/pcie-designware-host.c
  41. @@ -607,7 +607,7 @@ void dw_pcie_setup_rc(struct pcie_port *
  42. /* setup bus numbers */
  43. val = dw_pcie_readl_dbi(pci, PCI_PRIMARY_BUS);
  44. val &= 0xff000000;
  45. - val |= 0x00010100;
  46. + val |= 0x00ff0100;
  47. dw_pcie_writel_dbi(pci, PCI_PRIMARY_BUS, val);
  48. /* setup command register */