On Tuesday 21 April 2020 13:16:56 Marek Behún wrote: > From: Pali Rohár <pali@xxxxxxxxxx> > > Add support for issuing PERST via GPIO specified in 'reset-gpios' > property (as described in PCI device tree bindings). > > Some buggy cards (e.g. Compex WLE900VX or WLE1216) are not detected > after reboot when PERST is not issued during driver initialization. > > Tested on Turris MOX. > > Signed-off-by: Pali Rohár <pali@xxxxxxxxxx> > --- > drivers/pci/controller/pci-aardvark.c | 32 +++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c > index 606bae1e7a88..e2d18094d8ca 100644 > --- a/drivers/pci/controller/pci-aardvark.c > +++ b/drivers/pci/controller/pci-aardvark.c ... > +static void advk_pcie_issue_perst(struct advk_pcie *pcie) > +{ > + if (!pcie->reset_gpio) > + return; > + > + dev_info(&pcie->pdev->dev, "issuing PERST via reset GPIO for 1ms\n"); > + gpiod_set_value_cansleep(pcie->reset_gpio, 1); > + usleep_range(1000, 2000); > + gpiod_set_value_cansleep(pcie->reset_gpio, 0); > +} After more testing we will have to increase this timeout to 10ms as some Compex cards are sometimes not detected with current 1ms timeout. I will do it in V3 patch series. Bjorn, do you know if there is a defined timeout in PCIE specification how long should be card in PERST? I looked into others pci kernel drivers and basically every driver is using its own timeout. pcie-kirin.c --> usleep_range(20000, 25000); pcie-qcom.c --> usleep_range(1000, 1000 + 500); msleep(100); pci-mvebu.c --> udelay(100); pci-tegra.c --> usleep_range(1000, 2000); pcie-iproc.c --> udelay(250); pcie-mediatek.c --> no delay pci-imx6.c --> msleep(100); But I guess that this timeout should not depend on driver or pci controller, but rather on connected card or on some recommended value if defined by PCIE specification.