Message ID | 20200430080625.26070-2-pali@kernel.org |
---|---|
State | New |
Headers | show |
Series | PCI: aardvark: Fix support for Turris MOX and Compex wifi cards | expand |
On Thu, Apr 30, 2020 at 10:06:14AM +0200, Pali Rohár wrote: > Adding even 100ms (PCI_PM_D3COLD_WAIT) delay between enabling link > training and starting link training causes detection issues with some > buggy cards (such as Compex WLE900VX). > > Move the code which enables link training immediately before the one > which starts link traning. s/traning/training/ > This fixes detection issues of Compex WLE900VX card on Turris MOX after > cold boot. > > Fixes: f4c7d053d7f7 ("PCI: aardvark: Wait for endpoint to be ready...") Don't repost just for these, but if you do repost, include the complete subject here, e.g., f4c7d053d7f7 ("PCI: aardvark: Wait for endpoint to be ready before training link")
On Thu, 30 Apr 2020 10:06:14 +0200, =?UTF-8?q?Pali=20Roh=C3=A1r?= wrote: > Adding even 100ms (PCI_PM_D3COLD_WAIT) delay between enabling link > training and starting link training causes detection issues with some > buggy cards (such as Compex WLE900VX). > > Move the code which enables link training immediately before the one > which starts link traning. > > This fixes detection issues of Compex WLE900VX card on Turris MOX after > cold boot. > > Fixes: f4c7d053d7f7 ("PCI: aardvark: Wait for endpoint to be ready...") > Signed-off-by: Pali Rohár <pali@kernel.org> > --- > drivers/pci/controller/pci-aardvark.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > Acked-by: Rob Herring <robh@kernel.org>
diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index 2a20b649f40c..f9955b494267 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -300,11 +300,6 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) reg |= LANE_COUNT_1; advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); - /* Enable link training */ - reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); - reg |= LINK_TRAINING_EN; - advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); - /* Enable MSI */ reg = advk_readl(pcie, PCIE_CORE_CTRL2_REG); reg |= PCIE_CORE_CTRL2_MSI_ENABLE; @@ -346,7 +341,15 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) */ msleep(PCI_PM_D3COLD_WAIT); - /* Start link training */ + /* Enable link training */ + reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); + reg |= LINK_TRAINING_EN; + advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); + + /* + * Start link training immediately after enabling it. + * This solves problems for some buggy cards. + */ reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); reg |= PCIE_CORE_LINK_TRAINING; advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG);
Adding even 100ms (PCI_PM_D3COLD_WAIT) delay between enabling link training and starting link training causes detection issues with some buggy cards (such as Compex WLE900VX). Move the code which enables link training immediately before the one which starts link traning. This fixes detection issues of Compex WLE900VX card on Turris MOX after cold boot. Fixes: f4c7d053d7f7 ("PCI: aardvark: Wait for endpoint to be ready...") Signed-off-by: Pali Rohár <pali@kernel.org> --- drivers/pci/controller/pci-aardvark.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)