]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
PCI: qcom: Limit TLP size to 2K to work around hardware issue
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Thu, 29 Jun 2017 15:34:55 +0000 (17:34 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Sun, 2 Jul 2017 23:45:09 +0000 (18:45 -0500)
Limit TLP size to 2K to work around a hardware bug in the v0 version of
PCIe IP.  When using default TLP size of 4K, the internal buffer gets
corrupted due to this hardware bug.

This bug was originally noticed during ssh session between APQ8064-based
board and PC.  Network packets got corrupted randomly and terminated the ssh
session due to this bug.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/dwc/pcie-qcom.c

index fbc79a5274c60c6f8df9b48309d4d1d013fe2775..2a4a667548781f63b7977dcfcb0967b9774ac192 100644 (file)
 #define PCIE20_ELBI_SYS_CTRL                   0x04
 #define PCIE20_ELBI_SYS_CTRL_LT_ENABLE         BIT(0)
 
+#define PCIE20_AXI_MSTR_RESP_COMP_CTRL0                0x818
+#define CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K       0x4
+#define CFG_REMOTE_RD_REQ_BRIDGE_SIZE_4K       0x5
+#define PCIE20_AXI_MSTR_RESP_COMP_CTRL1                0x81c
+#define CFG_BRIDGE_SB_INIT                     BIT(0)
+
 #define PCIE20_CAP                             0x70
 
 #define PERST_DELAY_US                         1000
@@ -336,6 +342,13 @@ static int qcom_pcie_init_v0(struct qcom_pcie *pcie)
        /* wait for clock acquisition */
        usleep_range(1000, 1500);
 
+
+       /* Set the Max TLP size to 2K, instead of using default of 4K */
+       writel(CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K,
+              pci->dbi_base + PCIE20_AXI_MSTR_RESP_COMP_CTRL0);
+       writel(CFG_BRIDGE_SB_INIT,
+              pci->dbi_base + PCIE20_AXI_MSTR_RESP_COMP_CTRL1);
+
        return 0;
 
 err_deassert_ahb: