From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Thu, 24 Sep 2020 12:39:41 +0200 Subject: [PATCH] arm64: a37xx: pci: Disable link training when unloading driver In-Reply-To: <20200922112138.4392-1-pali@kernel.org> References: <20200922112138.4392-1-pali@kernel.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 22.09.20 13:21, Pali Roh?r wrote: > As required by PCI Express spec a delay for at least 100ms after > de-asserting PERST# signal is needed before link training is enabled. > > Linux kernels prior to 5.8 version do not automatically disable link > training before de-asserting PERST# signal, therefore this requirement is > not fulfilled. > > Above requirement is needed for proper detection of some Compex PCIe WiFi > cards. Otherwise Linux kernel cannot detect it. > > To allow using those PCIe cards with older Linux kernel versions booted by > U-Boot compiled with U-Boot a37xx pci driver, disable link training in > U-Boot when unloading this pci driver. > > Thanks to DM_FLAG_OS_PREPARE flag, U-Boot automatically unload this driver > when booting Linux kernel. > > Signed-off-by: Pali Roh?r Applied to u-boot-marvell/master Thanks, Stefan > --- > drivers/pci/pci-aardvark.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c > index b2c417701f..babb84ca93 100644 > --- a/drivers/pci/pci-aardvark.c > +++ b/drivers/pci/pci-aardvark.c > @@ -647,10 +647,15 @@ static int pcie_advk_probe(struct udevice *dev) > static int pcie_advk_remove(struct udevice *dev) > { > struct pcie_advk *pcie = dev_get_priv(dev); > + u32 reg; > > if (dm_gpio_is_valid(&pcie->reset_gpio)) > dm_gpio_set_value(&pcie->reset_gpio, 1); > > + reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); > + reg &= ~LINK_TRAINING_EN; > + advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); > + > return 0; > } > >