Skip to content

Commit 4a4be0c

Browse files
Richard ZhuMani-Sadhasivam
authored andcommitted
PCI: imx6: Call dw_pcie_wait_for_link() from start_link() callback only when required
Since the DWC driver is already calling dw_pcie_wait_for_link() after calling the start_link() callback, remove the redundant dw_pcie_wait_for_link() call from imx_pcie_start_link(). It is still required to call this function for controllers supporting Gen 2 and higher link speeds. Suggested-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Richard Zhu <[email protected]> [mani: subject and description rewording] Signed-off-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 9c03e30 commit 4a4be0c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -881,11 +881,11 @@ static int imx_pcie_start_link(struct dw_pcie *pci)
881881
/* Start LTSSM. */
882882
imx_pcie_ltssm_enable(dev);
883883

884-
ret = dw_pcie_wait_for_link(pci);
885-
if (ret)
886-
goto err_reset_phy;
887-
888884
if (pci->max_link_speed > 1) {
885+
ret = dw_pcie_wait_for_link(pci);
886+
if (ret)
887+
goto err_reset_phy;
888+
889889
/* Allow faster modes after the link is up */
890890
dw_pcie_dbi_ro_wr_en(pci);
891891
tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
@@ -907,17 +907,10 @@ static int imx_pcie_start_link(struct dw_pcie *pci)
907907
dev_err(dev, "Failed to bring link up!\n");
908908
goto err_reset_phy;
909909
}
910-
911-
/* Make sure link training is finished as well! */
912-
ret = dw_pcie_wait_for_link(pci);
913-
if (ret)
914-
goto err_reset_phy;
915910
} else {
916911
dev_info(dev, "Link: Only Gen1 is enabled\n");
917912
}
918913

919-
tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA);
920-
dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS);
921914
return 0;
922915

923916
err_reset_phy:

0 commit comments

Comments
 (0)