PCI: rockchip: dw: Move getting vpcie3v3 into rk_pcie_resource_get()

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Change-Id: I7fb17e48c7ee795454a0a15d0331ffeee4046c98
This commit is contained in:
Shawn Lin
2024-08-02 16:02:22 +08:00
committed by Tao Huang
parent 95a000fc6c
commit a7ee33c78d

View File

@@ -467,6 +467,7 @@ static int rk_pcie_resource_get(struct platform_device *pdev,
{
struct resource *dbi_base;
struct resource *apb_base;
u32 val = 0;
dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"pcie-dbi");
@@ -536,6 +537,23 @@ static int rk_pcie_resource_get(struct platform_device *pdev,
dev_info(&pdev->dev, "support hotplug-gpios!\n");
}
retry_regulator:
rk_pcie->vpcie3v3 = devm_regulator_get_optional(&pdev->dev, "vpcie3v3");
if (IS_ERR(rk_pcie->vpcie3v3)) {
if (PTR_ERR(rk_pcie->vpcie3v3) != -ENODEV) {
if (IS_ENABLED(CONFIG_PCIE_RK_THREADED_INIT)) {
/* Deferred but in threaded context for most 10s */
msleep(20);
if (++val < 500)
goto retry_regulator;
}
return PTR_ERR(rk_pcie->vpcie3v3);
}
dev_info(&pdev->dev, "no vpcie3v3 regulator found\n");
}
return 0;
}
@@ -1171,25 +1189,6 @@ static int rk_pcie_really_probe(void *p)
}
}
retry_regulator:
/* DON'T MOVE ME: must be enable before phy init */
rk_pcie->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3");
if (IS_ERR(rk_pcie->vpcie3v3)) {
if (PTR_ERR(rk_pcie->vpcie3v3) != -ENODEV) {
if (IS_ENABLED(CONFIG_PCIE_RK_THREADED_INIT)) {
/* Deferred but in threaded context for most 10s */
msleep(20);
if (++val < 500)
goto retry_regulator;
}
ret = PTR_ERR(rk_pcie->vpcie3v3);
goto release_driver;
}
dev_info(dev, "no vpcie3v3 regulator found\n");
}
ret = rk_pcie_enable_power(rk_pcie);
if (ret)
goto release_driver;