Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Feb 2017 20:02:40 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r313649 - stable/11/sys/dev/usb/controller
Message-ID:  <201702112002.v1BK2eAs045935@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sat Feb 11 20:02:39 2017
New Revision: 313649
URL: https://svnweb.freebsd.org/changeset/base/313649

Log:
  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).

Modified:
  stable/11/sys/dev/usb/controller/ehci_imx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/controller/ehci_imx.c
==============================================================================
--- stable/11/sys/dev/usb/controller/ehci_imx.c	Sat Feb 11 18:10:55 2017	(r313648)
+++ stable/11/sys/dev/usb/controller/ehci_imx.c	Sat Feb 11 20:02:39 2017	(r313649)
@@ -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", 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702112002.v1BK2eAs045935>