mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
PCI: imx6: Move pci_pwrctrl_create_devices() to imx_pcie_probe()
Previously, pci_pwrctrl_create_devices() was placed in imx_pcie_host_init(), which is the .init callback of dw_pcie_host_ops. This callback is invoked not only during probe, but also during resume. This caused pci_pwrctrl_create_devices() to be called multiple times across suspend/resume cycles, which is unnecessary since the pwrctrl devices only need to be created once. Move pci_pwrctrl_create_devices() to imx_pcie_probe() so that it is only called once during probe, similar to other regulator_get calls. Signed-off-by: Sherry Sun <sherry.sun@nxp.com> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260713023435.235765-2-sherry.sun@oss.nxp.com
This commit is contained in:
parent
7f4d9901eb
commit
2c5768344f
|
|
@ -1382,16 +1382,10 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
|
|||
}
|
||||
}
|
||||
|
||||
ret = pci_pwrctrl_create_devices(dev);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to create pwrctrl devices\n");
|
||||
goto err_reg_disable;
|
||||
}
|
||||
|
||||
ret = pci_pwrctrl_power_on_devices(dev);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to power on pwrctrl devices\n");
|
||||
goto err_pwrctrl_destroy;
|
||||
goto err_reg_disable;
|
||||
}
|
||||
|
||||
ret = imx_pcie_clk_enable(imx_pcie);
|
||||
|
|
@ -1461,9 +1455,6 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
|
|||
imx_pcie_clk_disable(imx_pcie);
|
||||
err_pwrctrl_power_off:
|
||||
pci_pwrctrl_power_off_devices(dev);
|
||||
err_pwrctrl_destroy:
|
||||
if (ret != -EPROBE_DEFER)
|
||||
pci_pwrctrl_destroy_devices(dev);
|
||||
err_reg_disable:
|
||||
if (imx_pcie->vpcie)
|
||||
regulator_disable(imx_pcie->vpcie);
|
||||
|
|
@ -1954,11 +1945,15 @@ static int imx_pcie_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pci_pwrctrl_create_devices(dev);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to create pwrctrl devices\n");
|
||||
|
||||
pci->use_parent_dt_ranges = true;
|
||||
if (imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE) {
|
||||
ret = imx_add_pcie_ep(imx_pcie, pdev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto err_pwrctrl_destroy;
|
||||
|
||||
/*
|
||||
* FIXME: Only single Device (EPF) is supported due to the
|
||||
|
|
@ -1973,7 +1968,7 @@ static int imx_pcie_probe(struct platform_device *pdev)
|
|||
pci->pp.use_atu_msg = true;
|
||||
ret = dw_pcie_host_init(&pci->pp);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto err_pwrctrl_destroy;
|
||||
|
||||
if (pci_msi_enabled()) {
|
||||
u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI);
|
||||
|
|
@ -1985,6 +1980,11 @@ static int imx_pcie_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_pwrctrl_destroy:
|
||||
if (ret != -EPROBE_DEFER)
|
||||
pci_pwrctrl_destroy_devices(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void imx_pcie_shutdown(struct platform_device *pdev)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user