Re: [PATCH v4 04/12] PCI: aardvark: Improve link training

From: Rob Herring
Date: Thu May 07 2020 - 17:10:22 EST


On Thu, 30 Apr 2020 10:06:17 +0200, =?UTF-8?q?Pali=20Roh=C3=A1r?= wrote:
> From: Marek Behún <marek.behun@xxxxxx>
>
> Currently the aardvark driver trains link in PCIe gen2 mode. This may
> cause some buggy gen1 cards (such as Compex WLE900VX) to be unstable or
> even not detected. Moreover when ASPM code tries to retrain link second
> time, these cards may stop responding and link goes down. If gen1 is
> used this does not happen.
>
> Unconditionally forcing gen1 is not a good solution since it may have
> performance impact on gen2 cards.
>
> To overcome this, read 'max-link-speed' property (as defined in PCI
> device tree bindings) and use this as max gen mode. Then iteratively try
> link training at this mode or lower until successful. After successful
> link training choose final controller gen based on Negotiated Link Speed
> from Link Status register, which should match card speed.
>
> Signed-off-by: Pali Rohár <pali@xxxxxxxxxx>
> Signed-off-by: Marek Behún <marek.behun@xxxxxx>
> ---
> drivers/pci/controller/pci-aardvark.c | 114 ++++++++++++++++++++------
> 1 file changed, 89 insertions(+), 25 deletions(-)
>

Reviewed-by: Rob Herring <robh@xxxxxxxxxx>