kernel: bump 6.1 to 6.1.43
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-6.1 / 950-0520-xhci-constrain-XHCI_VLI_HUB_TT_QUIRK-to-old-firmware.patch
1 From b5a62178cd25c598612036858df5934c4140d242 Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.com>
3 Date: Fri, 16 Dec 2022 15:18:21 +0000
4 Subject: [PATCH] xhci: constrain XHCI_VLI_HUB_TT_QUIRK to old firmware
5 versions
6
7 VLI have a firmware update for the VL805 which resolves the incorrect
8 frame time calculation in the hub's TT. Limit applying the quirk to
9 known-bad firmwares.
10
11 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
12 ---
13 drivers/usb/host/xhci-pci.c | 15 ++++++++++++++-
14 1 file changed, 14 insertions(+), 1 deletion(-)
15
16 --- a/drivers/usb/host/xhci-pci.c
17 +++ b/drivers/usb/host/xhci-pci.c
18 @@ -27,6 +27,8 @@
19 #define SPARSE_DISABLE_BIT 17
20 #define SPARSE_CNTL_ENABLE 0xC12C
21
22 +#define VL805_FW_VER_0138C0 0x0138C0
23 +
24 /* Device for a quirk */
25 #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73
26 #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000
27 @@ -104,6 +106,16 @@ static int xhci_pci_reinit(struct xhci_h
28 return 0;
29 }
30
31 +static u32 xhci_vl805_get_fw_version(struct pci_dev *dev)
32 +{
33 + int ret;
34 + u32 ver;
35 +
36 + ret = pci_read_config_dword(dev, 0x50, &ver);
37 + /* Default to a fw version of 0 instead of ~0 */
38 + return ret ? 0 : ver;
39 +}
40 +
41 static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
42 {
43 struct pci_dev *pdev = to_pci_dev(dev);
44 @@ -298,7 +310,8 @@ static void xhci_pci_quirks(struct devic
45 xhci->quirks |= XHCI_AVOID_DQ_ON_LINK;
46 xhci->quirks |= XHCI_VLI_TRB_CACHE_BUG;
47 xhci->quirks |= XHCI_VLI_SS_BULK_OUT_BUG;
48 - xhci->quirks |= XHCI_VLI_HUB_TT_QUIRK;
49 + if (xhci_vl805_get_fw_version(pdev) < VL805_FW_VER_0138C0)
50 + xhci->quirks |= XHCI_VLI_HUB_TT_QUIRK;
51 }
52
53 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&