linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: dwc: qcom: limit TPL size to 2K to fix hw issue
@ 2017-06-29 15:34 srinivas.kandagatla
  2017-07-02 21:42 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: srinivas.kandagatla @ 2017-06-29 15:34 UTC (permalink / raw)
  To: Stanimir Varbanov, Bjorn Helgaas
  Cc: linux-pci, linux-arm-msm, linux-kernel, Srinivas Kandagatla

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

This patch limits TPL size to 2K from default 4K size as a workaround
for a HW bug in v0 version of pcie IP. When using default TPL size of 4K
the internal buffer gets corrupted due to this HW 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>
---
 drivers/pci/dwc/pcie-qcom.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
index 5bf23d432fdb..28ba5192a21d 100644
--- a/drivers/pci/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c
@@ -51,6 +51,12 @@
 #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
@@ -357,6 +363,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:
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI: dwc: qcom: limit TPL size to 2K to fix hw issue
  2017-06-29 15:34 [PATCH] PCI: dwc: qcom: limit TPL size to 2K to fix hw issue srinivas.kandagatla
@ 2017-07-02 21:42 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2017-07-02 21:42 UTC (permalink / raw)
  To: srinivas.kandagatla
  Cc: Stanimir Varbanov, Bjorn Helgaas, linux-pci, linux-arm-msm, linux-kernel

On Thu, Jun 29, 2017 at 05:34:55PM +0200, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> This patch limits TPL size to 2K from default 4K size as a workaround
> for a HW bug in v0 version of pcie IP. When using default TPL size of 4K
> the internal buffer gets corrupted due to this HW 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>

Applied to pci/host-qcom for v4.13, thanks!

> ---
>  drivers/pci/dwc/pcie-qcom.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
> index 5bf23d432fdb..28ba5192a21d 100644
> --- a/drivers/pci/dwc/pcie-qcom.c
> +++ b/drivers/pci/dwc/pcie-qcom.c
> @@ -51,6 +51,12 @@
>  #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
> @@ -357,6 +363,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:
> -- 
> 2.11.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-02 21:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 15:34 [PATCH] PCI: dwc: qcom: limit TPL size to 2K to fix hw issue srinivas.kandagatla
2017-07-02 21:42 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).