usb: dwc3: gadget: prepare at least twice txfifo for each ep

The current logic to assign only one max packet limit
for each IN endpoint txfifo, it's not enough for some
usb functions on Rockchip platforms.

For example, on RV1106 platform usb composite device
with UVC function, if it sets one max packet limit for
IN endpoint txfifo, the UVC function streaming ep may
be assigned with ep4-in or ep5-in which have default
HW value 1048B. But the UVC function needs to support
high bandwidth isochronous transaction in a microframe
(two or three transactions per microframe), the ep4-in
or ep5-in has not enough txfifo space to fit the UVC.

In addition, to meet performance requirement, a minimum
TxFIFO size of 2x MaxPacketSize for BULK/ISOC endpoints
is recommended in DWC3 databook.

So this patch prepares at least twice txfifo for each
IN endpoint on Rockchip platforms.

Fixes: 767a360826 ("UPSTREAM: usb: dwc3: gadget: Fix IN endpoint max packet size allocation")
Change-Id: If97eb74ab6ec1a32fe162758bc8f704c15fa4f3c
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2023-05-22 14:19:12 +08:00
committed by Tao Huang
parent 1a6d52236f
commit 5da9da3109

View File

@@ -3195,6 +3195,16 @@ static int dwc3_gadget_init_in_endpoint(struct dwc3_ep *dep)
else
maxpacket = mdwidth * ((size - 1) - 1) - mdwidth;
/*
* To meet performance requirement, a minimum TxFIFO size of 2x
* MaxPacketSize is recommended for endpoints that support for
* Rockchip platform with UVC function.
*/
if (IS_REACHABLE(CONFIG_ARCH_ROCKCHIP) &&
(dwc->maximum_speed >= USB_SPEED_HIGH))
maxpacket /= 2;
/* Functionally, space for one max packet is sufficient */
size = min_t(int, maxpacket, 1024);
/*