|
45 | 45 | #define IMX95_PCIE_PHY_GEN_CTRL 0x0
|
46 | 46 | #define IMX95_PCIE_REF_USE_PAD BIT(17)
|
47 | 47 |
|
| 48 | +#define IMX95_PCIE_PHY_MPLLA_CTRL 0x10 |
| 49 | +#define IMX95_PCIE_PHY_MPLL_STATE BIT(30) |
| 50 | + |
48 | 51 | #define IMX95_PCIE_SS_RW_REG_0 0xf0
|
49 | 52 | #define IMX95_PCIE_REF_CLKEN BIT(23)
|
50 | 53 | #define IMX95_PCIE_PHY_CR_PARA_SEL BIT(9)
|
@@ -132,6 +135,7 @@ struct imx_pcie_drvdata {
|
132 | 135 | int (*init_phy)(struct imx_pcie *pcie);
|
133 | 136 | int (*enable_ref_clk)(struct imx_pcie *pcie, bool enable);
|
134 | 137 | int (*core_reset)(struct imx_pcie *pcie, bool assert);
|
| 138 | + int (*wait_pll_lock)(struct imx_pcie *pcie); |
135 | 139 | const struct dw_pcie_host_ops *ops;
|
136 | 140 | };
|
137 | 141 |
|
@@ -479,6 +483,23 @@ static void imx7d_pcie_wait_for_phy_pll_lock(struct imx_pcie *imx_pcie)
|
479 | 483 | dev_err(dev, "PCIe PLL lock timeout\n");
|
480 | 484 | }
|
481 | 485 |
|
| 486 | +static int imx95_pcie_wait_for_phy_pll_lock(struct imx_pcie *imx_pcie) |
| 487 | +{ |
| 488 | + u32 val; |
| 489 | + struct device *dev = imx_pcie->pci->dev; |
| 490 | + |
| 491 | + if (regmap_read_poll_timeout(imx_pcie->iomuxc_gpr, |
| 492 | + IMX95_PCIE_PHY_MPLLA_CTRL, val, |
| 493 | + val & IMX95_PCIE_PHY_MPLL_STATE, |
| 494 | + PHY_PLL_LOCK_WAIT_USLEEP_MAX, |
| 495 | + PHY_PLL_LOCK_WAIT_TIMEOUT)) { |
| 496 | + dev_err(dev, "PCIe PLL lock timeout\n"); |
| 497 | + return -ETIMEDOUT; |
| 498 | + } |
| 499 | + |
| 500 | + return 0; |
| 501 | +} |
| 502 | + |
482 | 503 | static int imx_setup_phy_mpll(struct imx_pcie *imx_pcie)
|
483 | 504 | {
|
484 | 505 | unsigned long phy_rate = 0;
|
@@ -1225,6 +1246,12 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
|
1225 | 1246 | goto err_phy_off;
|
1226 | 1247 | }
|
1227 | 1248 |
|
| 1249 | + if (imx_pcie->drvdata->wait_pll_lock) { |
| 1250 | + ret = imx_pcie->drvdata->wait_pll_lock(imx_pcie); |
| 1251 | + if (ret < 0) |
| 1252 | + goto err_phy_off; |
| 1253 | + } |
| 1254 | + |
1228 | 1255 | imx_setup_phy_mpll(imx_pcie);
|
1229 | 1256 |
|
1230 | 1257 | return 0;
|
@@ -1826,6 +1853,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
|
1826 | 1853 | .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE,
|
1827 | 1854 | .core_reset = imx95_pcie_core_reset,
|
1828 | 1855 | .init_phy = imx95_pcie_init_phy,
|
| 1856 | + .wait_pll_lock = imx95_pcie_wait_for_phy_pll_lock, |
1829 | 1857 | },
|
1830 | 1858 | [IMX8MQ_EP] = {
|
1831 | 1859 | .variant = IMX8MQ_EP,
|
@@ -1880,6 +1908,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
|
1880 | 1908 | .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE,
|
1881 | 1909 | .init_phy = imx95_pcie_init_phy,
|
1882 | 1910 | .core_reset = imx95_pcie_core_reset,
|
| 1911 | + .wait_pll_lock = imx95_pcie_wait_for_phy_pll_lock, |
1883 | 1912 | .epc_features = &imx95_pcie_epc_features,
|
1884 | 1913 | .mode = DW_PCIE_EP_TYPE,
|
1885 | 1914 | },
|
|
0 commit comments