summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/controller/dwc_otg.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2012-09-27 15:45:24 +0000
committerhselasky <hselasky@FreeBSD.org>2012-09-27 15:45:24 +0000
commit52a6b7ce30ec585392dda7f2e15e64087a4335aa (patch)
tree8195ce1c562bef66d4f2cc1ffbff0a3f590c45f1 /sys/dev/usb/controller/dwc_otg.c
parentb3f5fac122016c5fb684531f1d9a0f948f8736b0 (diff)
downloadFreeBSD-src-52a6b7ce30ec585392dda7f2e15e64087a4335aa.zip
FreeBSD-src-52a6b7ce30ec585392dda7f2e15e64087a4335aa.tar.gz
Make sure the "wMaxPacketSize" limitations are respected.
Diffstat (limited to 'sys/dev/usb/controller/dwc_otg.c')
-rw-r--r--sys/dev/usb/controller/dwc_otg.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c
index d46d613..3086ae2 100644
--- a/sys/dev/usb/controller/dwc_otg.c
+++ b/sys/dev/usb/controller/dwc_otg.c
@@ -3974,9 +3974,34 @@ dwc_otg_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
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;
}
OpenPOWER on IntegriCloud