summaryrefslogtreecommitdiffstats
path: root/sys/arm/ti
diff options
context:
space:
mode:
authorloos <loos@FreeBSD.org>2016-09-27 16:06:01 +0000
committerloos <loos@FreeBSD.org>2016-09-27 16:06:01 +0000
commitd1d50495e8025860e310d73718e20fe8ef70bee9 (patch)
treee6bf0c0c99e5ee323a10a03222f777dd4086d878 /sys/arm/ti
parent5fd3ee3800dea576b7c74d1425f300348bd41039 (diff)
downloadFreeBSD-src-d1d50495e8025860e310d73718e20fe8ef70bee9.zip
FreeBSD-src-d1d50495e8025860e310d73718e20fe8ef70bee9.tar.gz
MFC r306050:
If present, honor the USB port mode (host or peripheral) set on DTS, if not, keep the beaglebone defaults: USB0 -> peripheral/gadget, USB1 -> host. This is only a workaround as in fact fact this hardware is capable of detect the USB port mode based on type of cable and act according with the detected mode. Unfortunately the driver does not handle that at moment. Sponsored by: Rubicon Communications, LLC (Netgate)
Diffstat (limited to 'sys/arm/ti')
-rw-r--r--sys/arm/ti/am335x/am335x_musb.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/arm/ti/am335x/am335x_musb.c b/sys/arm/ti/am335x/am335x_musb.c
index b92be0d..4dc96c3 100644
--- a/sys/arm/ti/am335x/am335x_musb.c
+++ b/sys/arm/ti/am335x/am335x_musb.c
@@ -237,6 +237,7 @@ static int
musbotg_attach(device_t dev)
{
struct musbotg_super_softc *sc = device_get_softc(dev);
+ char mode[16];
int err;
uint32_t reg;
@@ -308,10 +309,19 @@ musbotg_attach(device_t dev)
}
sc->sc_otg.sc_platform_data = sc;
- if (sc->sc_otg.sc_id == 0)
- sc->sc_otg.sc_mode = MUSB2_DEVICE_MODE;
- else
- sc->sc_otg.sc_mode = MUSB2_HOST_MODE;
+ if (OF_getprop(ofw_bus_get_node(dev), "dr_mode", mode,
+ sizeof(mode)) > 0) {
+ if (strcasecmp(mode, "host") == 0)
+ sc->sc_otg.sc_mode = MUSB2_HOST_MODE;
+ else
+ sc->sc_otg.sc_mode = MUSB2_DEVICE_MODE;
+ } else {
+ /* Beaglebone defaults: USB0 device, USB1 HOST. */
+ if (sc->sc_otg.sc_id == 0)
+ sc->sc_otg.sc_mode = MUSB2_DEVICE_MODE;
+ else
+ sc->sc_otg.sc_mode = MUSB2_HOST_MODE;
+ }
/*
* software-controlled function
OpenPOWER on IntegriCloud