Until commit 4d107d3b5a68 ("PCI: imx6: Move link up check into imx6_pcie_wait_for_link()") the driver relied on both LINK_UP and LINK_IN_TRAINING to determine if PCIE link was up.
I can't seem to find out why, but code using LINK_IN_TRAINING seem to disappear after commit 886bc5ceb5cc ("PCI: designware: Add generic dw_pcie_wait_for_link()") and from then on only LINK_UP seems to be tested (dw_pcie_wait_for_link() -> dw_pcie_link_up() -> imx6_pcie_link_up()). At the same time the default behavior of dw_pcie_link_up() went from using just LINK_UP in commit dac29e6c5460 ("PCI: designware: Add default link up check if sub-driver doesn't override") to using both LINK_IN_TRAINING and LINK_UP in commit 01c076732e82 ("PCI: designware: Check LTSSM training bit before deciding link is up"). Given all that it seems that i.MX6 doesn't really need a special .link_up() callback and imx6_pcie_link_up() can be dropped. Cc: Lorenzo Pieralisi <lorenzo.pieral...@arm.com> Cc: Bjorn Helgaas <bhelg...@google.com> Cc: Fabio Estevam <fabio.este...@nxp.com> Cc: Chris Healy <cphe...@gmail.com> Cc: Lucas Stach <l.st...@pengutronix.de> Cc: Leonard Crestez <leonard.cres...@nxp.com> Cc: "A.s. Dong" <aisheng.d...@nxp.com> Cc: Richard Zhu <hongxing....@nxp.com> Cc: linux-...@nxp.com Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-...@vger.kernel.org Signed-off-by: Andrey Smirnov <andrew.smir...@gmail.com> --- drivers/pci/controller/dwc/pci-imx6.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 937d630f8c9d..74faca11eeae 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -84,8 +84,6 @@ struct imx6_pcie { #define PL_OFFSET 0x700 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) -#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) -#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP (1 << 4) #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) #define PCIE_PHY_CTRL_DATA_LOC 0 @@ -732,12 +730,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp) return 0; } -static int imx6_pcie_link_up(struct dw_pcie *pci) -{ - return dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1) & - PCIE_PHY_DEBUG_R1_XMLH_LINK_UP; -} - static const struct dw_pcie_host_ops imx6_pcie_host_ops = { .host_init = imx6_pcie_host_init, }; @@ -769,9 +761,7 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie, return 0; } -static const struct dw_pcie_ops dw_pcie_ops = { - .link_up = imx6_pcie_link_up, -}; +static const struct dw_pcie_ops dw_pcie_ops; #ifdef CONFIG_PM_SLEEP static void imx6_pcie_ltssm_disable(struct device *dev) -- 2.19.1