usb: gadget: vary ep max packet by usb speed

The EP Maxpacket should be varied due the USB speed may be changed
at enumeration time.

Change-Id: I6cf8e1e8b6e3c24d14f7b24638aff88f8dd066e0
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
Frank Wang 2020-03-03 17:58:49 +08:00 committed by Jianhong Chen
parent ea6d52da21
commit 3e6777664f
1 changed files with 6 additions and 0 deletions

View File

@ -593,6 +593,12 @@ fsg_ep_desc(struct usb_gadget *g, struct usb_endpoint_descriptor *fs,
speed_desc = fs;
}
/*
* Config the ep maxpacket according to the right descriptors
* for a given endpoint.
*/
ep->maxpacket = usb_endpoint_maxp(speed_desc) & USB_ENDPOINT_MAXP_MASK;
return speed_desc;
}