Skip to content

Commit 8279b54

Browse files
authored
Merge pull request #251 from krishnachaitanya-linux/usbhux-aspm-fix
WORKAROUND: pci: quirks: Disable L1.1 and L1.2 for USB hub attach
2 parents 0d32ebc + d077d85 commit 8279b54

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

drivers/pci/quirks.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,49 @@ static void quirk_disable_aspm_l1ss(struct pci_dev *dev)
25332533
}
25342534
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_QCOM, 0x1103, quirk_disable_aspm_l1ss);
25352535

2536+
static int disable_aspm_l1ss(struct pci_dev *dev, void *data)
2537+
{
2538+
pci_disable_link_state(dev, PCIE_LINK_STATE_L1_1 | PCIE_LINK_STATE_L1_2);
2539+
return 0;
2540+
}
2541+
2542+
static void quirk_disable_l1ss(struct pci_dev *dev)
2543+
{
2544+
struct pci_dev *root_port;
2545+
struct pci_dev *upstream;
2546+
2547+
pci_info(dev, "Disabling ASPM L1ss\n");
2548+
2549+
upstream = dev->bus->self;
2550+
while (upstream) {
2551+
if (pci_pcie_type(upstream) == PCI_EXP_TYPE_ROOT_PORT) {
2552+
root_port = upstream;
2553+
break;
2554+
}
2555+
2556+
/* Move further up the hierarchy */
2557+
upstream = upstream->bus->self;
2558+
}
2559+
2560+
if (!root_port) {
2561+
pci_err(dev, "Could not find root port, cannot disable L1ss\n");
2562+
return;
2563+
}
2564+
2565+
pci_info(dev, "Found root-port with VID: %04x PID: %04x, disabling l1ss\n",
2566+
root_port->vendor, root_port->device);
2567+
2568+
pci_walk_bus(root_port->subordinate, disable_aspm_l1ss, NULL);
2569+
}
2570+
2571+
/*
2572+
* When ASPM L1.1/L1.2 is enabled on the upstream link of QPS615 switch,
2573+
* and Renesas uPD720201 USB 3.0 Controller is connected to one of the switch
2574+
* downstream ports, then uPD dies down and stops responding to host commands;
2575+
* disabling l1 sub-states in uPD attach case helps mitigate this issue.
2576+
*/
2577+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_RENESAS, 0x0014, quirk_disable_l1ss);
2578+
25362579
/*
25372580
* Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
25382581
* Link bit cleared after starting the link retrain process to allow this

0 commit comments

Comments
 (0)