[PATCH 3/4] pci_endpoint: pci_cdns_ti_ep: Enable PCIe Endpoint mode in J784S4 SoC
    Hrushikesh Salunke 
    h-salunke at ti.com
       
    Thu Oct 23 13:46:03 CEST 2025
    
    
  
TI's J784S4 SoC has two instances of PCIe Controller namely PCIe0 and
PCIe1 which are Cadence PCIe Controllers. Add support to configure PCIe
instances in Endpoint mode of operation.
While at it disable all endpoint functions except function 0 during
probe to prevent the Root Complex from enumerating unconfigured
functions. This ensures only  properly configured endpoint functions
are visible to the host and avoids enumeration issues with
multi-function devices.
Signed-off-by: Hrushikesh Salunke <h-salunke at ti.com>
---
 drivers/pci_endpoint/pcie_cdns_ti_ep.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/drivers/pci_endpoint/pcie_cdns_ti_ep.c b/drivers/pci_endpoint/pcie_cdns_ti_ep.c
index dd3dc939a7e..021bd73a383 100644
--- a/drivers/pci_endpoint/pcie_cdns_ti_ep.c
+++ b/drivers/pci_endpoint/pcie_cdns_ti_ep.c
@@ -275,9 +275,11 @@ static int pcie_cdns_ti_ep_probe(struct udevice *dev)
 	struct pcie_cdns_ti_ep *pcie = dev_get_priv(dev);
 	struct pcie_cdns_ti_ep_data *data;
 	struct power_domain pci_pwrdmn;
+	struct cdns_pcie pcie_dev;
 	struct clk *clk;
 	int ret;
 
+	pcie_dev.reg_base = pcie->reg_base;
 	pcie->dev = dev;
 	data = (struct pcie_cdns_ti_ep_data *)dev_get_driver_data(dev);
 	if (!data)
@@ -328,6 +330,13 @@ static int pcie_cdns_ti_ep_probe(struct udevice *dev)
 		return ret;
 	}
 
+	/*
+	 * Disable all the functions except function 0 (anyway BIT(0) is
+	 * hardwired to 1). This is required to avoid RC from enumerating
+	 * those functions which are not even configured.
+	 */
+	cdns_pcie_writel(&pcie_dev, CDNS_PCIE_LM_EP_FUNC_CFG, BIT(0));
+
 	return 0;
 }
 
@@ -389,11 +398,19 @@ static const struct pcie_cdns_ti_ep_data am64_pcie_ep_data = {
 	.max_lanes = 1,
 };
 
+static const struct pcie_cdns_ti_ep_data j784s4_pcie_ep_data = {
+	.max_lanes = 4,
+};
+
 static const struct udevice_id pcie_cdns_ti_ep_ids[] = {
 	{
 		.compatible = "ti,am64-pcie-ep",
 		.data = (ulong)&am64_pcie_ep_data,
 	},
+	{
+		.compatible = "ti,j784s4-pcie-ep",
+		.data = (ulong)&j784s4_pcie_ep_data,
+	},
 	{},
 };
 
-- 
2.34.1
    
    
More information about the U-Boot
mailing list