Skip to contentSkip to conversation

PCI: qcom: Make sure PCIe is reset before init for rev 2.1.0

PATCH Applied Ansuel Smith 4 participants 4 messages Sep 1, 2020 – Sep 7, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: qcom: Make sure PCIe is reset before init for rev 2.1.0

Qsdk U-Boot can incorrectly leave the PCIe interface in an undefined state if bootm command is used instead of bootipq. This is caused by the not deinit of PCIe when bootm is called. Reset the PCIe before init anyway to fix this U-Boot bug.

Fixes 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver")
Cc [email protected] # v4.19+
---
 drivers/pci/controller/dwc/pcie-qcom.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +13 -0
index 3aac77a295ba..82336bbaf8dc 100644
@@ -302,6 +302,9 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie)
 	reset_control_assert(res->por_reset);
 	reset_control_assert(res->ext_reset);
 	reset_control_assert(res->phy_reset);
+
+	writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL);
+
 	regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
 }
 
@@ -314,6 +317,16 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
 	u32 val;
 	int ret;
 
+	/* reset the PCIe interface as uboot can leave it undefined state */
+	reset_control_assert(res->pci_reset);
+	reset_control_assert(res->axi_reset);
+	reset_control_assert(res->ahb_reset);
+	reset_control_assert(res->por_reset);
+	reset_control_assert(res->ext_reset);
+	reset_control_assert(res->phy_reset);
+
+	writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL);
+
 	ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies);
 	if (ret < 0) {
 		dev_err(dev, "cannot enable regulators\n");
Signature · 1 line
2.27.0
maintainer
#1 lore raw

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag fixing commit: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver").

The bot has tested the following trees: v5.8.5, v5.4.61, v4.19.142, v4.14.195, v4.9.234.

v5.8.5: Failed to apply! Possible dependencies:
8b6f0330b5f9 ("PCI: qcom: Add missing ipq806x clocks in PCIe driver") dd58318c019f ("PCI: qcom: Change duplicate PCI reset to phy reset") ee367e2cdd22 ("PCI: qcom: Add missing reset for ipq806x")

v5.4.61: Failed to apply! Possible dependencies:
8b6f0330b5f9 ("PCI: qcom: Add missing ipq806x clocks in PCIe driver") dd58318c019f ("PCI: qcom: Change duplicate PCI reset to phy reset") ee367e2cdd22 ("PCI: qcom: Add missing reset for ipq806x")

v4.19.142: Failed to apply! Possible dependencies:
8b6f0330b5f9 ("PCI: qcom: Add missing ipq806x clocks in PCIe driver") dd58318c019f ("PCI: qcom: Change duplicate PCI reset to phy reset") ee367e2cdd22 ("PCI: qcom: Add missing reset for ipq806x")

v4.14.195: Failed to apply! Possible dependencies:
68e7c15ceb8d ("PCI: qcom: Use regulator bulk api for apq8064 supplies") 8b6f0330b5f9 ("PCI: qcom: Add missing ipq806x clocks in PCIe driver") dd58318c019f ("PCI: qcom: Change duplicate PCI reset to phy reset") ee367e2cdd22 ("PCI: qcom: Add missing reset for ipq806x")

v4.9.234: Failed to apply! Possible dependencies:
19ce01cc8cbc ("PCI: dwc: all: Rename cfg_read/cfg_write to read/write") 1d77040bde2d ("PCI: layerscape: Add LS1046a support")
1f6c4501c667 ("PCI: dra7xx: Group PHY API invocations")
442ec4c04d12 ("PCI: dwc: all: Split struct pcie_port into host-only and core structures") 5d76117f070d ("PCI: qcom: Add support for IPQ8074 PCIe controller") 68e7c15ceb8d ("PCI: qcom: Use regulator bulk api for apq8064 supplies") 90d52d57ccac ("PCI: qcom: Add support for IPQ4019 PCIe controller") 9bcf0a6fdc50 ("PCI: dwc: all: Use platform_set_drvdata() to save private data") ab5fe4f4d31e ("PCI: dra7xx: Add support to force RC to work in GEN1 mode") b8f2a8565603 ("PCI: qcom: Limit TLP size to 2K to work around hardware issue") d0491fc39bdd ("PCI: qcom: Add support for MSM8996 PCIe controller") deff11f884f0 ("PCI: qcom: Use block IP version for operations") e594233803aa ("PCI: layerscape: Remove redundant error message from ls_pcie_probe()") ebe85a44aad4 ("PCI: dra7xx: Enable MSI and legacy interrupts simultaneously") ee367e2cdd22 ("PCI: qcom: Add missing reset for ipq806x")

NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

Signature · 2 lines
Thanks
Sasha
Reviewed-by on v1 1/1
#2 lore raw
In reply to Ansuel Smith
Quoted 5 lines · Ansuel Smith

Qsdk U-Boot can incorrectly leave the PCIe interface in an undefined state if bootm command is used instead of bootipq. This is caused by the not deinit of PCIe when bootm is called. Reset the PCIe before init anyway to fix this U-Boot bug.

Looks sensible.

Regards,
Bjorn

Quoted 41 lines
Fixes 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver")
Cc [email protected] # v4.19+
---
 drivers/pci/controller/dwc/pcie-qcom.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +13 -0
index 3aac77a295ba..82336bbaf8dc 100644
@@ -302,6 +302,9 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie)
 	reset_control_assert(res->por_reset);
 	reset_control_assert(res->ext_reset);
 	reset_control_assert(res->phy_reset);
+
+	writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL);
+
 	regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
 }
 
@@ -314,6 +317,16 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
 	u32 val;
 	int ret;
 
+	/* reset the PCIe interface as uboot can leave it undefined state */
+	reset_control_assert(res->pci_reset);
+	reset_control_assert(res->axi_reset);
+	reset_control_assert(res->ahb_reset);
+	reset_control_assert(res->por_reset);
+	reset_control_assert(res->ext_reset);
+	reset_control_assert(res->phy_reset);
+
+	writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL);
+
 	ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies);
 	if (ret < 0) {
 		dev_err(dev, "cannot enable regulators\n");
Signature · 1 line
2.27.0
#3 lore raw
In reply to Ansuel Smith
Quoted 11 lines · Ansuel Smith

Qsdk U-Boot can incorrectly leave the PCIe interface in an undefined state if bootm command is used instead of bootipq. This is caused by the not deinit of PCIe when bootm is called. Reset the PCIe before init anyway to fix this U-Boot bug.

Fixes 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver")
Cc [email protected] # v4.19+
---
 drivers/pci/controller/dwc/pcie-qcom.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Applied to pci/qcom, thanks.

Lorenzo

Quoted 34 lines
drivers/pci/controller/dwc/pcie-qcom.c +13 -0
index 3aac77a295ba..82336bbaf8dc 100644
@@ -302,6 +302,9 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie)
 	reset_control_assert(res->por_reset);
 	reset_control_assert(res->ext_reset);
 	reset_control_assert(res->phy_reset);
+
+	writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL);
+
 	regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
 }
 
@@ -314,6 +317,16 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
 	u32 val;
 	int ret;
 
+	/* reset the PCIe interface as uboot can leave it undefined state */
+	reset_control_assert(res->pci_reset);
+	reset_control_assert(res->axi_reset);
+	reset_control_assert(res->ahb_reset);
+	reset_control_assert(res->por_reset);
+	reset_control_assert(res->ext_reset);
+	reset_control_assert(res->phy_reset);
+
+	writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL);
+
 	ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies);
 	if (ret < 0) {
 		dev_err(dev, "cannot enable regulators\n");
Signature · 1 line
2.27.0