]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: aardvark: Use LTSSM state to build link training flag
authorRemi Pommarel <repk@triplefau.lt>
Wed, 22 May 2019 21:33:51 +0000 (23:33 +0200)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Mon, 14 Oct 2019 16:06:58 +0000 (17:06 +0100)
commit7f96f10974bcd5b20325b3cd5d374b88e8602270
treeb33b8df6652597c975cb8ac93e6bf4cd53e895d6
parentf5c4776cd5b591eea4e9be9f421e34f61b98ebb2
PCI: aardvark: Use LTSSM state to build link training flag

Aardvark's PCI_EXP_LNKSTA_LT flag in its link status register is not
implemented and does not reflect the actual link training state (the
flag is always set to 0). In order to support link re-training feature
this flag has to be emulated. The Link Training and Status State
Machine (LTSSM) flag in Aardvark LMI config register could be used as
a link training indicator. Indeed if the LTSSM is in L0 or upper state
then link training has completed (see [1]).

Unfortunately because after asking a link retraining it takes a while
for the LTSSM state to become less than 0x10 (due to L0s to recovery
state transition delays), LTSSM can still be in L0 while link training
has not finished yet. So this waits for link to be in recovery or lesser
state before returning after asking for a link retrain.

[1] "PCI Express Base Specification", REV. 4.0
    PCI Express, February 19 2014, Table 4-14

Fixes: 3168fecd14ca ("PCI: aardvark: Implement emulated root PCI bridge config space")
Tested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Acked-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
drivers/pci/controller/pci-aardvark.c