All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: a37xx: pci: Disable link training when unloading driver
@ 2020-09-22 11:21 Pali Rohár
  2020-09-23  6:45 ` Stefan Roese
  2020-09-24 10:39 ` Stefan Roese
  0 siblings, 2 replies; 4+ messages in thread
From: Pali Rohár @ 2020-09-22 11:21 UTC (permalink / raw)
  To: u-boot

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 <pali@kernel.org>
---
 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;
 }
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] arm64: a37xx: pci: Disable link training when unloading driver
  2020-09-22 11:21 [PATCH] arm64: a37xx: pci: Disable link training when unloading driver Pali Rohár
@ 2020-09-23  6:45 ` Stefan Roese
  2020-09-23 22:47   ` Pali Rohár
  2020-09-24 10:39 ` Stefan Roese
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2020-09-23  6:45 UTC (permalink / raw)
  To: u-boot

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 <pali@kernel.org>

Reviewed-by: Stefan Roese <sr@denx.de>

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;
>   }
>   
> 


Viele Gr??e,
Stefan

-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm64: a37xx: pci: Disable link training when unloading driver
  2020-09-23  6:45 ` Stefan Roese
@ 2020-09-23 22:47   ` Pali Rohár
  0 siblings, 0 replies; 4+ messages in thread
From: Pali Rohár @ 2020-09-23 22:47 UTC (permalink / raw)
  To: u-boot

On Wednesday 23 September 2020 08:45:20 Stefan Roese wrote:
> 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 <pali@kernel.org>
> 
> Reviewed-by: Stefan Roese <sr@denx.de>
> 
> 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?

> > ---
> >   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;
> >   }
> > 
> 
> 
> Viele Gr??e,
> Stefan
> 
> -- 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm64: a37xx: pci: Disable link training when unloading driver
  2020-09-22 11:21 [PATCH] arm64: a37xx: pci: Disable link training when unloading driver Pali Rohár
  2020-09-23  6:45 ` Stefan Roese
@ 2020-09-24 10:39 ` Stefan Roese
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2020-09-24 10:39 UTC (permalink / raw)
  To: u-boot

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 <pali@kernel.org>

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;
>   }
>   
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-24 10:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 11:21 [PATCH] arm64: a37xx: pci: Disable link training when unloading driver Pali Rohár
2020-09-23  6:45 ` Stefan Roese
2020-09-23 22:47   ` Pali Rohár
2020-09-24 10:39 ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.