Skip to content

Commit 68bc10b

Browse files
Trent PiephoLorenzo Pieralisi
authored andcommitted
PCI: imx6: Fix link training status detection in link up check
This bug was introduced in the interaction for two commits on either branch of the merge commit 562df5c ("Merge branch 'pci/host-designware' into next"). Commit 4d107d3 ("PCI: imx6: Move link up check into imx6_pcie_wait_for_link()"), changed imx6_pcie_wait_for_link() to poll the link status register directly, checking for link up and not training, and made imx6_pcie_link_up() only check the link up bit (once, not a polling loop). While commit 886bc5c ("PCI: designware: Add generic dw_pcie_wait_for_link()"), replaced the loop in imx6_pcie_wait_for_link() with a call to a new dwc core function, which polled imx6_pcie_link_up(), which still checked both link up and not training in a loop. When these two commits were merged, the version of imx6_pcie_wait_for_link() from 886bc5c was kept, which eliminated the link training check placed there by 4d107d3. However, the version of imx6_pcie_link_up() from 4d107d3 was kept, which eliminated the link training check that had been there and was moved to imx6_pcie_wait_for_link(). The result was the link training check got lost for the imx6 driver. Eliminate imx6_pcie_link_up() so that the default handler, dw_pcie_link_up(), is used instead. The default handler has the correct code, which checks for link up and also that it still is not training, fixing the regression. Fixes: 562df5c ("Merge branch 'pci/host-designware' into next") Signed-off-by: Trent Piepho <tpiepho@impinj.com> [lorenzo.pieralisi@arm.com: rewrote the commit log] Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Joao Pinto <Joao.Pinto@synopsys.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Richard Zhu <hongxing.zhu@nxp.com>
1 parent 6510223 commit 68bc10b

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

‎drivers/pci/controller/dwc/pci-imx6.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ struct imx6_pcie {
8181
#define PCIE_PL_PFLR_FORCE_LINK (1 << 15)
8282
#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
8383
#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
84-
#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29)
85-
#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP (1 << 4)
8684

8785
#define PCIE_PHY_CTRL (PL_OFFSET + 0x114)
8886
#define PCIE_PHY_CTRL_DATA_LOC 0
@@ -711,12 +709,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp)
711709
return 0;
712710
}
713711

714-
static int imx6_pcie_link_up(struct dw_pcie *pci)
715-
{
716-
return dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1) &
717-
PCIE_PHY_DEBUG_R1_XMLH_LINK_UP;
718-
}
719-
720712
static const struct dw_pcie_host_ops imx6_pcie_host_ops = {
721713
.host_init = imx6_pcie_host_init,
722714
};
@@ -749,7 +741,7 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie,
749741
}
750742

751743
static const struct dw_pcie_ops dw_pcie_ops = {
752-
.link_up = imx6_pcie_link_up,
744+
/* No special ops needed, but pcie-designware still expects this struct */
753745
};
754746

755747
#ifdef CONFIG_PM_SLEEP

0 commit comments

Comments
 (0)