Skip to content

Commit

Permalink
xhci: constrain XHCI_VLI_HUB_TT_QUIRK to old firmware versions
Browse files Browse the repository at this point in the history
VLI have a firmware update for the VL805 which resolves the incorrect
frame time calculation in the hub's TT. Limit applying the quirk to
known-bad firmwares.

Signed-off-by: Jonathan Bell <[email protected]>
  • Loading branch information
P33M authored and popcornmix committed Dec 21, 2022
1 parent 696dcc7 commit 3fe602c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion drivers/usb/host/xhci-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#define SPARSE_DISABLE_BIT 17
#define SPARSE_CNTL_ENABLE 0xC12C

#define VL805_FW_VER_0138C0 0x0138C0

/* Device for a quirk */
#define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73
#define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000
Expand Down Expand Up @@ -100,6 +102,16 @@ static int xhci_pci_reinit(struct xhci_hcd *xhci, struct pci_dev *pdev)
return 0;
}

static u32 xhci_vl805_get_fw_version(struct pci_dev *dev)
{
int ret;
u32 ver;

ret = pci_read_config_dword(dev, 0x50, &ver);
/* Default to a fw version of 0 instead of ~0 */
return ret ? 0 : ver;
}

static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
{
struct pci_dev *pdev = to_pci_dev(dev);
Expand Down Expand Up @@ -295,7 +307,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
xhci->quirks |= XHCI_AVOID_DQ_ON_LINK;
xhci->quirks |= XHCI_VLI_TRB_CACHE_BUG;
xhci->quirks |= XHCI_VLI_SS_BULK_OUT_BUG;
xhci->quirks |= XHCI_VLI_HUB_TT_QUIRK;
if (xhci_vl805_get_fw_version(pdev) < VL805_FW_VER_0138C0)
xhci->quirks |= XHCI_VLI_HUB_TT_QUIRK;
}

if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
Expand Down

0 comments on commit 3fe602c

Please sign in to comment.