mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
pci: Make Rockchip PCIe voltage regulators optional
The vpcie*-supply properties are optional and these are absent on boards like the ROCKPro64 and Firefly RK3399 where the voltage is supplied by always-on regulators that are already enabled upon boot. Make these regulators optional and properly check their presence before attempting to enable them. Makes PCIe work on un U-Boot on the boards mentioned above. Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Tested-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
This commit is contained in:
parent
7e01363df3
commit
dbc5e28604
1 changed files with 20 additions and 13 deletions
|
@ -322,7 +322,7 @@ static int rockchip_pcie_set_vpcie(struct udevice *dev)
|
|||
struct rockchip_pcie *priv = dev_get_priv(dev);
|
||||
int ret;
|
||||
|
||||
if (!IS_ERR(priv->vpcie3v3)) {
|
||||
if (priv->vpcie3v3) {
|
||||
ret = regulator_set_enable(priv->vpcie3v3, true);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to enable vpcie3v3 (ret=%d)\n",
|
||||
|
@ -331,24 +331,31 @@ static int rockchip_pcie_set_vpcie(struct udevice *dev)
|
|||
}
|
||||
}
|
||||
|
||||
ret = regulator_set_enable(priv->vpcie1v8, true);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to enable vpcie1v8 (ret=%d)\n", ret);
|
||||
goto err_disable_3v3;
|
||||
if (priv->vpcie1v8) {
|
||||
ret = regulator_set_enable(priv->vpcie1v8, true);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to enable vpcie1v8 (ret=%d)\n",
|
||||
ret);
|
||||
goto err_disable_3v3;
|
||||
}
|
||||
}
|
||||
|
||||
ret = regulator_set_enable(priv->vpcie0v9, true);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to enable vpcie0v9 (ret=%d)\n", ret);
|
||||
goto err_disable_1v8;
|
||||
if (priv->vpcie0v9) {
|
||||
ret = regulator_set_enable(priv->vpcie0v9, true);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to enable vpcie0v9 (ret=%d)\n",
|
||||
ret);
|
||||
goto err_disable_1v8;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_disable_1v8:
|
||||
regulator_set_enable(priv->vpcie1v8, false);
|
||||
if (priv->vpcie1v8)
|
||||
regulator_set_enable(priv->vpcie1v8, false);
|
||||
err_disable_3v3:
|
||||
if (!IS_ERR(priv->vpcie3v3))
|
||||
if (priv->vpcie3v3)
|
||||
regulator_set_enable(priv->vpcie3v3, false);
|
||||
return ret;
|
||||
}
|
||||
|
@ -424,14 +431,14 @@ static int rockchip_pcie_parse_dt(struct udevice *dev)
|
|||
|
||||
ret = device_get_supply_regulator(dev, "vpcie1v8-supply",
|
||||
&priv->vpcie1v8);
|
||||
if (ret) {
|
||||
if (ret && ret != -ENOENT) {
|
||||
dev_err(dev, "failed to get vpcie1v8 supply (ret=%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = device_get_supply_regulator(dev, "vpcie0v9-supply",
|
||||
&priv->vpcie0v9);
|
||||
if (ret) {
|
||||
if (ret && ret != -ENOENT) {
|
||||
dev_err(dev, "failed to get vpcie0v9 supply (ret=%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue