PCI: dwc: Allow platform driver to skip the wait for link
PATCH 1/1 PCI: dwc: Allow platform driver to skip the wait for link
Currently as a part of device probe, the driver waits for the link to come up for up to 1 second. If the link training is not enabled by default or as a part of host_init, then this wait for the link can be skipped to save the 1 second of wait time.
Allow the platform driver to skip this wait for the link up by setting a flag skip_wait_for_link. This flag will be false by default, thereby preserving the legacy behavior for existing platform drivers.
--- drivers/pci/controller/dwc/pcie-designware-host.c | 9 +++++++-- drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-designware-host.c +7 -2
@@ -491,8 +491,13 @@ 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); +/* +* If the platform driver sets `skip_wait_for_link` because it knows the +* link will not be up, do not wait for it. Save 1 sec of wait time. +* Else, test for the link. Ignore errors, the link may come up later +*/ +if (!pp->skip_wait_for_link) +dw_pcie_wait_for_link (pci); bridge->sysdata = pp;
drivers/pci/controller/dwc/pcie-designware.h +1 -0
@@ -297,6 +297,7 @@ struct dw_pcie_host_ops {struct dw_pcie_rp {bool has_msi_ctrl:1 ;bool cfg0_io_shared:1 ; +bool skip_wait_for_link:1 ;u64 cfg0_base;void __iomem *va_cfg0_base;u32 cfg0_size;
Signature · 1 line
2.40.0.348.gf938b09366-goog
Lorenzo Pieralisi
maintainerQuoted 10 lines · Ajay Agarwal
Currently as a part of device probe, the driver waits for the link to come up for up to 1 second. If the link training is not enabled by default or as a part of
host_init, then this wait for the link can be skipped to save the 1 second of wait time.Allow the platform driver to skip this wait for the link up by setting a flag
skip_wait_for_link. This flag will be false by default, thereby preserving the legacy behavior for existing platform drivers.
Quoted 5 lines
Signed-off-by Ajay Agarwal <[email protected]>--- drivers/pci/controller/dwc/pcie-designware-host.c | 9 +++++++-- drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-)
A previous patch handles this change, dropping this one, please chime in in this thread if needed:
https://lore.kernel.org/linux-pci/ZC12lN9Cs0QlPhVh@lpieralisi
Quoted 36 lines
drivers/pci/controller/dwc/pcie-designware-host.c +7
-2@@ -491,8 +491,13 @@ 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); +/* +* If the platform driver sets `skip_wait_for_link` because it knows the +* link will not be up, do not wait for it. Save 1 sec of wait time. +* Else, test for the link. Ignore errors, the link may come up later +*/ +if (!pp->skip_wait_for_link) +dw_pcie_wait_for_link (pci); bridge->sysdata = pp;drivers/pci/controller/dwc/pcie-designware.h +1
-0@@ -297,6 +297,7 @@ struct dw_pcie_host_ops {struct dw_pcie_rp {bool has_msi_ctrl:1 ;bool cfg0_io_shared:1 ; +bool skip_wait_for_link:1 ;u64 cfg0_base;void __iomem *va_cfg0_base;u32 cfg0_size;Signature · 1 line
2.40.0.348.gf938b09366-goog