Date: Tue, 5 Jan 2016 09:18:44 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293192 - head/sys/dev/usb/controller Message-ID: <201601050918.u059IiBY058930@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Tue Jan 5 09:18:43 2016 New Revision: 293192 URL: https://svnweb.freebsd.org/changeset/base/293192 Log: Fix for directly connected FULL or LOW speed USB devices. Found by: Sebastian Huber <sebastian.huber@embedded-brains.de> MFC after: 1 week Modified: head/sys/dev/usb/controller/dwc_otg.c Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Tue Jan 5 08:10:06 2016 (r293191) +++ head/sys/dev/usb/controller/dwc_otg.c Tue Jan 5 09:18:43 2016 (r293192) @@ -456,6 +456,18 @@ dwc_otg_init_fifo(struct dwc_otg_softc * return (0); } +static uint8_t +dwc_otg_uses_split(struct usb_device *udev) +{ + /* + * When a LOW or FULL speed device is connected directly to + * the USB port we don't use split transactions: + */ + return (udev->speed != USB_SPEED_HIGH && + udev->parent_hs_hub != NULL && + udev->parent_hs_hub->parent_hub != NULL); +} + static void dwc_otg_update_host_frame_interval(struct dwc_otg_softc *sc) { @@ -3329,16 +3341,16 @@ dwc_otg_setup_standard_chain(struct usb_ else hcchar |= (td->ep_type << HCCHAR_EPTYPE_SHIFT); - if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_LOW) - hcchar |= HCCHAR_LSPDDEV; if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) hcchar |= HCCHAR_EPDIR_IN; switch (xfer->xroot->udev->speed) { - case USB_SPEED_FULL: case USB_SPEED_LOW: + hcchar |= HCCHAR_LSPDDEV; + /* FALLTHROUGH */ + case USB_SPEED_FULL: /* check if root HUB port is running High Speed */ - if (xfer->xroot->udev->parent_hs_hub != NULL) { + if (dwc_otg_uses_split(xfer->xroot->udev)) { hcsplt = HCSPLT_SPLTENA | (xfer->xroot->udev->hs_port_no << HCSPLT_PRTADDR_SHIFT) | @@ -4160,7 +4172,10 @@ dwc_otg_device_isoc_start(struct usb_xfe framenum = DSTS_SOFFN_GET(temp); } - if (xfer->xroot->udev->parent_hs_hub != NULL) + /* + * Check if port is doing 8000 or 1000 frames per second: + */ + if (sc->sc_flags.status_high_speed) framenum /= 8; framenum &= DWC_OTG_FRAME_MASK; @@ -4837,7 +4852,7 @@ dwc_otg_xfer_setup(struct usb_setup_para td = USB_ADD_BYTES(parm->buf, parm->size[0]); /* compute shared bandwidth resource index for TT */ - if (parm->udev->parent_hs_hub != NULL && parm->udev->speed != USB_SPEED_HIGH) { + if (dwc_otg_uses_split(parm->udev)) { if (parm->udev->parent_hs_hub->ddesc.bDeviceProtocol == UDPROTO_HSHUBMTT) td->tt_index = parm->udev->device_index; else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601050918.u059IiBY058930>