Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Oct 2013 06:06:17 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r257040 - in stable/9/sys: dev/usb dev/usb/controller mips/cavium/usb
Message-ID:  <201310240606.r9O66HXB031913@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Oct 24 06:06:17 2013
New Revision: 257040
URL: http://svnweb.freebsd.org/changeset/base/257040

Log:
  MFC r241082:
  Inherit USB mode from RootHUB port where the USB device is connected.
  Only RootHUB ports can be dual mode. Disallow OTG ports on external HUBs.
  This simplifies some checks in the USB controller drivers.

Modified:
  stable/9/sys/dev/usb/controller/at91dci.c
  stable/9/sys/dev/usb/controller/atmegadci.c
  stable/9/sys/dev/usb/controller/avr32dci.c
  stable/9/sys/dev/usb/controller/ehci.c
  stable/9/sys/dev/usb/controller/musb_otg.c
  stable/9/sys/dev/usb/controller/ohci.c
  stable/9/sys/dev/usb/controller/uhci.c
  stable/9/sys/dev/usb/controller/uss820dci.c
  stable/9/sys/dev/usb/controller/xhci.c
  stable/9/sys/dev/usb/usb_hub.c
  stable/9/sys/mips/cavium/usb/octusb.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/controller/at91dci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/at91dci.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/controller/at91dci.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -2277,10 +2277,6 @@ at91dci_ep_init(struct usb_device *udev,
 
 	if (udev->device_index != sc->sc_rt_addr) {
 
-		if (udev->flags.usb_mode != USB_MODE_DEVICE) {
-			/* not supported */
-			return;
-		}
 		if (udev->speed != USB_SPEED_FULL) {
 			/* not supported */
 			return;

Modified: stable/9/sys/dev/usb/controller/atmegadci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/atmegadci.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/controller/atmegadci.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -2110,10 +2110,6 @@ atmegadci_ep_init(struct usb_device *ude
 
 	if (udev->device_index != sc->sc_rt_addr) {
 
-		if (udev->flags.usb_mode != USB_MODE_DEVICE) {
-			/* not supported */
-			return;
-		}
 		if (udev->speed != USB_SPEED_FULL) {
 			/* not supported */
 			return;

Modified: stable/9/sys/dev/usb/controller/avr32dci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/avr32dci.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/controller/avr32dci.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -2054,10 +2054,6 @@ avr32dci_ep_init(struct usb_device *udev
 
 	if (udev->device_index != sc->sc_rt_addr) {
 
-		if (udev->flags.usb_mode != USB_MODE_DEVICE) {
-			/* not supported */
-			return;
-		}
 		if ((udev->speed != USB_SPEED_FULL) &&
 		    (udev->speed != USB_SPEED_HIGH)) {
 			/* not supported */

Modified: stable/9/sys/dev/usb/controller/ehci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/ehci.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/controller/ehci.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -3705,10 +3705,6 @@ ehci_ep_init(struct usb_device *udev, st
 	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_addr);
 
-	if (udev->flags.usb_mode != USB_MODE_HOST) {
-		/* not supported */
-		return;
-	}
 	if (udev->device_index != sc->sc_addr) {
 
 		if ((udev->speed != USB_SPEED_HIGH) &&

Modified: stable/9/sys/dev/usb/controller/musb_otg.c
==============================================================================
--- stable/9/sys/dev/usb/controller/musb_otg.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/controller/musb_otg.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -2746,10 +2746,6 @@ musbotg_ep_init(struct usb_device *udev,
 
 	if (udev->device_index != sc->sc_rt_addr) {
 
-		if (udev->flags.usb_mode != USB_MODE_DEVICE) {
-			/* not supported */
-			return;
-		}
 		if ((udev->speed != USB_SPEED_FULL) &&
 		    (udev->speed != USB_SPEED_HIGH)) {
 			/* not supported */

Modified: stable/9/sys/dev/usb/controller/ohci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/ohci.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/controller/ohci.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -2314,6 +2314,7 @@ ohci_roothub_exec(struct usb_device *ude
 		}
 		v = OREAD4(sc, OHCI_RH_PORT_STATUS(index));
 		DPRINTFN(9, "port status=0x%04x\n", v);
+		v &= ~UPS_PORT_MODE_DEVICE;	/* force host mode */
 		USETW(sc->sc_hub_desc.ps.wPortStatus, v);
 		USETW(sc->sc_hub_desc.ps.wPortChange, v >> 16);
 		len = sizeof(sc->sc_hub_desc.ps);
@@ -2550,10 +2551,6 @@ ohci_ep_init(struct usb_device *udev, st
 	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_addr);
 
-	if (udev->flags.usb_mode != USB_MODE_HOST) {
-		/* not supported */
-		return;
-	}
 	if (udev->device_index != sc->sc_addr) {
 		switch (edesc->bmAttributes & UE_XFERTYPE) {
 		case UE_CONTROL:

Modified: stable/9/sys/dev/usb/controller/uhci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/uhci.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/controller/uhci.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -3029,10 +3029,6 @@ uhci_ep_init(struct usb_device *udev, st
 	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_addr);
 
-	if (udev->flags.usb_mode != USB_MODE_HOST) {
-		/* not supported */
-		return;
-	}
 	if (udev->device_index != sc->sc_addr) {
 		switch (edesc->bmAttributes & UE_XFERTYPE) {
 		case UE_CONTROL:

Modified: stable/9/sys/dev/usb/controller/uss820dci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/uss820dci.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/controller/uss820dci.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -2331,10 +2331,6 @@ uss820dci_ep_init(struct usb_device *ude
 
 	if (udev->device_index != sc->sc_rt_addr) {
 
-		if (udev->flags.usb_mode != USB_MODE_DEVICE) {
-			/* not supported */
-			return;
-		}
 		if (udev->speed != USB_SPEED_FULL) {
 			/* not supported */
 			return;

Modified: stable/9/sys/dev/usb/controller/xhci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/xhci.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/controller/xhci.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -3742,10 +3742,6 @@ xhci_ep_init(struct usb_device *udev, st
 	DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n",
 	    ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode);
 
-	if (udev->flags.usb_mode != USB_MODE_HOST) {
-		/* not supported */
-		return;
-	}
 	if (udev->parent_hub == NULL) {
 		/* root HUB has special endpoint handling */
 		return;

Modified: stable/9/sys/dev/usb/usb_hub.c
==============================================================================
--- stable/9/sys/dev/usb/usb_hub.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/dev/usb/usb_hub.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -519,7 +519,10 @@ repeat:
 	 *
 	 * NOTE: This part is currently FreeBSD specific.
 	 */
-	if (sc->sc_st.port_status & UPS_PORT_MODE_DEVICE)
+	if (udev->parent_hub != NULL) {
+		/* inherit mode from the parent HUB */
+		mode = udev->parent_hub->flags.usb_mode;
+	} else if (sc->sc_st.port_status & UPS_PORT_MODE_DEVICE)
 		mode = USB_MODE_DEVICE;
 	else
 		mode = USB_MODE_HOST;

Modified: stable/9/sys/mips/cavium/usb/octusb.c
==============================================================================
--- stable/9/sys/mips/cavium/usb/octusb.c	Thu Oct 24 05:01:49 2013	(r257039)
+++ stable/9/sys/mips/cavium/usb/octusb.c	Thu Oct 24 06:06:17 2013	(r257040)
@@ -1851,10 +1851,6 @@ octusb_ep_init(struct usb_device *udev, 
 	    ep, udev->address, edesc->bEndpointAddress,
 	    udev->flags.usb_mode, sc->sc_addr);
 
-	if (udev->flags.usb_mode != USB_MODE_HOST) {
-		/* not supported */
-		return;
-	}
 	if (udev->device_index != sc->sc_addr) {
 		switch (edesc->bmAttributes & UE_XFERTYPE) {
 		case UE_CONTROL:



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