0051-PCI-designware-Ensure-ATU-is-enabled-before-IO-conf-.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 7f434723cdb6823443330cd4847d5c3b8dd30bd7 Mon Sep 17 00:00:00 2001
  2. From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
  3. Date: Fri, 18 Dec 2015 14:38:55 +0200
  4. Subject: [PATCH 51/70] PCI: designware: Ensure ATU is enabled before IO/conf
  5. space accesses
  6. Read back the ATU CR2 register to ensure ATU programming is effective
  7. before any subsequent I/O or config space accesses.
  8. Without this, PCI device enumeration is unreliable.
  9. [bhelgaas: changelog, comment]
  10. Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
  11. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  12. Acked-by: Pratyush Anand <pratyush.anand@gmail.com>
  13. ---
  14. drivers/pci/host/pcie-designware.c | 8 ++++++++
  15. 1 file changed, 8 insertions(+)
  16. --- a/drivers/pci/host/pcie-designware.c
  17. +++ b/drivers/pci/host/pcie-designware.c
  18. @@ -154,6 +154,8 @@ static int dw_pcie_wr_own_conf(struct pc
  19. static void dw_pcie_prog_outbound_atu(struct pcie_port *pp, int index,
  20. int type, u64 cpu_addr, u64 pci_addr, u32 size)
  21. {
  22. + u32 val;
  23. +
  24. dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | index,
  25. PCIE_ATU_VIEWPORT);
  26. dw_pcie_writel_rc(pp, lower_32_bits(cpu_addr), PCIE_ATU_LOWER_BASE);
  27. @@ -164,6 +166,12 @@ static void dw_pcie_prog_outbound_atu(st
  28. dw_pcie_writel_rc(pp, upper_32_bits(pci_addr), PCIE_ATU_UPPER_TARGET);
  29. dw_pcie_writel_rc(pp, type, PCIE_ATU_CR1);
  30. dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
  31. +
  32. + /*
  33. + * Make sure ATU enable takes effect before any subsequent config
  34. + * and I/O accesses.
  35. + */
  36. + dw_pcie_readl_rc(pp, PCIE_ATU_CR2, &val);
  37. }
  38. static struct irq_chip dw_msi_irq_chip = {