From patchwork Mon Apr 20 13:46:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 238104 List-Id: U-Boot discussion From: narmstrong at baylibre.com (Neil Armstrong) Date: Mon, 20 Apr 2020 15:46:01 +0200 Subject: [PATCH] usb: dwc3-meson-g12a: add power-on/off of the PHYs Message-ID: <20200420134601.19863-1-narmstrong@baylibre.com> Power on/off the PHYs to enable power to the USB ports, fixing USB support on Khadas VIM3/VIM3L boards. Signed-off-by: Neil Armstrong --- drivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index d4453f8784..8f4a2f3f82 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev) goto err_phy_init; } + for (i = 0 ; i < PHY_COUNT ; ++i) { + if (!priv->phys[i].dev) + continue; + + ret = generic_phy_power_on(&priv->phys[i]); + if (ret) + goto err_phy_init; + } + return 0; err_phy_init: @@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev) clk_release_all(&priv->clk, 1); + for (i = 0 ; i < PHY_COUNT ; ++i) { + if (!priv->phys[i].dev) + continue; + + generic_phy_power_off(&priv->phys[i]); + } + for (i = 0 ; i < PHY_COUNT ; ++i) { if (!priv->phys[i].dev) continue;