From 361f8a17bf58615ade0409fe3c97b474f81dcd75 Mon Sep 17 00:00:00 2001 From: Dom Cobley Date: Thu, 12 Nov 2026 12:41:26 +0000 Subject: [PATCH] xhci: drop the VL805 XHCI_EP_CTX_BROKEN_DCS cycle-state quirk Upstream commit 6328bdc988d2 ("usb: xhci: Don't trust the EP Context cycle bit when moving HW dequeue") fixed the VL805 DCS write-back problem by seeding new_cycle from td->end_trb and counting link TRB toggles only after end_trb. The downstream quirk still seeds new_cycle from the TRB at the hardware dequeue pointer, which can be before a cycle-toggling link TRB inside the cancelled TD. That toggle is then never counted, Set TR Dequeue is given the previous lap's cycle bit, and the endpoint stalls until a USB reset. Remove the quirk; upstream's handling covers the VL805. Link: https://github.com/raspberrypi/linux/issues/7737 Signed-off-by: Dom Cobley --- drivers/usb/host/xhci-pci.c | 1 - drivers/usb/host/xhci-ring.c | 22 +--------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 0ad9e5f26d7fa3..20d09b14347593 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -461,7 +461,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_TRB_OVERFETCH; xhci->dma_mask_bits = 40; - xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; xhci->quirks |= XHCI_VLI_SS_BULK_OUT_BUG; if (xhci_vl805_get_fw_version(pdev) < VL805_FW_VER_0138C0) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index bf0baf5c8007b8..99a4e67fdd9bcc 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -707,11 +707,8 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, struct xhci_ring *ep_ring; struct xhci_command *cmd; struct xhci_segment *new_seg; - struct xhci_segment *halted_seg = NULL; union xhci_trb *new_deq; int new_cycle; - union xhci_trb *halted_trb; - int index = 0; dma_addr_t addr; u64 hw_dequeue; bool hw_dequeue_found = false; @@ -731,24 +728,7 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, new_seg = ep_ring->deq_seg; new_deq = ep_ring->dequeue; - /* - * Quirk: xHC write-back of the DCS field in the hardware dequeue - * pointer is wrong - use the cycle state of the TRB pointed to by - * the dequeue pointer. - */ - if (xhci->quirks & XHCI_EP_CTX_BROKEN_DCS && - !(ep->ep_state & EP_HAS_STREAMS)) - halted_seg = trb_in_td(td, hw_dequeue & ~0xf); - if (halted_seg) { - index = ((dma_addr_t)(hw_dequeue & ~0xf) - halted_seg->dma) / - sizeof(*halted_trb); - halted_trb = &halted_seg->trbs[index]; - new_cycle = halted_trb->generic.field[3] & 0x1; - xhci_dbg(xhci, "Endpoint DCS = %d TRB index = %d cycle = %d\n", - (u8)(hw_dequeue & 0x1), index, new_cycle); - } else { - new_cycle = le32_to_cpu(td->end_trb->generic.field[3]) & TRB_CYCLE; - } + new_cycle = le32_to_cpu(td->end_trb->generic.field[3]) & TRB_CYCLE; /* * Walk the ring until both the next TRB and hw_dequeue are found (don't