usb: phy: tegra: Use generic stub for a missing VBUS regulator

Regulator core provides dummy regulator if device-tree doesn't define VBUS
regulator.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200106013416.9604-10-digetx@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dmitry Osipenko 2020-01-06 04:34:05 +03:00 committed by Greg Kroah-Hartman
parent b07e5f863f
commit 9df3adca0b
1 changed files with 9 additions and 19 deletions

View File

@ -836,9 +836,7 @@ static void tegra_usb_phy_shutdown(struct usb_phy *u_phy)
if (!phy->is_ulpi_phy) if (!phy->is_ulpi_phy)
utmip_pad_close(phy); utmip_pad_close(phy);
if (!IS_ERR(phy->vbus)) regulator_disable(phy->vbus);
regulator_disable(phy->vbus);
clk_disable_unprepare(phy->pll_u); clk_disable_unprepare(phy->pll_u);
phy->freq = NULL; phy->freq = NULL;
@ -900,14 +898,11 @@ static int tegra_usb_phy_init(struct usb_phy *u_phy)
goto fail; goto fail;
} }
if (!IS_ERR(phy->vbus)) { err = regulator_enable(phy->vbus);
err = regulator_enable(phy->vbus); if (err) {
if (err) { dev_err(phy->u_phy.dev,
dev_err(phy->u_phy.dev, "Failed to enable USB VBUS regulator: %d\n", err);
"Failed to enable USB VBUS regulator: %d\n", goto fail;
err);
goto fail;
}
} }
if (phy->is_ulpi_phy) if (phy->is_ulpi_phy)
@ -1140,14 +1135,9 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
} }
/* On some boards, the VBUS regulator doesn't need to be controlled */ /* On some boards, the VBUS regulator doesn't need to be controlled */
if (of_find_property(np, "vbus-supply", NULL)) { tegra_phy->vbus = devm_regulator_get(&pdev->dev, "vbus");
tegra_phy->vbus = devm_regulator_get(&pdev->dev, "vbus"); if (IS_ERR(tegra_phy->vbus))
if (IS_ERR(tegra_phy->vbus)) return PTR_ERR(tegra_phy->vbus);
return PTR_ERR(tegra_phy->vbus);
} else {
dev_notice(&pdev->dev, "no vbus regulator");
tegra_phy->vbus = ERR_PTR(-ENODEV);
}
tegra_phy->pll_u = devm_clk_get(&pdev->dev, "pll_u"); tegra_phy->pll_u = devm_clk_get(&pdev->dev, "pll_u");
err = PTR_ERR_OR_ZERO(tegra_phy->pll_u); err = PTR_ERR_OR_ZERO(tegra_phy->pll_u);