Skip to content

Commit fd8e0e4

Browse files
author
Richard Zhu
committed
LF-3103 phy: freescale: pcie: fix the imx8mp evk ep rc link degrade issue
Refine commit 17db82300f80 ("MLK-25089 phy: freescale: pcie: fix the imx8mp evk ep rc link speed issue") Fine tune the PHY parameters, let the PCIe link up to GEN3 between two i.MX865 EVK boards in the i.MX EP RC validation system. Since this fine tuned is only specified for EVK boards. Add the command parameter to specify it when do the EP RC tests between two i.MX8MP EVK boards. Use the "pcie_phy_tuned=yes" to enable the PHY fine-tune. Signed-off-by: Richard Zhu <[email protected]> Reviewed-by: Peter Chen <[email protected]> (cherry picked from commit 2ab5581a1448bf24a37f8082ffe725a54ce09b5e)
1 parent 0ff86d2 commit fd8e0e4

1 file changed

Lines changed: 42 additions & 28 deletions

File tree

drivers/phy/freescale/phy-fsl-imx8-pcie.c

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#define IMX8MP_PCIE_PHY_TRSV_REG206 0x738
6363
#define LN0_TG_RX_SIGVAL_LBF_DELAY 0x4
6464

65+
static int imx8_pcie_phy_tuned;
6566
struct imx8_pcie_phy {
6667
struct phy *phy;
6768
struct clk *clk;
@@ -135,34 +136,36 @@ static int imx8_pcie_phy_cal(struct phy *phy)
135136
* Fine tune the parameters of the PHY, let PCIe link up to GEN3
136137
* between two EVK boards in the EP/RC validation system.
137138
*/
138-
writel(LN0_OVRD_TX_DRV_LVL,
139-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG001);
140-
writel(LN0_OVRD_TX_DRV_PST_LVL_G1,
141-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG005);
142-
writel(LN0_OVRD_TX_DRV_PST_LVL_G2,
143-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG006);
144-
writel(LN0_OVRD_TX_DRV_PST_LVL_G3,
145-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG007);
146-
writel(LN0_OVRD_TX_DRV_PRE_LVL_G1,
147-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG009);
148-
writel(LN0_OVRD_RX_CTLE_RS1_G1,
149-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG059);
150-
writel(LN0_OVRD_RX_CTLE_RS1_G2_G3,
151-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG060);
152-
writel(LN0_ANA_RX_CTLE_IBLEED,
153-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG069);
154-
writel(LN0_OVRD_RX_RTERM_VCM_EN,
155-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG107);
156-
writel(LN0_ANA_OVRD_RX_SQHS_DIFN_OC,
157-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG109);
158-
writel(LN0_ANA_OVRD_RX_SQHS_DIFP_OC,
159-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG110);
160-
writel(LN0_RX_CDR_FBB_FINE_G1_G2,
161-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG158);
162-
writel(LN0_RX_CDR_FBB_FINE_G3_G4,
163-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG159);
164-
writel(LN0_TG_RX_SIGVAL_LBF_DELAY,
165-
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG206);
139+
if (imx8_pcie_phy_tuned) {
140+
writel(LN0_OVRD_TX_DRV_LVL,
141+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG001);
142+
writel(LN0_OVRD_TX_DRV_PST_LVL_G1,
143+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG005);
144+
writel(LN0_OVRD_TX_DRV_PST_LVL_G2,
145+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG006);
146+
writel(LN0_OVRD_TX_DRV_PST_LVL_G3,
147+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG007);
148+
writel(LN0_OVRD_TX_DRV_PRE_LVL_G1,
149+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG009);
150+
writel(LN0_OVRD_RX_CTLE_RS1_G1,
151+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG059);
152+
writel(LN0_OVRD_RX_CTLE_RS1_G2_G3,
153+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG060);
154+
writel(LN0_ANA_RX_CTLE_IBLEED,
155+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG069);
156+
writel(LN0_OVRD_RX_RTERM_VCM_EN,
157+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG107);
158+
writel(LN0_ANA_OVRD_RX_SQHS_DIFN_OC,
159+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG109);
160+
writel(LN0_ANA_OVRD_RX_SQHS_DIFP_OC,
161+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG110);
162+
writel(LN0_RX_CDR_FBB_FINE_G1_G2,
163+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG158);
164+
writel(LN0_RX_CDR_FBB_FINE_G3_G4,
165+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG159);
166+
writel(LN0_TG_RX_SIGVAL_LBF_DELAY,
167+
imx8_phy->base + IMX8MP_PCIE_PHY_TRSV_REG206);
168+
}
166169

167170
writel(PLL_ANA_LPF_R_SEL_FINE_0_4,
168171
imx8_phy->base + IMX8MP_PCIE_PHY_CMN_REG020);
@@ -198,6 +201,17 @@ static struct phy_ops imx8_pcie_phy_ops = {
198201
.owner = THIS_MODULE,
199202
};
200203

204+
static int __init imx8_pcie_phy_fine_tune(char *str)
205+
{
206+
if (!strcmp(str, "yes")) {
207+
pr_info("i.MX PCIe PHY is fine tuned in EP/RC SYS.\n");
208+
imx8_pcie_phy_tuned = 1;
209+
}
210+
return 1;
211+
}
212+
213+
__setup("pcie_phy_tuned=", imx8_pcie_phy_fine_tune);
214+
201215
static int imx8_pcie_phy_probe(struct platform_device *pdev)
202216
{
203217
u32 val = 0;

0 commit comments

Comments
 (0)