usb: gadget: get ep mult and maxburst for rockchip superspeed

For Rockchip platforms, they may need to get the mult and
maxburst of endpoints for USB superspeed gadget when bind
USB functions (e.g. uvc_function_bind), then the USB DWC3
controller can do Tx fifos resize properly for each endpoints.

Change-Id: I7baddbc0dc515c91d82ca4bc1960531919ed6008
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2021-05-07 11:15:50 +08:00
committed by Tao Huang
parent 23ce756d92
commit 3e41649e10

View File

@@ -125,9 +125,24 @@ found_ep:
ep->claimed = true;
#ifdef CONFIG_ARCH_ROCKCHIP
ep->transfer_type = type;
if (type == USB_ENDPOINT_XFER_ISOC ||
type == USB_ENDPOINT_XFER_INT)
if (gadget_is_superspeed(gadget) && ep_comp) {
switch (type) {
case USB_ENDPOINT_XFER_ISOC:
/* mult: bits 1:0 of bmAttributes */
ep->mult = (ep_comp->bmAttributes & 0x3) + 1;
/* fall through */
case USB_ENDPOINT_XFER_BULK:
case USB_ENDPOINT_XFER_INT:
ep->maxburst = ep_comp->bMaxBurst + 1;
break;
default:
break;
}
} else if (gadget_is_dualspeed(gadget) &&
(type == USB_ENDPOINT_XFER_ISOC ||
type == USB_ENDPOINT_XFER_INT)) {
ep->mult = usb_endpoint_maxp_mult(desc);
}
#endif
return ep;
}