[U-Boot] [u-boot 34/40] usb: gadget: defer setting maxpacket till ->setup()
Lukasz Majewski
l.majewski at samsung.com
Mon Feb 16 12:44:11 CET 2015
Hi Kishon,
> Taken from linux kernel with commit
> commit 765f5b830e547229bb752e7b232ee83e2b3d49d5
> Author: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
> Date: Thu Jun 23 14:26:11 2011 +0200
>
> usb: gadget: defer setting maxpacket till ->setup()
>
> Signed-off-by: Kishon Vijay Abraham I <kishon at ti.com>
> ---
> drivers/usb/gadget/composite.c | 4 +++-
> drivers/usb/gadget/ether.c | 2 +-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/composite.c
> b/drivers/usb/gadget/composite.c index a4c5606..5cedc9e 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -283,7 +283,7 @@ static void device_qual(struct usb_composite_dev
> *cdev) qual->bDeviceSubClass = cdev->desc.bDeviceSubClass;
> qual->bDeviceProtocol = cdev->desc.bDeviceProtocol;
> /* ASSUME same EP0 fifo size at both speeds */
> - qual->bMaxPacketSize0 = cdev->desc.bMaxPacketSize0;
> + qual->bMaxPacketSize0 = cdev->gadget->ep0->maxpacket;
> qual->bNumConfigurations = count_configs(cdev,
> USB_DT_DEVICE_QUALIFIER); qual->bRESERVED = 0;
> }
> @@ -736,6 +736,8 @@ composite_setup(struct usb_gadget *gadget, const
> struct usb_ctrlrequest *ctrl) case USB_DT_DEVICE:
> cdev->desc.bNumConfigurations =
> count_configs(cdev, USB_DT_DEVICE);
> + cdev->desc.bMaxPacketSize0 =
> + cdev->gadget->ep0->maxpacket;
> value = min(w_length, (u16) sizeof
> cdev->desc); memcpy(req->buf, &cdev->desc, value);
> break;
> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
> index ba442d5..8ccf9b0 100644
> --- a/drivers/usb/gadget/ether.c
> +++ b/drivers/usb/gadget/ether.c
> @@ -1249,6 +1249,7 @@ eth_setup(struct usb_gadget *gadget, const
> struct usb_ctrlrequest *ctrl) switch (wValue >> 8) {
>
> case USB_DT_DEVICE:
> + device_desc.bMaxPacketSize0 =
> gadget->ep0->maxpacket; value = min(wLength, (u16) sizeof
> device_desc); memcpy(req->buf, &device_desc, value);
> break;
> @@ -2133,7 +2134,6 @@ autoconf_fail:
> hs_subset_descriptors();
> }
>
> - device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
> usb_gadget_set_selfpowered(gadget);
>
> /* For now RNDIS is always a second config */
Reviewed-by: Lukasz Majewski <l.majewski at samsung.com>
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
More information about the U-Boot
mailing list