Skip to content

Commit ed1e200

Browse files
committed
Merge branch 'pci/controller/imx6'
- Add IMX8MQ_EP third 64-bit BAR in epc_features (Richard Zhu) - Add IMX8MM_EP and IMX8MP_EP fixed 256-byte BAR 4 in epc_features (Richard Zhu) - Factor imx_pcie_add_lut_by_rid() out of imx_pcie_enable_device() for use by LUT configuration (Frank Li) - Configure LUT for MSI/IOMMU in Endpoint mode so Root Complex can trigger doorbel on Endpoint (Frank Li) - Remove apps_reset (LTSSM_EN) from imx_pcie_{assert,deassert}_core_reset(), which fixes a hotplug regression on i.MX8MM (Richard Zhu) - Delay Endpoint link start until configfs 'start' written (Richard Zhu) * pci/controller/imx6: PCI: imx6: Delay link start until configfs 'start' written PCI: imx6: Remove apps_reset toggling from imx_pcie_{assert/deassert}_core_reset PCI: imx6: Add LUT configuration for MSI/IOMMU in Endpoint mode PCI: imx6: Add helper function imx_pcie_add_lut_by_rid() PCI: imx6: Add IMX8MM_EP and IMX8MP_EP fixed 256-byte BAR 4 in epc_features PCI: imx6: Add IMX8MQ_EP third 64-bit BAR in epc_features
2 parents 4cf1713 + 2e6ea70 commit ed1e200

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

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

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,6 @@ static int imx95_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert)
860860
static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie)
861861
{
862862
reset_control_assert(imx_pcie->pciephy_reset);
863-
reset_control_assert(imx_pcie->apps_reset);
864863

865864
if (imx_pcie->drvdata->core_reset)
866865
imx_pcie->drvdata->core_reset(imx_pcie, true);
@@ -872,7 +871,6 @@ static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie)
872871
static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie)
873872
{
874873
reset_control_deassert(imx_pcie->pciephy_reset);
875-
reset_control_deassert(imx_pcie->apps_reset);
876874

877875
if (imx_pcie->drvdata->core_reset)
878876
imx_pcie->drvdata->core_reset(imx_pcie, false);
@@ -1063,7 +1061,10 @@ static int imx_pcie_add_lut(struct imx_pcie *imx_pcie, u16 rid, u8 sid)
10631061
data1 |= IMX95_PE0_LUT_VLD;
10641062
regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA1, data1);
10651063

1066-
data2 = IMX95_PE0_LUT_MASK; /* Match all bits of RID */
1064+
if (imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE)
1065+
data2 = 0x7; /* In the EP mode, only 'Device ID' is required */
1066+
else
1067+
data2 = IMX95_PE0_LUT_MASK; /* Match all bits of RID */
10671068
data2 |= FIELD_PREP(IMX95_PE0_LUT_REQID, rid);
10681069
regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA2, data2);
10691070

@@ -1096,18 +1097,14 @@ static void imx_pcie_remove_lut(struct imx_pcie *imx_pcie, u16 rid)
10961097
}
10971098
}
10981099

1099-
static int imx_pcie_enable_device(struct pci_host_bridge *bridge,
1100-
struct pci_dev *pdev)
1100+
static int imx_pcie_add_lut_by_rid(struct imx_pcie *imx_pcie, u32 rid)
11011101
{
1102-
struct imx_pcie *imx_pcie = to_imx_pcie(to_dw_pcie_from_pp(bridge->sysdata));
1103-
u32 sid_i, sid_m, rid = pci_dev_id(pdev);
1102+
struct device *dev = imx_pcie->pci->dev;
11041103
struct device_node *target;
1105-
struct device *dev;
1104+
u32 sid_i, sid_m;
11061105
int err_i, err_m;
11071106
u32 sid = 0;
11081107

1109-
dev = imx_pcie->pci->dev;
1110-
11111108
target = NULL;
11121109
err_i = of_map_id(dev->of_node, rid, "iommu-map", "iommu-map-mask",
11131110
&target, &sid_i);
@@ -1182,6 +1179,13 @@ static int imx_pcie_enable_device(struct pci_host_bridge *bridge,
11821179
return imx_pcie_add_lut(imx_pcie, rid, sid);
11831180
}
11841181

1182+
static int imx_pcie_enable_device(struct pci_host_bridge *bridge, struct pci_dev *pdev)
1183+
{
1184+
struct imx_pcie *imx_pcie = to_imx_pcie(to_dw_pcie_from_pp(bridge->sysdata));
1185+
1186+
return imx_pcie_add_lut_by_rid(imx_pcie, pci_dev_id(pdev));
1187+
}
1188+
11851189
static void imx_pcie_disable_device(struct pci_host_bridge *bridge,
11861190
struct pci_dev *pdev)
11871191
{
@@ -1247,6 +1251,9 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
12471251
}
12481252
}
12491253

1254+
/* Make sure that PCIe LTSSM is cleared */
1255+
imx_pcie_ltssm_disable(dev);
1256+
12501257
ret = imx_pcie_deassert_core_reset(imx_pcie);
12511258
if (ret < 0) {
12521259
dev_err(dev, "pcie deassert core reset failed: %d\n", ret);
@@ -1385,6 +1392,8 @@ static const struct pci_epc_features imx8m_pcie_epc_features = {
13851392
.msix_capable = false,
13861393
.bar[BAR_1] = { .type = BAR_RESERVED, },
13871394
.bar[BAR_3] = { .type = BAR_RESERVED, },
1395+
.bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = SZ_256, },
1396+
.bar[BAR_5] = { .type = BAR_RESERVED, },
13881397
.align = SZ_64K,
13891398
};
13901399

@@ -1465,9 +1474,6 @@ static int imx_add_pcie_ep(struct imx_pcie *imx_pcie,
14651474

14661475
pci_epc_init_notify(ep->epc);
14671476

1468-
/* Start LTSSM. */
1469-
imx_pcie_ltssm_enable(dev);
1470-
14711477
return 0;
14721478
}
14731479

@@ -1764,6 +1770,12 @@ static int imx_pcie_probe(struct platform_device *pdev)
17641770
ret = imx_add_pcie_ep(imx_pcie, pdev);
17651771
if (ret < 0)
17661772
return ret;
1773+
1774+
/*
1775+
* FIXME: Only single Device (EPF) is supported due to the
1776+
* Endpoint framework limitation.
1777+
*/
1778+
imx_pcie_add_lut_by_rid(imx_pcie, 0);
17671779
} else {
17681780
pci->pp.use_atu_msg = true;
17691781
ret = dw_pcie_host_init(&pci->pp);
@@ -1912,7 +1924,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
19121924
.mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE,
19131925
.mode_off[1] = IOMUXC_GPR12,
19141926
.mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE,
1915-
.epc_features = &imx8m_pcie_epc_features,
1927+
.epc_features = &imx8q_pcie_epc_features,
19161928
.init_phy = imx8mq_pcie_init_phy,
19171929
.enable_ref_clk = imx8mm_pcie_enable_ref_clk,
19181930
},

0 commit comments

Comments
 (0)