Skip to contentSkip to conversation

pci-dra7xx: Enable errata i870 workaround for RC mode

PATCH Applied Vignesh R 2 participants 4 messages Sep 25, 2018

Subsystems (4)
lore
Share & tools
lore

Vignesh R

author maintainer
#0 lore raw

v5 cover pci-dra7xx: Enable errata i870 workaround for RC mode

Make workaround for errata i870 applicable in Host mode as well(previously it was enabled only for EP mode) as per errata
documentation: http://www.ti.com/lit/er/sprz450/sprz450.pdf
Driver will continue to work with w/o applying errata in host mode when using older DT, to maintain backward compatibility.

Tested on DRA72 EVM

Changes since v4:
Fail driver probe if DT binding is absent for EP(as it is in current code)

Changes since v3:
Rebase onto latest next
Drop DT patches from this series. They will be sent separately once driver changes in this series is merged.

Changes since v2:
Reorder patch 2 to appear at the last.
Collect all the ACKs

Changes since v1:
Drop IRQ handling rework (will be sent out separately)

Vignesh R (2):
dt-bindings: PCI: dra7xx: Add bindings for unaligned access in host
mode
pci: dwc: pci-dra7xx: Enable errata i870 for both EP and RC mode

 Documentation/devicetree/bindings/pci/ti-pci.txt |  5 +++++
 drivers/pci/controller/dwc/pci-dra7xx.c          | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.19.0
author maintainer
#1 lore raw

PATCH v5 1/2 dt-bindings: PCI: dra7xx: Add bindings for unaligned access in host mode

Update device tree binding documentation of TI's dra7xx PCI controller for enabling unaligned mem access as applicable not just in EP mode but in host mode as well.

---
 Documentation/devicetree/bindings/pci/ti-pci.txt | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/pci/ti-pci.txt +5 -0
index 7f7af3044016..452fe48c4fdd 100644
@@ -26,6 +26,11 @@ HOST MODE
    ranges,
    interrupt-map-mask,
    interrupt-map : as specified in ../designware-pcie.txt
+ - ti,syscon-unaligned-access: phandle to the syscon DT node. The 1st argument
+			       should contain the register offset within syscon
+			       and the 2nd argument should contain the bit field
+			       for setting the bit to enable unaligned
+			       access.
 
 DEVICE MODE
 ===========
Signature · 1 line
2.19.0
author maintainer
#2 lore raw

PATCH v5 2/2 pci: dwc: pci-dra7xx: Enable errata i870 for both EP and RC mode

In reply to Vignesh R

Errata i870 is applicable in both EP and RC mode. Therefore rename function dra7xx_pcie_ep_unaligned_memaccess(), that implements errata workaround, to dra7xx_pcie_unaligned_memaccess() and call it for both RC and EP. Make sure driver probe does not fail in case workaround is not applied for RC mode so as to maintain DT backward compatibility.

---
 drivers/pci/controller/dwc/pci-dra7xx.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pci-dra7xx.c +8 -3
index ce9224a36f62..a32d6dde7a57 100644
@@ -542,7 +542,7 @@ static const struct of_device_id of_dra7xx_pcie_match[] = {
 };
 
 /*
- * dra7xx_pcie_ep_unaligned_memaccess: workaround for AM572x/AM571x Errata i870
+ * dra7xx_pcie_unaligned_memaccess: workaround for AM572x/AM571x Errata i870
  * @dra7xx: the dra7xx device where the workaround should be applied
  *
  * Access to the PCIe slave port that are not 32-bit aligned will result
@@ -552,7 +552,7 @@ static const struct of_device_id of_dra7xx_pcie_match[] = {
  *
  * To avoid this issue set PCIE_SS1_AXI2OCP_LEGACY_MODE_ENABLE to 1.
  */
-static int dra7xx_pcie_ep_unaligned_memaccess(struct device *dev)
+static int dra7xx_pcie_unaligned_memaccess(struct device *dev)
 {
 	int ret;
 	struct device_node *np = dev->of_node;
@@ -704,6 +704,11 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
 
 		dra7xx_pcie_writel(dra7xx, PCIECTRL_TI_CONF_DEVICE_TYPE,
 				   DEVICE_TYPE_RC);
+
+		ret = dra7xx_pcie_unaligned_memaccess(dev);
+		if (ret)
+			dev_err(dev, "WA for Errata i870 not applied\n");
+
 		ret = dra7xx_add_pcie_port(dra7xx, pdev);
 		if (ret < 0)
 			goto err_gpio;
@@ -717,7 +722,7 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
 		dra7xx_pcie_writel(dra7xx, PCIECTRL_TI_CONF_DEVICE_TYPE,
 				   DEVICE_TYPE_EP);
 
-		ret = dra7xx_pcie_ep_unaligned_memaccess(dev);
+		ret = dra7xx_pcie_unaligned_memaccess(dev);
 		if (ret)
 			goto err_gpio;
 
Signature · 1 line
2.19.0
#3 lore raw
In reply to Vignesh R
Quoted 25 lines · Vignesh R

Make workaround for errata i870 applicable in Host mode as well(previously it was enabled only for EP mode) as per errata
documentation: http://www.ti.com/lit/er/sprz450/sprz450.pdf
Driver will continue to work with w/o applying errata in host mode when using older DT, to maintain backward compatibility.

Tested on DRA72 EVM

Changes since v4:
Fail driver probe if DT binding is absent for EP(as it is in current code)

Changes since v3:
Rebase onto latest next
Drop DT patches from this series. They will be sent separately once driver changes in this series is merged.

Changes since v2:
Reorder patch 2 to appear at the last.
Collect all the ACKs

Changes since v1:
Drop IRQ handling rework (will be sent out separately)

Quoted 8 lines

Vignesh R (2):
dt-bindings: PCI: dra7xx: Add bindings for unaligned access in host
mode
pci: dwc: pci-dra7xx: Enable errata i870 for both EP and RC mode

 Documentation/devicetree/bindings/pci/ti-pci.txt |  5 +++++
 drivers/pci/controller/dwc/pci-dra7xx.c          | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

Applied to pci/dwc for v4.20, thanks.

Lorenzo