@@ -69,6 +69,7 @@ enum imx6_pcie_variants {
6969 IMX8MQ_EP ,
7070 IMX8MM_EP ,
7171 IMX8MP_EP ,
72+ IMX95_EP ,
7273};
7374
7475#define IMX6_PCIE_FLAG_IMX6_PHY BIT(0)
@@ -78,6 +79,7 @@ enum imx6_pcie_variants {
7879#define IMX6_PCIE_FLAG_HAS_APP_RESET BIT(4)
7980#define IMX6_PCIE_FLAG_HAS_PHY_RESET BIT(5)
8081#define IMX6_PCIE_FLAG_HAS_SERDES BIT(6)
82+ #define IMX6_PCIE_FLAG_SUPPORT_64BIT BIT(7)
8183
8284#define imx6_check_flag (pci , val ) (pci->drvdata->flags & val)
8385
@@ -610,6 +612,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
610612 break ;
611613 case IMX7D :
612614 case IMX95 :
615+ case IMX95_EP :
613616 break ;
614617 case IMX8MM :
615618 case IMX8MM_EP :
@@ -1044,6 +1047,23 @@ static const struct pci_epc_features imx8m_pcie_epc_features = {
10441047 .align = SZ_64K ,
10451048};
10461049
1050+ /*
1051+ * BAR# | Default BAR enable | Default BAR Type | Default BAR Size | BAR Sizing Scheme
1052+ * ================================================================================================
1053+ * BAR0 | Enable | 64-bit | 1 MB | Programmable Size
1054+ * BAR1 | Disable | 32-bit | 64 KB | Fixed Size
1055+ * BAR1 should be disabled if BAR0 is 64bit.
1056+ * BAR2 | Enable | 32-bit | 1 MB | Programmable Size
1057+ * BAR3 | Enable | 32-bit | 64 KB | Programmable Size
1058+ * BAR4 | Enable | 32-bit | 1M | Programmable Size
1059+ * BAR5 | Enable | 32-bit | 64 KB | Programmable Size
1060+ */
1061+ static const struct pci_epc_features imx95_pcie_epc_features = {
1062+ .msi_capable = true,
1063+ .bar [BAR_1 ] = { .type = BAR_FIXED , .fixed_size = SZ_64K , },
1064+ .align = SZ_4K ,
1065+ };
1066+
10471067static const struct pci_epc_features *
10481068imx6_pcie_ep_get_features (struct dw_pcie_ep * ep )
10491069{
@@ -1086,6 +1106,18 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie,
10861106
10871107 pci -> dbi_base2 = pci -> dbi_base + pcie_dbi2_offset ;
10881108
1109+ /*
1110+ * FIXME: Ideally, dbi2 base address should come from DT. But since only IMX95 is defining
1111+ * "dbi2" in DT, "dbi_base2" is set to NULL here for that platform alone so that the DWC
1112+ * core code can fetch that from DT. But once all platform DTs were fixed, this and the
1113+ * above "dbi_base2" setting should be removed.
1114+ */
1115+ if (device_property_match_string (dev , "reg-names" , "dbi2" ) >= 0 )
1116+ pci -> dbi_base2 = NULL ;
1117+
1118+ if (imx6_check_flag (imx6_pcie , IMX6_PCIE_FLAG_SUPPORT_64BIT ))
1119+ dma_set_mask_and_coherent (dev , DMA_BIT_MASK (64 ));
1120+
10891121 ret = dw_pcie_ep_init (ep );
10901122 if (ret ) {
10911123 dev_err (dev , "failed to initialize endpoint\n" );
@@ -1556,6 +1588,20 @@ static const struct imx6_pcie_drvdata drvdata[] = {
15561588 .mode_mask [0 ] = IMX6Q_GPR12_DEVICE_TYPE ,
15571589 .epc_features = & imx8m_pcie_epc_features ,
15581590 },
1591+ [IMX95_EP ] = {
1592+ .variant = IMX95_EP ,
1593+ .flags = IMX6_PCIE_FLAG_HAS_SERDES |
1594+ IMX6_PCIE_FLAG_SUPPORT_64BIT ,
1595+ .clk_names = imx8mq_clks ,
1596+ .clks_cnt = ARRAY_SIZE (imx8mq_clks ),
1597+ .ltssm_off = IMX95_PE0_GEN_CTRL_3 ,
1598+ .ltssm_mask = IMX95_PCIE_LTSSM_EN ,
1599+ .mode_off [0 ] = IMX95_PE0_GEN_CTRL_1 ,
1600+ .mode_mask [0 ] = IMX95_PCIE_DEVICE_TYPE ,
1601+ .init_phy = imx95_pcie_init_phy ,
1602+ .epc_features = & imx95_pcie_epc_features ,
1603+ .mode = DW_PCIE_EP_TYPE ,
1604+ },
15591605};
15601606
15611607static const struct of_device_id imx6_pcie_of_match [] = {
@@ -1570,6 +1616,7 @@ static const struct of_device_id imx6_pcie_of_match[] = {
15701616 { .compatible = "fsl,imx8mq-pcie-ep" , .data = & drvdata [IMX8MQ_EP ], },
15711617 { .compatible = "fsl,imx8mm-pcie-ep" , .data = & drvdata [IMX8MM_EP ], },
15721618 { .compatible = "fsl,imx8mp-pcie-ep" , .data = & drvdata [IMX8MP_EP ], },
1619+ { .compatible = "fsl,imx95-pcie-ep" , .data = & drvdata [IMX95_EP ], },
15731620 {},
15741621};
15751622
0 commit comments