Skip to content

Commit 9c03e30

Browse files
Richard ZhuMani-Sadhasivam
authored andcommitted
PCI: imx6: Skip link up workaround for newer platforms
The current link setup procedure has one workaround to detect the devices behind PCIe switches on some i.MX6 platforms. But this workaround is not needed on recent i.MX7 platforms. So skip the workaround for platforms that do not set the flag and start LTSSM directly. Also, change the flag name from IMX_PCIE_FLAG_IMX_SPEED_CHANGE to IMX_PCIE_FLAG_SPEED_CHANGE_WORKAROUND to match the usecase. Signed-off-by: Richard Zhu <[email protected]> [mani: subject and description rewording] Signed-off-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Frank Li <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 0af2f6b commit 9c03e30

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

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

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ enum imx_pcie_variants {
9191
};
9292

9393
#define IMX_PCIE_FLAG_IMX_PHY BIT(0)
94-
#define IMX_PCIE_FLAG_IMX_SPEED_CHANGE BIT(1)
94+
#define IMX_PCIE_FLAG_SPEED_CHANGE_WORKAROUND BIT(1)
9595
#define IMX_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2)
9696
#define IMX_PCIE_FLAG_HAS_PHYDRV BIT(3)
9797
#define IMX_PCIE_FLAG_HAS_APP_RESET BIT(4)
@@ -860,6 +860,12 @@ static int imx_pcie_start_link(struct dw_pcie *pci)
860860
u32 tmp;
861861
int ret;
862862

863+
if (!(imx_pcie->drvdata->flags &
864+
IMX_PCIE_FLAG_SPEED_CHANGE_WORKAROUND)) {
865+
imx_pcie_ltssm_enable(dev);
866+
return 0;
867+
}
868+
863869
/*
864870
* Force Gen1 operation when starting the link. In case the link is
865871
* started in Gen2 mode, there is a possibility the devices on the
@@ -896,22 +902,10 @@ static int imx_pcie_start_link(struct dw_pcie *pci)
896902
dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp);
897903
dw_pcie_dbi_ro_wr_dis(pci);
898904

899-
if (imx_pcie->drvdata->flags &
900-
IMX_PCIE_FLAG_IMX_SPEED_CHANGE) {
901-
902-
/*
903-
* On i.MX7, DIRECT_SPEED_CHANGE behaves differently
904-
* from i.MX6 family when no link speed transition
905-
* occurs and we go Gen1 -> yep, Gen1. The difference
906-
* is that, in such case, it will not be cleared by HW
907-
* which will cause the following code to report false
908-
* failure.
909-
*/
910-
ret = imx_pcie_wait_for_speed_change(imx_pcie);
911-
if (ret) {
912-
dev_err(dev, "Failed to bring link up!\n");
913-
goto err_reset_phy;
914-
}
905+
ret = imx_pcie_wait_for_speed_change(imx_pcie);
906+
if (ret) {
907+
dev_err(dev, "Failed to bring link up!\n");
908+
goto err_reset_phy;
915909
}
916910

917911
/* Make sure link training is finished as well! */
@@ -1649,7 +1643,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
16491643
[IMX6Q] = {
16501644
.variant = IMX6Q,
16511645
.flags = IMX_PCIE_FLAG_IMX_PHY |
1652-
IMX_PCIE_FLAG_IMX_SPEED_CHANGE |
1646+
IMX_PCIE_FLAG_SPEED_CHANGE_WORKAROUND |
16531647
IMX_PCIE_FLAG_BROKEN_SUSPEND |
16541648
IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
16551649
.dbi_length = 0x200,
@@ -1665,7 +1659,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
16651659
[IMX6SX] = {
16661660
.variant = IMX6SX,
16671661
.flags = IMX_PCIE_FLAG_IMX_PHY |
1668-
IMX_PCIE_FLAG_IMX_SPEED_CHANGE |
1662+
IMX_PCIE_FLAG_SPEED_CHANGE_WORKAROUND |
16691663
IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
16701664
.gpr = "fsl,imx6q-iomuxc-gpr",
16711665
.ltssm_off = IOMUXC_GPR12,
@@ -1680,7 +1674,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
16801674
[IMX6QP] = {
16811675
.variant = IMX6QP,
16821676
.flags = IMX_PCIE_FLAG_IMX_PHY |
1683-
IMX_PCIE_FLAG_IMX_SPEED_CHANGE |
1677+
IMX_PCIE_FLAG_SPEED_CHANGE_WORKAROUND |
16841678
IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
16851679
.dbi_length = 0x200,
16861680
.gpr = "fsl,imx6q-iomuxc-gpr",

0 commit comments

Comments
 (0)