diff mbox series

[v8,12/18] PCI: cadence: Configure LM_EP_FUNC_CFG based on epc->function_num_map

Message ID 20201111153559.19050-13-kishon@ti.com
State New
Headers show
Series Implement NTB Controller using multiple PCI EP | expand

Commit Message

Kishon Vijay Abraham I Nov. 11, 2020, 3:35 p.m. UTC
The number of functions supported by the endpoint controller is
configured in LM_EP_FUNC_CFG based on func_no member of struct pci_epf.
Now that an endpoint function can be associated with two endpoint
controllers (primary and secondary), just using func_no will
not suffice as that will take into account only if the endpoint
controller is associated with the primary interface of endpoint
function. Instead use epc->function_num_map which will already have the
configured functions information (irrespective of whether the endpoint
controller is associated with primary or secondary interface).

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/pci/controller/cadence/pcie-cadence-ep.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Tom Joseph Dec. 14, 2020, 5:56 p.m. UTC | #1
> -----Original Message-----
> From: Kishon Vijay Abraham I <kishon@ti.com>
> Sent: 11 November 2020 15:36
> 
> The number of functions supported by the endpoint controller is
> configured in LM_EP_FUNC_CFG based on func_no member of struct
> pci_epf.
> Now that an endpoint function can be associated with two endpoint
> controllers (primary and secondary), just using func_no will
> not suffice as that will take into account only if the endpoint
> controller is associated with the primary interface of endpoint
> function. Instead use epc->function_num_map which will already have the
> configured functions information (irrespective of whether the endpoint
> controller is associated with primary or secondary interface).
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/pci/controller/cadence/pcie-cadence-ep.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 

Reviewed-by: Tom Joseph <tjoseph@cadence.com>
diff mbox series

Patch

diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c
index 1fe6b8baca97..4e4eb30cd1a2 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-ep.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c
@@ -506,18 +506,13 @@  static int cdns_pcie_ep_start(struct pci_epc *epc)
 	struct cdns_pcie_ep *ep = epc_get_drvdata(epc);
 	struct cdns_pcie *pcie = &ep->pcie;
 	struct device *dev = pcie->dev;
-	struct pci_epf *epf;
-	u32 cfg;
 	int ret;
 
 	/*
 	 * BIT(0) is hardwired to 1, hence function 0 is always enabled
 	 * and can't be disabled anyway.
 	 */
-	cfg = BIT(0);
-	list_for_each_entry(epf, &epc->pci_epf, list)
-		cfg |= BIT(epf->func_no);
-	cdns_pcie_writel(pcie, CDNS_PCIE_LM_EP_FUNC_CFG, cfg);
+	cdns_pcie_writel(pcie, CDNS_PCIE_LM_EP_FUNC_CFG, epc->function_num_map);
 
 	ret = cdns_pcie_start_link(pcie);
 	if (ret) {