Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions drivers/pci/controller/dwc/pcie-qcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1308,13 +1308,17 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp)
if (ret)
goto err_deinit;

ret = pci_pwrctrl_create_devices(pci->dev);
if (ret)
goto err_disable_phy;
if (!pci->suspended) {
ret = pci_pwrctrl_create_devices(pci->dev);
if (ret)
goto err_disable_phy;
}

ret = pci_pwrctrl_power_on_devices(pci->dev);
if (ret)
goto err_pwrctrl_destroy;
if (!pp->skip_pwrctrl_off) {
ret = pci_pwrctrl_power_on_devices(pci->dev);
if (ret)
goto err_pwrctrl_destroy;
}

if (pcie->cfg->ops->post_init) {
ret = pcie->cfg->ops->post_init(pcie);
Expand Down Expand Up @@ -1356,11 +1360,14 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp *pp)

qcom_pcie_perst_assert(pcie);

/*
* No need to destroy pwrctrl devices as this function only gets called
* during system suspend as of now.
*/
pci_pwrctrl_power_off_devices(pci->dev);
if (!pci->pp.skip_pwrctrl_off) {
/*
* No need to destroy pwrctrl devices as this function only gets called
* during system suspend as of now.
*/
pci_pwrctrl_power_off_devices(pci->dev);
}

qcom_pcie_phy_power_off(pcie);
pcie->cfg->ops->deinit(pcie);
}
Expand Down Expand Up @@ -2050,11 +2057,16 @@ static int qcom_pcie_resume_noirq(struct device *dev)
ret = icc_enable(pcie->icc_mem);
if (ret) {
dev_err(dev, "Failed to enable PCIe-MEM interconnect path: %d\n", ret);
return ret;
goto disable_icc_cpu;
}

/*
* Ignore -ENODEV & -EIO here since it is expected when no endpoint is
* connected to the PCIe link.
*/
ret = dw_pcie_resume_noirq(pcie->pci);
if (ret && (ret != -ETIMEDOUT))
return ret;
if (ret && ret != -ENODEV && ret != -EIO)
goto disable_icc_mem;
} else {
if (pm_suspend_target_state != PM_SUSPEND_MEM) {
ret = icc_enable(pcie->icc_cpu);
Expand All @@ -2069,6 +2081,12 @@ static int qcom_pcie_resume_noirq(struct device *dev)
qcom_pcie_icc_opp_update(pcie);

return 0;
disable_icc_mem:
icc_disable(pcie->icc_mem);
disable_icc_cpu:
icc_disable(pcie->icc_cpu);

return ret;
}

static const struct of_device_id qcom_pcie_match[] = {
Expand Down