@@ -323,9 +323,11 @@ static int imx8mq_phy_power_on(struct phy *phy)
struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
int ret;
- ret = regulator_enable(imx_phy->vbus);
- if (ret)
- return ret;
+ if (imx_phy->vbus) {
+ ret = regulator_enable(imx_phy->vbus);
+ if (ret)
+ return ret;
+ }
return clk_prepare_enable(imx_phy->clk);
}
@@ -335,7 +337,8 @@ static int imx8mq_phy_power_off(struct phy *phy)
struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
clk_disable_unprepare(imx_phy->clk);
- regulator_disable(imx_phy->vbus);
+ if (imx_phy->vbus)
+ regulator_disable(imx_phy->vbus);
return 0;
}
@@ -392,8 +395,10 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev)
if (IS_ERR(imx_phy->phy))
return PTR_ERR(imx_phy->phy);
- imx_phy->vbus = devm_regulator_get(dev, "vbus");
- if (IS_ERR(imx_phy->vbus))
+ imx_phy->vbus = devm_regulator_get_optional(dev, "vbus");
+ if (PTR_ERR(imx_phy->vbus) == -ENODEV)
+ imx_phy->vbus = NULL;
+ else if (IS_ERR(imx_phy->vbus))
return dev_err_probe(dev, PTR_ERR(imx_phy->vbus), "failed to get vbus\n");
phy_set_drvdata(imx_phy->phy, imx_phy);
vbus-supply property is optional, so instead of allocating a dummy regulator make it pure optional. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> --- drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)