|
71 | 71 | #define IMX95_SID_MASK GENMASK(5, 0)
|
72 | 72 | #define IMX95_MAX_LUT 32
|
73 | 73 |
|
| 74 | +#define IMX95_PCIE_RST_CTRL 0x3010 |
| 75 | +#define IMX95_PCIE_COLD_RST BIT(0) |
| 76 | + |
74 | 77 | #define to_imx_pcie(x) dev_get_drvdata((x)->dev)
|
75 | 78 |
|
76 | 79 | enum imx_pcie_variants {
|
@@ -773,6 +776,43 @@ static int imx7d_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert)
|
773 | 776 | return 0;
|
774 | 777 | }
|
775 | 778 |
|
| 779 | +static int imx95_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) |
| 780 | +{ |
| 781 | + u32 val; |
| 782 | + |
| 783 | + if (assert) { |
| 784 | + /* |
| 785 | + * From i.MX95 PCIe PHY perspective, the COLD reset toggle |
| 786 | + * should be complete after power-up by the following sequence. |
| 787 | + * > 10us(at power-up) |
| 788 | + * > 10ns(warm reset) |
| 789 | + * |<------------>| |
| 790 | + * ______________ |
| 791 | + * phy_reset ____/ \________________ |
| 792 | + * ____________ |
| 793 | + * ref_clk_en_______________________/ |
| 794 | + * Toggle COLD reset aligned with this sequence for i.MX95 PCIe. |
| 795 | + */ |
| 796 | + regmap_set_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_RST_CTRL, |
| 797 | + IMX95_PCIE_COLD_RST); |
| 798 | + /* |
| 799 | + * Make sure the write to IMX95_PCIE_RST_CTRL is flushed to the |
| 800 | + * hardware by doing a read. Otherwise, there is no guarantee |
| 801 | + * that the write has reached the hardware before udelay(). |
| 802 | + */ |
| 803 | + regmap_read_bypassed(imx_pcie->iomuxc_gpr, IMX95_PCIE_RST_CTRL, |
| 804 | + &val); |
| 805 | + udelay(15); |
| 806 | + regmap_clear_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_RST_CTRL, |
| 807 | + IMX95_PCIE_COLD_RST); |
| 808 | + regmap_read_bypassed(imx_pcie->iomuxc_gpr, IMX95_PCIE_RST_CTRL, |
| 809 | + &val); |
| 810 | + udelay(10); |
| 811 | + } |
| 812 | + |
| 813 | + return 0; |
| 814 | +} |
| 815 | + |
776 | 816 | static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie)
|
777 | 817 | {
|
778 | 818 | reset_control_assert(imx_pcie->pciephy_reset);
|
@@ -1739,6 +1779,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
|
1739 | 1779 | .ltssm_mask = IMX95_PCIE_LTSSM_EN,
|
1740 | 1780 | .mode_off[0] = IMX95_PE0_GEN_CTRL_1,
|
1741 | 1781 | .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE,
|
| 1782 | + .core_reset = imx95_pcie_core_reset, |
1742 | 1783 | .init_phy = imx95_pcie_init_phy,
|
1743 | 1784 | },
|
1744 | 1785 | [IMX8MQ_EP] = {
|
@@ -1792,6 +1833,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
|
1792 | 1833 | .mode_off[0] = IMX95_PE0_GEN_CTRL_1,
|
1793 | 1834 | .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE,
|
1794 | 1835 | .init_phy = imx95_pcie_init_phy,
|
| 1836 | + .core_reset = imx95_pcie_core_reset, |
1795 | 1837 | .epc_features = &imx95_pcie_epc_features,
|
1796 | 1838 | .mode = DW_PCIE_EP_TYPE,
|
1797 | 1839 | },
|
|
0 commit comments