diff options
author | jmcneill <jmcneill@FreeBSD.org> | 2016-05-26 10:50:39 +0000 |
---|---|---|
committer | jmcneill <jmcneill@FreeBSD.org> | 2016-05-26 10:50:39 +0000 |
commit | 2a73bea3e85f63f9fd282e143b4ae8c337e8899e (patch) | |
tree | 4fa7a2aecd4e011a04db8b26b8ffbd36eecdc86e /sys/dev/usb/controller | |
parent | 94f6bdd76a69dca4f62f4b772cb38a22159e8087 (diff) | |
download | FreeBSD-src-2a73bea3e85f63f9fd282e143b4ae8c337e8899e.zip FreeBSD-src-2a73bea3e85f63f9fd282e143b4ae8c337e8899e.tar.gz |
Enable USB PHY regulators when requested by the host controller driver.
Previously the USB PHY driver would enable all regulators at attach time.
This prevented boards from booting when powered by the USB OTG port, as
it didn't take VBUS presence into consideration.
Diffstat (limited to 'sys/dev/usb/controller')
-rw-r--r-- | sys/dev/usb/controller/generic_ohci.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/dev/usb/controller/generic_ohci.c b/sys/dev/usb/controller/generic_ohci.c index 5d00c52..9656c8f 100644 --- a/sys/dev/usb/controller/generic_ohci.c +++ b/sys/dev/usb/controller/generic_ohci.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #ifdef EXT_RESOURCES #include <dev/extres/clk/clk.h> #include <dev/extres/hwreset/hwreset.h> +#include <dev/extres/phy/phy.h> #endif #include "generic_usb_if.h" @@ -76,6 +77,7 @@ struct generic_ohci_softc { #ifdef EXT_RESOURCES hwreset_t rst; + phy_t phy; TAILQ_HEAD(, clk_list) clk_list; #endif }; @@ -180,6 +182,15 @@ generic_ohci_attach(device_t dev) goto error; } } + + /* Enable phy */ + if (phy_get_by_ofw_name(dev, "usb", &sc->phy) == 0) { + err = phy_enable(dev, sc->phy); + if (err != 0) { + device_printf(dev, "Could not enable phy\n"); + goto error; + } + } #endif if (GENERIC_USB_INIT(dev) != 0) { @@ -253,6 +264,14 @@ generic_ohci_detach(device_t dev) usb_bus_mem_free_all(&sc->ohci_sc.sc_bus, &ohci_iterate_hw_softc); #ifdef EXT_RESOURCES + /* Disable phy */ + if (sc->phy) { + err = phy_disable(dev, sc->phy); + if (err != 0) + device_printf(dev, "Could not disable phy\n"); + phy_release(sc->phy); + } + /* Disable clock */ TAILQ_FOREACH_SAFE(clk, &sc->clk_list, next, clk_tmp) { err = clk_disable(clk->clk); |