Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4088683pxb; Mon, 1 Feb 2021 12:06:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYyIOwSR25ByjuCYV0KpkDcXPJzMN9irsZdn9wjHxjBc+sO3GuOw3Co4vOaawpDnE85P5U X-Received: by 2002:a17:906:a84d:: with SMTP id dx13mr19307929ejb.275.1612210014550; Mon, 01 Feb 2021 12:06:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612210014; cv=none; d=google.com; s=arc-20160816; b=iq8tlKVodLePGbz8xvjHoHQOnVqZZG6IbcDeqNNTKMrUTwaij1BxxGIOmFGwfUUU2+ qnwUOUERDLuqM47G+zmaxNuitAPrnG14rXyDarmBiyZijdb9wLeb7IiMQBMBYswDixR8 9vIrnINkX6Muca7qalzFeDUk2IjpSg5/klbReKYsXv8U1IpWDaEWqTNZPWRdYUhr/4kf WY61/z1LoMqtMdCFZ/Xj8ShY5cwfRUpk7LlN5mW+8iJZ5KjtEFAhsaHy7bAZxe8duzHO 0e7/gKDs9zyK0ln5A6hx7gC6AdtOMc0/1Mh8bdUjD6OqVNjjqXn6nWCHdabIbvngduqt 2M+w== 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=Hv2Bn0Lk5Are5SnuuKfQMZlyBMtzlQMuYQhqnCaXHzc=; b=G5HlHhLmHWwAcNRGB6XxnaKHmIMIPKwrSdB3rLiSp8ptp1f6zt6MS48YFY/MW0Mzx/ ukr81qaE6/gpmfkTb9FrwUzGIKb09VYoj7nGRUl+mi4GF3Ws8HC3UVArCHR4scCKZuHi YtUyH4rc5ZFAWo8ft4CCC4xJSHQ7Yw9kh7kjwu/bYCXZfPPVOY8n5S1UFI9HNb4NWgUb wJcCVa1rg09NFOklgPtnArol7KVFJ/271JiSWgwvNFhXPLnn26CD54R3dyyuD0/MuJZv vBRYLSzLZWTCldqOq4/156BgCK8GzR+5ruY1nERuQUkFgoTJdgMbnMuKbOzLjIoEBwgV BJLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="V/+1mANR"; 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 a8si10595898ejk.646.2021.02.01.12.06.25; Mon, 01 Feb 2021 12:06:54 -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="V/+1mANR"; 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 S233116AbhBAUDG (ORCPT + 99 others); Mon, 1 Feb 2021 15:03:06 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:41956 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbhBAUBN (ORCPT ); Mon, 1 Feb 2021 15:01:13 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 111JxMfJ024071; Mon, 1 Feb 2021 13:59:22 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1612209562; bh=Hv2Bn0Lk5Are5SnuuKfQMZlyBMtzlQMuYQhqnCaXHzc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=V/+1mANRFmE8sVMBi1sd3q6HlKRw2AVKhrgXIXLFkyBDFUohY6Kw+wB207ImH9t3I DnwHSpRwYRyWJGrkYH9Al7uru3fVQVzG/8yuMFwe0HY5R1IWRszvQmilndPSTRoxzQ gd2ZNSEIQYpinfKTMYa++Fd6Wnf3hhEHoED3uZz8= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 111JxMKv101912 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 1 Feb 2021 13:59:22 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 1 Feb 2021 13:59:22 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE107.ent.ti.com (157.170.170.37) 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; Mon, 1 Feb 2021 13:59:22 -0600 Received: from a0393678-ssd.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 111JwAQj085814; Mon, 1 Feb 2021 13:59:17 -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 v11 12/17] PCI: cadence: Configure LM_EP_FUNC_CFG based on epc->function_num_map Date: Tue, 2 Feb 2021 01:28:04 +0530 Message-ID: <20210201195809.7342-13-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210201195809.7342-1-kishon@ti.com> References: <20210201195809.7342-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 Reviewed-by: Tom Joseph --- 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 dc88078194cb..897cdde02bd8 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