Skip to content
/ linux Public

Commit aacb5f1

Browse files
Richard ZhuSasha Levin
authored andcommitted
PCI: dwc: Skip waiting for L2/L3 Ready if dw_pcie_rp::skip_l23_wait is true
[ Upstream commit 58a17b2 ] In NXP i.MX6QP and i.MX7D SoCs, LTSSM registers are not accessible once PME_Turn_Off message is broadcasted to the link. So there is no way to verify whether the link has entered L2/L3 Ready state or not. Hence, add a new flag 'dw_pcie_rp::skip_l23_ready' and set it to 'true' for the above mentioned SoCs. This flag when set, will allow the DWC core to skip polling for L2/L3 Ready state and just wait for 10ms as recommended in the PCIe spec r6.0, sec 5.3.3.2.1. Fixes: a528d1a ("PCI: imx6: Use DWC common suspend resume method") Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> [mani: renamed flag to skip_l23_ready and reworded description] Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260114083300.3689672-2-hongxing.zhu@nxp.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 42d9509 commit aacb5f1

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ enum imx_pcie_variants {
116116
#define IMX_PCIE_FLAG_BROKEN_SUSPEND BIT(9)
117117
#define IMX_PCIE_FLAG_HAS_LUT BIT(10)
118118
#define IMX_PCIE_FLAG_8GT_ECN_ERR051586 BIT(11)
119+
#define IMX_PCIE_FLAG_SKIP_L23_READY BIT(12)
119120

120121
#define imx_check_flag(pci, val) (pci->drvdata->flags & val)
121122

@@ -1795,6 +1796,8 @@ static int imx_pcie_probe(struct platform_device *pdev)
17951796
*/
17961797
imx_pcie_add_lut_by_rid(imx_pcie, 0);
17971798
} else {
1799+
if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_SKIP_L23_READY))
1800+
pci->pp.skip_l23_ready = true;
17981801
pci->pp.use_atu_msg = true;
17991802
ret = dw_pcie_host_init(&pci->pp);
18001803
if (ret < 0)
@@ -1856,6 +1859,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
18561859
.variant = IMX6QP,
18571860
.flags = IMX_PCIE_FLAG_IMX_PHY |
18581861
IMX_PCIE_FLAG_SPEED_CHANGE_WORKAROUND |
1862+
IMX_PCIE_FLAG_SKIP_L23_READY |
18591863
IMX_PCIE_FLAG_SUPPORTS_SUSPEND,
18601864
.dbi_length = 0x200,
18611865
.gpr = "fsl,imx6q-iomuxc-gpr",
@@ -1872,6 +1876,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
18721876
.variant = IMX7D,
18731877
.flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND |
18741878
IMX_PCIE_FLAG_HAS_APP_RESET |
1879+
IMX_PCIE_FLAG_SKIP_L23_READY |
18751880
IMX_PCIE_FLAG_HAS_PHY_RESET,
18761881
.gpr = "fsl,imx7d-iomuxc-gpr",
18771882
.mode_off[0] = IOMUXC_GPR12,

drivers/pci/controller/dwc/pcie-designware-host.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,16 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci)
11611161
return ret;
11621162
}
11631163

1164+
/*
1165+
* Some SoCs do not support reading the LTSSM register after
1166+
* PME_Turn_Off broadcast. For those SoCs, skip waiting for L2/L3 Ready
1167+
* state and wait 10ms as recommended in PCIe spec r6.0, sec 5.3.3.2.1.
1168+
*/
1169+
if (pci->pp.skip_l23_ready) {
1170+
mdelay(PCIE_PME_TO_L2_TIMEOUT_US/1000);
1171+
goto stop_link;
1172+
}
1173+
11641174
ret = read_poll_timeout(dw_pcie_get_ltssm, val,
11651175
val == DW_PCIE_LTSSM_L2_IDLE ||
11661176
val <= DW_PCIE_LTSSM_DETECT_WAIT,

drivers/pci/controller/dwc/pcie-designware.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ struct dw_pcie_rp {
430430
struct pci_config_window *cfg;
431431
bool ecam_enabled;
432432
bool native_ecam;
433+
bool skip_l23_ready;
433434
};
434435

435436
struct dw_pcie_ep_ops {

0 commit comments

Comments
 (0)