From owner-svn-src-head@FreeBSD.ORG Mon Oct 1 05:42:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DCBF10658C9; Mon, 1 Oct 2012 05:42:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0752B8FC1A; Mon, 1 Oct 2012 05:42:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q915gh3H089400; Mon, 1 Oct 2012 05:42:43 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q915gh6H089388; Mon, 1 Oct 2012 05:42:43 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201210010542.q915gh6H089388@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 1 Oct 2012 05:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241082 - in head/sys: dev/usb dev/usb/controller mips/cavium/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2012 05:42:44 -0000 Author: hselasky Date: Mon Oct 1 05:42:43 2012 New Revision: 241082 URL: http://svn.freebsd.org/changeset/base/241082 Log: 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. MFC after: 1 week Modified: head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/avr32dci.c head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/usb_hub.c head/sys/mips/cavium/usb/octusb.c Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/controller/at91dci.c Mon Oct 1 05:42:43 2012 (r241082) @@ -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: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/controller/atmegadci.c Mon Oct 1 05:42:43 2012 (r241082) @@ -2112,10 +2112,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: head/sys/dev/usb/controller/avr32dci.c ============================================================================== --- head/sys/dev/usb/controller/avr32dci.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/controller/avr32dci.c Mon Oct 1 05:42:43 2012 (r241082) @@ -2056,10 +2056,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: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/controller/ehci.c Mon Oct 1 05:42:43 2012 (r241082) @@ -3701,10 +3701,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: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/controller/musb_otg.c Mon Oct 1 05:42:43 2012 (r241082) @@ -2748,10 +2748,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: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/controller/ohci.c Mon Oct 1 05:42:43 2012 (r241082) @@ -2315,6 +2315,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); @@ -2551,10 +2552,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: head/sys/dev/usb/controller/uhci.c ============================================================================== --- head/sys/dev/usb/controller/uhci.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/controller/uhci.c Mon Oct 1 05:42:43 2012 (r241082) @@ -3030,10 +3030,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: head/sys/dev/usb/controller/uss820dci.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/controller/uss820dci.c Mon Oct 1 05:42:43 2012 (r241082) @@ -2333,10 +2333,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: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/controller/xhci.c Mon Oct 1 05:42:43 2012 (r241082) @@ -3712,10 +3712,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: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/dev/usb/usb_hub.c Mon Oct 1 05:42:43 2012 (r241082) @@ -518,7 +518,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: head/sys/mips/cavium/usb/octusb.c ============================================================================== --- head/sys/mips/cavium/usb/octusb.c Mon Oct 1 05:15:13 2012 (r241081) +++ head/sys/mips/cavium/usb/octusb.c Mon Oct 1 05:42:43 2012 (r241082) @@ -1860,10 +1860,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: