aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-06-23 08:26:11 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-01 17:31:12 -0400
commit765f5b830e547229bb752e7b232ee83e2b3d49d5 (patch)
treeffa37920a165fd3a964b7e0f333f6509d3e59de3 /drivers/usb/gadget/composite.c
parent193ab2a6070039e7ee2b9b9bebea754a7c52fd1b (diff)
usb: gadget: defer setting maxpacket till ->setup()
maxpacket is set by the udc driver for ep0 very early. This value is copied by the function gadget used later for the USB_DT_DEVICE and USB_DT_DEVICE_QUALIFIER query. This seems to work fine so far. For USB3 we need set a different value here. In SS speed it is 2^x with x=9 and in HS we set something <= 64. If the UDC starts in SS and continues in HS after the cable has been plugged it will report a too small value. There setting of this value is defered and taken automaticly from the ep0 pointer where the UDC driver can update it according to the speed it detected _after_ a cable has been plugged. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index c5abe270970a..5ef87794fd32 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -573,7 +573,7 @@ static void device_qual(struct usb_composite_dev *cdev)
573 qual->bDeviceSubClass = cdev->desc.bDeviceSubClass; 573 qual->bDeviceSubClass = cdev->desc.bDeviceSubClass;
574 qual->bDeviceProtocol = cdev->desc.bDeviceProtocol; 574 qual->bDeviceProtocol = cdev->desc.bDeviceProtocol;
575 /* ASSUME same EP0 fifo size at both speeds */ 575 /* ASSUME same EP0 fifo size at both speeds */
576 qual->bMaxPacketSize0 = cdev->desc.bMaxPacketSize0; 576 qual->bMaxPacketSize0 = cdev->gadget->ep0->maxpacket;
577 qual->bNumConfigurations = count_configs(cdev, USB_DT_DEVICE_QUALIFIER); 577 qual->bNumConfigurations = count_configs(cdev, USB_DT_DEVICE_QUALIFIER);
578 qual->bRESERVED = 0; 578 qual->bRESERVED = 0;
579} 579}
@@ -1450,7 +1450,6 @@ static int composite_bind(struct usb_gadget *gadget)
1450 goto fail; 1450 goto fail;
1451 1451
1452 cdev->desc = *composite->dev; 1452 cdev->desc = *composite->dev;
1453 cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
1454 1453
1455 /* standardized runtime overrides for device ID data */ 1454 /* standardized runtime overrides for device ID data */
1456 if (idVendor) 1455 if (idVendor)