arm64: a37xx: pci: Disable link training when unloading driver
PATCH 1/1 arm64: a37xx: pci: Disable link training when unloading driver
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.
--- drivers/pci/pci-aardvark.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/pci/pci-aardvark.c +5 -0
@@ -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 ; }
Signature · 1 line
2.20.1
PATCH 1/1 arm64: a37xx: pci: Disable link training when unloading driver
Quoted 10 lines · Pali Roh?r
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.
Quoted 8 lines
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_PREPAREflag, U-Boot automatically unload this driver when booting Linux kernel.Signed-off-by Pali Roh?r <[email protected]>
Thanks,
Stefan
Quoted 15 lines
--- drivers/pci/pci-aardvark.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/pci/pci-aardvark.c +1
-0@@ -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;
drivers/pci/pci-aardvark.c static int pcie_advk_probe(struct udevice *dev) · line 661
Quoted 10 lines
drivers/pci/pci-aardvark.c +4
-0if (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 ; }
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 1/1 arm64: a37xx: pci: Disable link training when unloading driver
Quoted 18 lines · On Wednesday 23 September 2020 08:45:20 Stefan Roese wrote:
Quoted 17 lines · Pali Roh?r
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_PREPAREflag, U-Boot automatically unload this driver when booting Linux kernel.
Quoted 6 lines
Quoted 1 line
Signed-off-by Pali Roh?r <[email protected]>Reviewed-by Stefan Roese <[email protected]>Thanks,
Stefan
Ok! Stefan, will you send this patch to main u-boot, so it would be part of the u-boot 2020.10 release?
Quoted 31 lines
Quoted 12 lines
--- drivers/pci/pci-aardvark.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/pci/pci-aardvark.c +0
-0@@ -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);drivers/pci/pci-aardvark.c static int pcie_advk_probe(struct udevice *dev) · line 659
Quoted 10 lines
drivers/pci/pci-aardvark.c +5
-0+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 ; }Viele Gr??e,
StefanSignature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 1/1 arm64: a37xx: pci: Disable link training when unloading driver
In reply to Pali RohárQuoted 10 lines · Pali Roh?r
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.
Quoted 8 lines
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_PREPAREflag, U-Boot automatically unload this driver when booting Linux kernel.Signed-off-by Pali Roh?r <[email protected]>
Applied to u-boot-marvell/master
Thanks,
Stefan
Quoted 25 lines
--- drivers/pci/pci-aardvark.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/pci/pci-aardvark.c +5
-0@@ -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 ; }