From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 15:45:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B0C2D106566C; Thu, 27 Sep 2012 15:45:24 +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 9B39D8FC14; Thu, 27 Sep 2012 15:45:24 +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 q8RFjOf7046065; Thu, 27 Sep 2012 15:45:24 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RFjOED046063; Thu, 27 Sep 2012 15:45:24 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209271545.q8RFjOED046063@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 27 Sep 2012 15:45:24 +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: r240999 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 27 Sep 2012 15:45:24 -0000 Author: hselasky Date: Thu Sep 27 15:45:24 2012 New Revision: 240999 URL: http://svn.freebsd.org/changeset/base/240999 Log: Make sure the "wMaxPacketSize" limitations are respected. 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 Thu Sep 27 15:23:38 2012 (r240998) +++ head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 15:45:24 2012 (r240999) @@ -3974,9 +3974,34 @@ dwc_otg_ep_init(struct usb_device *udev, return; } } else { - if (udev->speed != USB_SPEED_LOW && - udev->speed != USB_SPEED_FULL && - udev->speed != USB_SPEED_HIGH) { + uint16_t mps; + + mps = UGETW(edesc->wMaxPacketSize); + + /* Apply limitations of our USB host driver */ + + switch (udev->speed) { + case USB_SPEED_HIGH: + if (mps > 512) { + DPRINTF("wMaxPacketSize=0x%04x" + "is not supported\n", (int)mps); + /* not supported */ + return; + } + break; + + case USB_SPEED_FULL: + case USB_SPEED_LOW: + if (mps > 188) { + DPRINTF("wMaxPacketSize=0x%04x" + "is not supported\n", (int)mps); + /* not supported */ + return; + } + break; + + default: + DPRINTF("Invalid device speed\n"); /* not supported */ return; }