]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PCI: designware: add memory barrier after enabling region
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Thu, 3 Dec 2015 13:35:20 +0000 (15:35 +0200)
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Mon, 11 Jan 2016 09:54:03 +0000 (09:54 +0000)
Add 'write memory' barrier after enable region in PCIE_ATU_CR2
register. The barrier is needed to ensure that the region enable
request has been reached it's destination at time when we
read/write to PCI configuration space.

Without this barrier PCI device enumeration during kernel boot
is not reliable, and reading configuration space for particular
PCI device on the bus returns zero aka no device.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
drivers/pci/host/pcie-designware.c

index 02a7452bdf235cf52731b3a822066c27d33e8a76..ed4dc2e2553bb9394b346667dedf4ce8d0805ebe 100644 (file)
@@ -164,6 +164,11 @@ static void dw_pcie_prog_outbound_atu(struct pcie_port *pp, int index,
        dw_pcie_writel_rc(pp, upper_32_bits(pci_addr), PCIE_ATU_UPPER_TARGET);
        dw_pcie_writel_rc(pp, type, PCIE_ATU_CR1);
        dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
+       /*
+        * ensure that the ATU enable has been happaned before accessing
+        * pci configuration/io spaces through dw_pcie_cfg_[read|write].
+        */
+       wmb();
 }
 
 static struct irq_chip dw_msi_irq_chip = {