Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp449489pxb; Wed, 11 Nov 2020 07:40:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyka6BmQgETIhPJ9BAefqoB46iS84cNEEiuVHTfCC9B/bclh+TRrBMgszeMHv1kdcWwbWob X-Received: by 2002:a05:6402:12c1:: with SMTP id k1mr9671edx.76.1605109228654; Wed, 11 Nov 2020 07:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605109228; cv=none; d=google.com; s=arc-20160816; b=PirlBYXtDUhOnx7xBF0aQkNs6qVXqUfoGgCSZMVJp15Zj6JciGKcfQoMU9uy8uCkLU /J5w/ZWU7V+Su+EqWXvfZ9HhExKhpySMDV+MhpLuZrlF88I2HiGyWpAKo4Xxa889YLOz QrGCivVYtTAyKEEooNv3hzSjcj6guso8PPTyTvcej6K+OHRpCP6Xb1JagWq7aJ+zrfb5 hnAvxU3YN8Dust+hN4w5C5gBCAAGKu4/GvACByjJRNSUFm35fCDHVmRhZiRD4AAJgkSl QEJLewbpfcou60DMb9KXeAndrQOx1i514EEs8eDfV1y/XTN6QN9r4VokryC6kD2o9Ker x/SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ccIYM3BWSztQJNWt3tuc6dHrpKFHfV4QEGAhdlAGYe0=; b=L/P5gvxdbJROA2i5tMWHhQaPTQrebxxKMkCySnlpPug2Y5GeWFhxUkMRPPMN9qCAkB HTo83qHotCAramHkcc5Zqw+dtaW7QIxManMyvTTqogOyoEyKFoG4jMd4RSIq+g7KIgOy JNHuqDXsjmXGrLgHzC68YY7ZKx/2TsmNVI7vz79Cx2L1t9L3W5gn9Ss+AqG6yJUB6nSj D2nt06skIe56pWziFmlu4658PeiUW3oMknXS+lTeQ2DBtVFcDLZSPLYTJq3Ru5TnDtm2 z7X78qvN52GWtD3099rGHqBoINSr5KoAEo3m4Tvm6aj49SnFYqx2zQCyVxUfMKMU6kvS zW9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=V6EnZkss; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf27si1707192edb.140.2020.11.11.07.40.04; Wed, 11 Nov 2020 07:40:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=V6EnZkss; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727621AbgKKPiC (ORCPT + 99 others); Wed, 11 Nov 2020 10:38:02 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:38288 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727582AbgKKPh7 (ORCPT ); Wed, 11 Nov 2020 10:37:59 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0ABFbnvO097943; Wed, 11 Nov 2020 09:37:49 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1605109069; bh=ccIYM3BWSztQJNWt3tuc6dHrpKFHfV4QEGAhdlAGYe0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=V6EnZkssJLkcuAaaWXrA6bNJvC9/gRhJ10rlwBAYb8GizJrYiE6pm7spekE/gyuNI 1+pPsB8jnT8AfUSJ2xF4UfjzunaVRjI5IZT5BCq2KUZ43IN2LG2WsVNIC8OxVkjb67 Alt5iYmDxH12Ir8rObdrQ09zqEhnkI0swpYfjsQM= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0ABFbnCq095792 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Nov 2020 09:37:49 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 11 Nov 2020 09:37:48 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 11 Nov 2020 09:37:48 -0600 Received: from a0393678-ssd.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0ABFa043042109; Wed, 11 Nov 2020 09:37:44 -0600 From: Kishon Vijay Abraham I To: Bjorn Helgaas , Jonathan Corbet , Kishon Vijay Abraham I , Lorenzo Pieralisi , Arnd Bergmann , Jon Mason , Dave Jiang , Allen Hubbe , Tom Joseph , Rob Herring CC: Greg Kroah-Hartman , , , , Subject: [PATCH v8 12/18] PCI: cadence: Configure LM_EP_FUNC_CFG based on epc->function_num_map Date: Wed, 11 Nov 2020 21:05:53 +0530 Message-ID: <20201111153559.19050-13-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111153559.19050-1-kishon@ti.com> References: <20201111153559.19050-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/pci/controller/cadence/pcie-cadence-ep.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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) { -- 2.17.1