2020-07-29 15:31:46

by Sivaprakash Murugesan

[permalink] [raw]
Subject: [PATCH V2 5/7] PCI: qcom: Do PHY power on before PCIe init

Commit cc1e06f033af ("phy: qcom: qmp: Use power_on/off ops for PCIe")
changed phy ops from init/deinit to power on/off, due to this phy enable
is getting called after PCIe init.

On some platforms like ipq8074 phy should be inited before accessing the
PCIe register space, otherwise the system would hang.

So move phy_power_on API before PCIe init.

Fixes: commit cc1e06f033af ("phy: qcom: qmp: Use power_on/off ops for PCIe")
Co-developed-by: Selvam Sathappan Periakaruppan <[email protected]>
Signed-off-by: Selvam Sathappan Periakaruppan <[email protected]>
Signed-off-by: Sivaprakash Murugesan <[email protected]>
---
drivers/pci/controller/dwc/pcie-qcom.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 3aac77a..e1b5651 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1265,18 +1265,18 @@ static int qcom_pcie_host_init(struct pcie_port *pp)

qcom_ep_reset_assert(pcie);

- ret = pcie->ops->init(pcie);
+ ret = phy_power_on(pcie->phy);
if (ret)
return ret;

- ret = phy_power_on(pcie->phy);
+ ret = pcie->ops->init(pcie);
if (ret)
- goto err_deinit;
+ goto err_disable_phy;

if (pcie->ops->post_init) {
ret = pcie->ops->post_init(pcie);
if (ret)
- goto err_disable_phy;
+ goto err_deinit;
}

dw_pcie_setup_rc(pp);
@@ -1295,10 +1295,10 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
qcom_ep_reset_assert(pcie);
if (pcie->ops->post_deinit)
pcie->ops->post_deinit(pcie);
-err_disable_phy:
- phy_power_off(pcie->phy);
err_deinit:
pcie->ops->deinit(pcie);
+err_disable_phy:
+ phy_power_off(pcie->phy);

return ret;
}
--
2.7.4


2020-08-23 16:45:00

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH V2 5/7] PCI: qcom: Do PHY power on before PCIe init

On 29-07-20, 21:00, Sivaprakash Murugesan wrote:
> Commit cc1e06f033af ("phy: qcom: qmp: Use power_on/off ops for PCIe")
> changed phy ops from init/deinit to power on/off, due to this phy enable
> is getting called after PCIe init.
>
> On some platforms like ipq8074 phy should be inited before accessing the
> PCIe register space, otherwise the system would hang.

Have you verified that this causes no regression on sdm845 and other
platforms?

> So move phy_power_on API before PCIe init.
>
> Fixes: commit cc1e06f033af ("phy: qcom: qmp: Use power_on/off ops for PCIe")

Is this a fix..? You are updating sequencing for a new platform

> Co-developed-by: Selvam Sathappan Periakaruppan <[email protected]>
> Signed-off-by: Selvam Sathappan Periakaruppan <[email protected]>
> Signed-off-by: Sivaprakash Murugesan <[email protected]>
> ---
> drivers/pci/controller/dwc/pcie-qcom.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index 3aac77a..e1b5651 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1265,18 +1265,18 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
>
> qcom_ep_reset_assert(pcie);
>
> - ret = pcie->ops->init(pcie);
> + ret = phy_power_on(pcie->phy);
> if (ret)
> return ret;
>
> - ret = phy_power_on(pcie->phy);
> + ret = pcie->ops->init(pcie);
> if (ret)
> - goto err_deinit;
> + goto err_disable_phy;
>
> if (pcie->ops->post_init) {
> ret = pcie->ops->post_init(pcie);
> if (ret)
> - goto err_disable_phy;
> + goto err_deinit;
> }
>
> dw_pcie_setup_rc(pp);
> @@ -1295,10 +1295,10 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
> qcom_ep_reset_assert(pcie);
> if (pcie->ops->post_deinit)
> pcie->ops->post_deinit(pcie);
> -err_disable_phy:
> - phy_power_off(pcie->phy);
> err_deinit:
> pcie->ops->deinit(pcie);
> +err_disable_phy:
> + phy_power_off(pcie->phy);
>
> return ret;
> }
> --
> 2.7.4

--
~Vinod