svn commit: r230050 - in head/sys/dev/usb: . controller

Hans Petter Selasky hselasky at FreeBSD.org
Fri Jan 13 07:28:35 UTC 2012


Author: hselasky
Date: Fri Jan 13 07:28:34 2012
New Revision: 230050
URL: http://svn.freebsd.org/changeset/base/230050

Log:
  Correct use of USB 3.0 POWER bit in the port status register,
  hence it was overlapping the USB 3.0 root HUB's speed bits.
  
  Reported by:	Kohji Okuno
  MFC after:	1 week

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

Modified: head/sys/dev/usb/controller/xhci.c
==============================================================================
--- head/sys/dev/usb/controller/xhci.c	Fri Jan 13 07:19:02 2012	(r230049)
+++ head/sys/dev/usb/controller/xhci.c	Fri Jan 13 07:28:34 2012	(r230050)
@@ -3194,8 +3194,13 @@ xhci_roothub_exec(struct usb_device *ude
 			i |= UPS_OVERCURRENT_INDICATOR;
 		if (v & XHCI_PS_PR)
 			i |= UPS_RESET;
-		if (v & XHCI_PS_PP)
-			i |= UPS_PORT_POWER_SS;
+		if (v & XHCI_PS_PP) {
+			/*
+			 * The USB 3.0 RH is using the
+			 * USB 2.0's power bit
+			 */
+			i |= UPS_PORT_POWER;
+		}
 		USETW(sc->sc_hub_desc.ps.wPortStatus, i);
 
 		i = 0;

Modified: head/sys/dev/usb/usb_hub.c
==============================================================================
--- head/sys/dev/usb/usb_hub.c	Fri Jan 13 07:19:02 2012	(r230049)
+++ head/sys/dev/usb/usb_hub.c	Fri Jan 13 07:28:34 2012	(r230050)
@@ -327,6 +327,7 @@ uhub_reattach_port(struct uhub_softc *sc
 	enum usb_dev_speed speed;
 	enum usb_hc_mode mode;
 	usb_error_t err;
+	uint16_t power_mask;
 	uint8_t timeout;
 
 	DPRINTF("reattaching port %d\n", portno);
@@ -373,20 +374,22 @@ repeat:
 	case USB_SPEED_HIGH:
 	case USB_SPEED_FULL:
 	case USB_SPEED_LOW:
-		if (!(sc->sc_st.port_status & UPS_PORT_POWER)) {
-			DPRINTF("WARNING: strange, connected port %d "
-			    "has no power\n", portno);
-		}
+		power_mask = UPS_PORT_POWER;
 		break;
 	case USB_SPEED_SUPER:
-		if (!(sc->sc_st.port_status & UPS_PORT_POWER_SS)) {
-			DPRINTF("WARNING: strange, connected port %d "
-			    "has no power\n", portno);
-		}
+		if (udev->parent_hub == NULL)
+			power_mask = UPS_PORT_POWER;
+		else
+			power_mask = UPS_PORT_POWER_SS;
 		break;
 	default:
+		power_mask = 0;
 		break;
 	}
+	if (!(sc->sc_st.port_status & power_mask)) {
+		DPRINTF("WARNING: strange, connected port %d "
+		    "has no power\n", portno);
+	}
 
 	/* check if the device is in Host Mode */
 


More information about the svn-src-all mailing list