svn commit: r331421 - head/sys/dev/usb/controller

Andrew Turner andrew at FreeBSD.org
Fri Mar 23 11:08:59 UTC 2018


Author: andrew
Date: Fri Mar 23 11:08:59 2018
New Revision: 331421
URL: https://svnweb.freebsd.org/changeset/base/331421

Log:
  If sc->sc_ep_max is already set use it to find the number of RX and TX
  endpoints. The Allwinner driver will need to set this as the EPINFO
  register isn't useful there.
  
  Submitted by:	jmcneill
  Reviewed by:	hselasky
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D5881

Modified:
  head/sys/dev/usb/controller/musb_otg.c

Modified: head/sys/dev/usb/controller/musb_otg.c
==============================================================================
--- head/sys/dev/usb/controller/musb_otg.c	Fri Mar 23 09:42:47 2018	(r331420)
+++ head/sys/dev/usb/controller/musb_otg.c	Fri Mar 23 11:08:59 2018	(r331421)
@@ -3168,19 +3168,24 @@ musbotg_init(struct musbotg_softc *sc)
 
 	MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0);
 
-	/* read out number of endpoints */
+	if (sc->sc_ep_max == 0) {
+		/* read out number of endpoints */
 
-	nrx =
-	    (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16);
+		nrx =
+		    (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16);
 
-	ntx =
-	    (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16);
+		ntx =
+		    (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16);
 
+		sc->sc_ep_max = (nrx > ntx) ? nrx : ntx;
+	} else {
+		nrx = ntx = sc->sc_ep_max;
+	}
+
 	/* these numbers exclude the control endpoint */
 
 	DPRINTFN(2, "RX/TX endpoints: %u/%u\n", nrx, ntx);
 
-	sc->sc_ep_max = (nrx > ntx) ? nrx : ntx;
 	if (sc->sc_ep_max == 0) {
 		DPRINTFN(2, "ERROR: Looks like the clocks are off!\n");
 	}


More information about the svn-src-all mailing list