bcm27xx: 6.1: add kernel patches
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-6.1 / 950-0392-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch
1 From 855c0e315e283985bacb623ee72bae2fcec3a463 Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.com>
3 Date: Tue, 1 Mar 2022 15:12:15 +0000
4 Subject: [PATCH] usb: xhci: rework XHCI_VLI_SS_BULK_OUT_BUG quirk
5
6 Fix incorrectly applying the quirk for bulk IN endpoints and remove the
7 commentary which is not completely accurate based on observed behaviour.
8
9 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
10 ---
11 drivers/usb/host/xhci-ring.c | 15 +++++----------
12 1 file changed, 5 insertions(+), 10 deletions(-)
13
14 --- a/drivers/usb/host/xhci-ring.c
15 +++ b/drivers/usb/host/xhci-ring.c
16 @@ -3578,7 +3578,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
17 unsigned int num_trbs;
18 unsigned int start_cycle, num_sgs = 0;
19 unsigned int enqd_len, block_len, trb_buff_len, full_len;
20 - int sent_len, ret, vli_quirk = 0;
21 + int sent_len, ret, vli_bulk_quirk = 0;
22 u32 field, length_field, remainder, maxpacket;
23 u64 addr, send_addr;
24
25 @@ -3624,14 +3624,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
26 send_addr = addr;
27
28 if (xhci->quirks & XHCI_VLI_SS_BULK_OUT_BUG &&
29 - !usb_urb_dir_in(urb) && urb->dev->speed >= USB_SPEED_SUPER) {
30 - /*
31 - * VL805 - superspeed bulk OUT traffic can cause
32 - * an internal fifo overflow if the TRB buffer is larger
33 - * than wMaxPacket and the length is not an integer
34 - * multiple of wMaxPacket.
35 - */
36 - vli_quirk = 1;
37 + usb_endpoint_is_bulk_out(&urb->ep->desc)
38 + && urb->dev->speed >= USB_SPEED_SUPER) {
39 + vli_bulk_quirk = 1;
40 }
41
42 /* Queue the TRBs, even if they are zero-length */
43 @@ -3646,7 +3641,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
44 if (enqd_len + trb_buff_len > full_len)
45 trb_buff_len = full_len - enqd_len;
46
47 - if (vli_quirk && trb_buff_len > maxpacket) {
48 + if (vli_bulk_quirk && trb_buff_len > maxpacket) {
49 /* SS bulk wMaxPacket is 1024B */
50 remainder = trb_buff_len & (maxpacket - 1);
51 trb_buff_len -= remainder;