Skip to content

Commit 781f2e0

Browse files
P33Mpelwell
authored andcommitted
usb: dwc2: masquerade split-interrupt transfers
Masquerading Interrupt split transfers as Control puts the transfer into the non-periodic handler in the hub. This stops the hub dropping complete-split data in the microframe after a CSPLIT should have arrived, improving resilience to host IRQ latency. Devices are none the wiser - the handshake tokens are the same. Originally devised by Hans Petter Selasky @ FreeBSD. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
1 parent 2f27224 commit 781f2e0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/usb/dwc2/hcd.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,19 @@ static void dwc2_hc_init(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan)
676676
hcchar |= HCCHAR_EPDIR;
677677
if (chan->speed == USB_SPEED_LOW)
678678
hcchar |= HCCHAR_LSPDDEV;
679-
hcchar |= chan->ep_type << HCCHAR_EPTYPE_SHIFT & HCCHAR_EPTYPE_MASK;
679+
680+
/*
681+
* Masquerading Interrupt split transfers as Control puts the transfer
682+
* into the non-periodic handler in the hub. This stops the hub
683+
* dropping complete-split data in the microframe after a CSPLIT
684+
* should have arrived, improving resilience to host IRQ latency.
685+
* Devices are none the wiser - the handshake tokens are the same.
686+
*/
687+
if (chan->do_split && chan->ep_type == USB_ENDPOINT_XFER_INT)
688+
hcchar |= USB_ENDPOINT_XFER_CONTROL << HCCHAR_EPTYPE_SHIFT & HCCHAR_EPTYPE_MASK;
689+
else
690+
hcchar |= chan->ep_type << HCCHAR_EPTYPE_SHIFT & HCCHAR_EPTYPE_MASK;
691+
680692
hcchar |= chan->max_packet << HCCHAR_MPS_SHIFT & HCCHAR_MPS_MASK;
681693
dwc2_writel(hsotg, hcchar, HCCHAR(hc_num));
682694
if (dbg_hc(chan)) {

0 commit comments

Comments
 (0)