]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: dwc: Don't wait for link up if driver can detect Link Up event
authorKrishna chaitanya chundru <quic_krichai@quicinc.com>
Fri, 22 Nov 2024 19:09:59 +0000 (00:39 +0530)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 18 Jan 2025 17:35:02 +0000 (11:35 -0600)
If the driver can detect the Link Up event and enumerate downstream devices
at that time, we need not wait here.

Skip waiting for link to come up if the driver supports 'use_linkup_irq'.

Link: https://lore.kernel.org/r/20241123-remove_wait2-v5-1-b5f9e6b794c2@quicinc.com
Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
[bhelgaas: wrap comment, update commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/dwc/pcie-designware.h

index d2291c3ceb8bed937944e88323dff97d568ef665..bcbbe02f8f86f7ba23733d3e95bdfe8a238e3da9 100644 (file)
@@ -530,8 +530,14 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
                        goto err_remove_edma;
        }
 
-       /* Ignore errors, the link may come up later */
-       dw_pcie_wait_for_link(pci);
+       /*
+        * Note: Skip the link up delay only when a Link Up IRQ is present.
+        * If there is no Link Up IRQ, we should not bypass the delay
+        * because that would require users to manually rescan for devices.
+        */
+       if (!pp->use_linkup_irq)
+               /* Ignore errors, the link may come up later */
+               dw_pcie_wait_for_link(pci);
 
        bridge->sysdata = pp;
 
index 347ab74ac35aa4f061bc9d1f27c97e5fb9749107..1d0ec47e1986a7561a997f15e983a76b7363283c 100644 (file)
@@ -379,6 +379,7 @@ struct dw_pcie_rp {
        bool                    use_atu_msg;
        int                     msg_atu_index;
        struct resource         *msg_res;
+       bool                    use_linkup_irq;
 };
 
 struct dw_pcie_ep_ops {