diff options
author | ian <ian@FreeBSD.org> | 2017-02-11 20:02:39 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2017-02-11 20:02:39 +0000 |
commit | 3f18b64fed139907ee6e58712c75b95adb2173ee (patch) | |
tree | 1b4d43e2879cafef97542880408b7a9a1c82ee56 /sys/dev/usb/controller/ehci_imx.c | |
parent | 2f90047bce7ecbc5d94c29e91fbee08aa4212dbc (diff) | |
download | FreeBSD-src-3f18b64fed139907ee6e58712c75b95adb2173ee.zip FreeBSD-src-3f18b64fed139907ee6e58712c75b95adb2173ee.tar.gz |
MFC r311850:
Use the post-reset hook to force the controller to host mode. This will
make both usb ports work on imx6 systems (the OTG port of course will only
work in host mode).
Diffstat (limited to 'sys/dev/usb/controller/ehci_imx.c')
-rw-r--r-- | sys/dev/usb/controller/ehci_imx.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/dev/usb/controller/ehci_imx.c b/sys/dev/usb/controller/ehci_imx.c index 07f7310..df4d202 100644 --- a/sys/dev/usb/controller/ehci_imx.c +++ b/sys/dev/usb/controller/ehci_imx.c @@ -157,6 +157,18 @@ struct imx_ehci_softc { struct resource *ehci_irq_res; /* EHCI core IRQ. */ }; +static void +imx_ehci_post_reset(struct ehci_softc *ehci_softc) +{ + uint32_t usbmode; + + /* Force HOST mode */ + usbmode = EOREAD4(ehci_softc, EHCI_USBMODE_NOLPM); + usbmode &= ~EHCI_UM_CM; + usbmode |= EHCI_UM_CM_HOST; + EOWRITE4(ehci_softc, EHCI_USBMODE_NOLPM, usbmode); +} + static int imx_ehci_probe(device_t dev) { @@ -282,8 +294,13 @@ imx_ehci_attach(device_t dev) esc->sc_id_vendor = USB_VENDOR_FREESCALE; strlcpy(esc->sc_vendor, "Freescale", sizeof(esc->sc_vendor)); - /* Set flags that affect ehci_init() behavior. */ - esc->sc_flags |= EHCI_SCFLG_DONTRESET | EHCI_SCFLG_NORESTERM; + /* + * Set flags that affect ehci_init() behavior, and hook our post-reset + * code into the standard controller code. + */ + esc->sc_flags |= EHCI_SCFLG_NORESTERM; + esc->sc_vendor_post_reset = imx_ehci_post_reset; + err = ehci_init(esc); if (err != 0) { device_printf(dev, "USB init failed, usb_err_t=%d\n", |