summaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2020-01-06 04:33:59 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-09 11:15:31 +0100
commit28d190ac437c675763f03b17407ea16c1dd8c613 (patch)
tree4425f0ac261d3659fb4568e7722129a13c6a9410 /drivers/usb/phy
parent62a7f62891247e83b6a17cedae8f8ae15cff2c5e (diff)
downloadlinux-28d190ac437c675763f03b17407ea16c1dd8c613.tar.bz2
usb: phy: tegra: Clean up ulpi_phy_power_off
Firstly, the PHY's clock needs to unprepared to keep prepare count balanced. Secondly, downstream code suggests that reset is synchronous and thus it should be asserted before disabling clock. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-4-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy-tegra-usb.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index ea7ef1dc0b42..99acfde4ab8d 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -757,8 +757,19 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
static int ulpi_phy_power_off(struct tegra_usb_phy *phy)
{
- clk_disable(phy->clk);
- return gpio_direction_output(phy->reset_gpio, 0);
+ int err;
+
+ err = gpio_direction_output(phy->reset_gpio, 0);
+ if (err) {
+ dev_err(phy->u_phy.dev, "reset GPIO not asserted: %d\n", err);
+ return err;
+ }
+
+ usleep_range(5000, 6000);
+
+ clk_disable_unprepare(phy->clk);
+
+ return 0;
}
static void tegra_usb_phy_close(struct tegra_usb_phy *phy)