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

Hans Petter Selasky hselasky at FreeBSD.org
Tue Feb 23 18:17:02 UTC 2016


Author: hselasky
Date: Tue Feb 23 18:17:01 2016
New Revision: 295928
URL: https://svnweb.freebsd.org/changeset/base/295928

Log:
  Configure the correct bMaxPacketSize for control endpoints before
  requesting the initial complete device descriptor and not as part of
  the subsequent babble error recovery. Babble means that the received
  USB packet was bigger than than configured maximum packet size. This
  only affects enumeration of FULL speed USB devices which use a
  bMaxPacketSize different from 8 bytes. This patch might help fix
  enumeration of USB devices which exhibit USB I/O errors in dmesg
  during boot.
  
  MFC after:	1 week

Modified:
  head/sys/dev/usb/controller/xhci.c
  head/sys/dev/usb/controller/xhci.h

Modified: head/sys/dev/usb/controller/xhci.c
==============================================================================
--- head/sys/dev/usb/controller/xhci.c	Tue Feb 23 17:53:39 2016	(r295927)
+++ head/sys/dev/usb/controller/xhci.c	Tue Feb 23 18:17:01 2016	(r295928)
@@ -2358,6 +2358,8 @@ xhci_configure_endpoint(struct usb_devic
 
 	/* store endpoint mode */
 	pepext->trb_ep_mode = ep_mode;
+	/* store bMaxPacketSize for control endpoints */
+	pepext->trb_ep_maxp = edesc->wMaxPacketSize[0];
 	usb_pc_cpu_flush(pepext->page_cache);
 
 	if (ep_mode == USB_EP_MODE_STREAMS) {
@@ -2904,6 +2906,17 @@ xhci_transfer_insert(struct usb_xfer *xf
 		return (USB_ERR_NOMEM);
 	}
 
+	/* check if bMaxPacketSize changed */
+	if (xfer->flags_int.control_xfr != 0 &&
+	    pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) {
+
+		DPRINTFN(8, "Reconfigure control endpoint\n");
+
+		/* force driver to reconfigure endpoint */
+		pepext->trb_halted = 1;
+		pepext->trb_running = 0;
+	}
+
 	/* check for stopped condition, after putting transfer on interrupt queue */
 	if (pepext->trb_running == 0) {
 		struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus);

Modified: head/sys/dev/usb/controller/xhci.h
==============================================================================
--- head/sys/dev/usb/controller/xhci.h	Tue Feb 23 17:53:39 2016	(r295927)
+++ head/sys/dev/usb/controller/xhci.h	Tue Feb 23 18:17:01 2016	(r295928)
@@ -383,6 +383,7 @@ struct xhci_endpoint_ext {
 	uint8_t			trb_halted;
 	uint8_t			trb_running;
 	uint8_t			trb_ep_mode;
+	uint8_t			trb_ep_maxp;
 };
 
 enum {


More information about the svn-src-head mailing list