Skip to content

Commit d3745e3

Browse files
Mani-Sadhasivamkwilczynski
authored andcommitted
PCI: qcom-ep: Enable controller resources like PHY only after refclk is available
qcom_pcie_enable_resources() is called by qcom_pcie_ep_probe() and it enables the controller resources like clocks, regulator, PHY. On one of the new unreleased Qcom SoC, PHY enablement depends on the active refclk. And on all of the supported Qcom endpoint SoCs, refclk comes from the host (RC). So calling qcom_pcie_enable_resources() without refclk causes the NoC (Network On Chip) error in the endpoint SoC and in turn results in a whole SoC crash and rebooting into EDL (Emergency Download) mode which is an unrecoverable state. But qcom_pcie_enable_resources() is already called by qcom_pcie_perst_deassert() when PERST# is deasserted, and refclk is available at that time. Hence, remove the unnecessary call to qcom_pcie_enable_resources() from qcom_pcie_ep_probe() to prevent the above mentioned crash. It should be noted that this commit prevents the crash only under normal working condition (booting endpoint before host), but the crash may also occur if PERST# assert happens at the wrong time. For avoiding the crash completely, it is recommended to use SRIS mode which allows the endpoint SoC to generate its own refclk. The driver is not supporting SRIS mode currently, but will be added in the future. Fixes: 869bc52 ("PCI: dwc: ep: Fix DBI access failure for drivers requiring refclk from host") Link: https://lore.kernel.org/linux-pci/[email protected] Tested-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]>
1 parent 10ba085 commit d3745e3

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/pci/controller/dwc/pcie-qcom-ep.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -857,21 +857,15 @@ static int qcom_pcie_ep_probe(struct platform_device *pdev)
857857
if (ret)
858858
return ret;
859859

860-
ret = qcom_pcie_enable_resources(pcie_ep);
861-
if (ret) {
862-
dev_err(dev, "Failed to enable resources: %d\n", ret);
863-
return ret;
864-
}
865-
866860
ret = dw_pcie_ep_init(&pcie_ep->pci.ep);
867861
if (ret) {
868862
dev_err(dev, "Failed to initialize endpoint: %d\n", ret);
869-
goto err_disable_resources;
863+
return ret;
870864
}
871865

872866
ret = qcom_pcie_ep_enable_irq_resources(pdev, pcie_ep);
873867
if (ret)
874-
goto err_disable_resources;
868+
goto err_ep_deinit;
875869

876870
name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
877871
if (!name) {
@@ -888,8 +882,8 @@ static int qcom_pcie_ep_probe(struct platform_device *pdev)
888882
disable_irq(pcie_ep->global_irq);
889883
disable_irq(pcie_ep->perst_irq);
890884

891-
err_disable_resources:
892-
qcom_pcie_disable_resources(pcie_ep);
885+
err_ep_deinit:
886+
dw_pcie_ep_deinit(&pcie_ep->pci.ep);
893887

894888
return ret;
895889
}

0 commit comments

Comments
 (0)