summaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-6.1/950-0392-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch
blob: e3f1848ad539e79cbcb302be484a0dcad1a9872f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 855c0e315e283985bacb623ee72bae2fcec3a463 Mon Sep 17 00:00:00 2001
From: Jonathan Bell <jonathan@raspberrypi.com>
Date: Tue, 1 Mar 2022 15:12:15 +0000
Subject: [PATCH] usb: xhci: rework XHCI_VLI_SS_BULK_OUT_BUG quirk

Fix incorrectly applying the quirk for bulk IN endpoints and remove the
commentary which is not completely accurate based on observed behaviour.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
---
 drivers/usb/host/xhci-ring.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3605,7 +3605,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
 	unsigned int num_trbs;
 	unsigned int start_cycle, num_sgs = 0;
 	unsigned int enqd_len, block_len, trb_buff_len, full_len;
-	int sent_len, ret, vli_quirk = 0;
+	int sent_len, ret, vli_bulk_quirk = 0;
 	u32 field, length_field, remainder, maxpacket;
 	u64 addr, send_addr;
 
@@ -3651,14 +3651,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
 	send_addr = addr;
 
 	if (xhci->quirks & XHCI_VLI_SS_BULK_OUT_BUG &&
-	    !usb_urb_dir_in(urb) && urb->dev->speed >= USB_SPEED_SUPER) {
-		/*
-		 * VL805 - superspeed bulk OUT traffic can cause
-		 * an internal fifo overflow if the TRB buffer is larger
-		 * than wMaxPacket and the length is not an integer
-		 * multiple of wMaxPacket.
-		 */
-		vli_quirk = 1;
+	    usb_endpoint_is_bulk_out(&urb->ep->desc)
+	    && urb->dev->speed >= USB_SPEED_SUPER) {
+		vli_bulk_quirk = 1;
 	}
 
 	/* Queue the TRBs, even if they are zero-length */
@@ -3673,7 +3668,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
 		if (enqd_len + trb_buff_len > full_len)
 			trb_buff_len = full_len - enqd_len;
 
-		if (vli_quirk && trb_buff_len > maxpacket) {
+		if (vli_bulk_quirk && trb_buff_len > maxpacket) {
 			/* SS bulk wMaxPacket is 1024B */
 			remainder = trb_buff_len & (maxpacket - 1);
 			trb_buff_len -= remainder;