From owner-svn-src-all@FreeBSD.ORG Thu Oct 24 06:06:20 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 211FE1F9; Thu, 24 Oct 2013 06:06:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F2CBF2B9E; Thu, 24 Oct 2013 06:06:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O66JJ5031929; Thu, 24 Oct 2013 06:06:19 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O66HXB031913; Thu, 24 Oct 2013 06:06:17 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201310240606.r9O66HXB031913@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 24 Oct 2013 06:06:17 +0000 (UTC) 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 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 06:06:20 -0000 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: