usb: xhci: do not perform Soft Retry for some xHCI hosts
authorStanislaw Gruszka <stf_xl@wp.pl>
Thu, 11 Mar 2021 11:53:50 +0000 (13:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Mar 2021 12:03:06 +0000 (13:03 +0100)
On some systems rt2800usb and mt7601u devices are unable to operate since
commit f8f80be501aa ("xhci: Use soft retry to recover faster from
transaction errors")

Seems that some xHCI controllers can not perform Soft Retry correctly,
affecting those devices.

To avoid the problem add xhci->quirks flag that restore pre soft retry
xhci behaviour for affected xHCI controllers. Currently those are
AMD_PROMONTORYA_4 and AMD_PROMONTORYA_2, since it was confirmed
by the users: on those xHCI hosts issue happen and is gone after
disabling Soft Retry.

[minor commit message rewording for checkpatch -Mathias]

Fixes: f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors")
Cc: <stable@vger.kernel.org> # 4.20+
Reported-by: Bernhard <bernhard.gebetsberger@gmx.at>
Tested-by: Bernhard <bernhard.gebetsberger@gmx.at>
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202541
Link: https://lore.kernel.org/r/20210311115353.2137560-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-pci.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.h

index 84da8406d5b42415d9adcf276bc24d49de860423..1f989a49c8c6d12131300a0c781f3389e06bb1ca 100644 (file)
@@ -295,6 +295,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
             pdev->device == 0x9026)
                xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT;
 
+       if (pdev->vendor == PCI_VENDOR_ID_AMD &&
+           (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2 ||
+            pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4))
+               xhci->quirks |= XHCI_NO_SOFT_RETRY;
+
        if (xhci->quirks & XHCI_RESET_ON_RESUME)
                xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
                                "QUIRK: Resetting on resume");
index 5e548a1c93ab1a9cafc84d60566bab6f8894c1f1..ce38076901e25036a9b480b81e65fe0ec7466b62 100644 (file)
@@ -2484,7 +2484,8 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
                remaining       = 0;
                break;
        case COMP_USB_TRANSACTION_ERROR:
-               if ((ep_ring->err_count++ > MAX_SOFT_RETRY) ||
+               if (xhci->quirks & XHCI_NO_SOFT_RETRY ||
+                   (ep_ring->err_count++ > MAX_SOFT_RETRY) ||
                    le32_to_cpu(slot_ctx->tt_info) & TT_SLOT)
                        break;
 
index d41de5dc0452ef816a56b8b3afa12a09c9a6e70f..ca822ad3b65b0f6383b11edd2aedfdf27f2768cd 100644 (file)
@@ -1891,6 +1891,7 @@ struct xhci_hcd {
 #define XHCI_SKIP_PHY_INIT     BIT_ULL(37)
 #define XHCI_DISABLE_SPARSE    BIT_ULL(38)
 #define XHCI_SG_TRB_CACHE_SIZE_QUIRK   BIT_ULL(39)
+#define XHCI_NO_SOFT_RETRY     BIT_ULL(40)
 
        unsigned int            num_active_eps;
        unsigned int            limit_active_eps;