]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
PCI: dwc: Ensure that dw_pcie_wait_for_link() waits 100 ms after link up
authorNiklas Cassel <cassel@kernel.org>
Wed, 25 Jun 2025 10:23:51 +0000 (12:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Sep 2025 13:31:56 +0000 (15:31 +0200)
commit 80dc18a0cba8dea42614f021b20a04354b213d86 upstream.

As per PCIe r6.0, sec 6.6.1, a Downstream Port that supports Link speeds
greater than 5.0 GT/s, software must wait a minimum of 100 ms after Link
training completes before sending a Configuration Request.

Add this delay in dw_pcie_wait_for_link(), after the link is reported as
up. The delay will only be performed in the success case where the link
came up.

DWC glue drivers that have a link up IRQ (drivers that set
use_linkup_irq = true) do not call dw_pcie_wait_for_link(), instead they
perform this delay in their threaded link up IRQ handler.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Link: https://patch.msgid.link/20250625102347.1205584-14-cassel@kernel.org
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/controller/dwc/pcie-designware.c

index d40afe74ddd1a3c4ec341a8e29a228f38545cc58..f9473b8160778cd64f7b9970696edf7c68cd0afb 100644 (file)
@@ -655,6 +655,14 @@ int dw_pcie_wait_for_link(struct dw_pcie *pci)
                return -ETIMEDOUT;
        }
 
+       /*
+        * As per PCIe r6.0, sec 6.6.1, a Downstream Port that supports Link
+        * speeds greater than 5.0 GT/s, software must wait a minimum of 100 ms
+        * after Link training completes before sending a Configuration Request.
+        */
+       if (pci->max_link_speed > 2)
+               msleep(PCIE_RESET_CONFIG_WAIT_MS);
+
        offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
        val = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA);