openwrt/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XH...

52 lines
1.9 KiB
Diff

From 2b76a32609d4621151beb78354ae945df37e2a1d 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
@@ -3617,7 +3617,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;
@@ -3663,14 +3663,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 */
@@ -3685,7 +3680,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;