Skip to content

Commit f4c7d05

Browse files
repkLorenzo Pieralisi
authored andcommitted
PCI: aardvark: Wait for endpoint to be ready before training link
When configuring pcie reset pin from gpio (e.g. initially set by u-boot) to pcie function this pin goes low for a brief moment asserting the PERST# signal. Thus connected device enters fundamental reset process and link configuration can only begin after a minimal 100ms delay (see [1]). Because the pin configuration comes from the "default" pinctrl it is implicitly configured before the probe callback is called: driver_probe_device() really_probe() ... pinctrl_bind_pins() /* Here pin goes from gpio to PCIE reset function and PERST# is asserted */ ... drv->probe() [1] "PCI Express Base Specification", REV. 4.0 PCI Express, February 19 2014, 6.6.1 Conventional Reset Signed-off-by: Remi Pommarel <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Acked-by: Thomas Petazzoni <[email protected]>
1 parent 364b3f1 commit f4c7d05

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/pci/controller/pci-aardvark.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,14 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)
337337
reg |= PIO_CTRL_ADDR_WIN_DISABLE;
338338
advk_writel(pcie, reg, PIO_CTRL);
339339

340+
/*
341+
* PERST# signal could have been asserted by pinctrl subsystem before
342+
* probe() callback has been called, making the endpoint going into
343+
* fundamental reset. As required by PCI Express spec a delay for at
344+
* least 100ms after such a reset before link training is needed.
345+
*/
346+
msleep(PCI_PM_D3COLD_WAIT);
347+
340348
/* Start link training */
341349
reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG);
342350
reg |= PCIE_CORE_LINK_TRAINING;

0 commit comments

Comments
 (0)