Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4005008yba; Wed, 17 Apr 2019 02:30:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+dXBbgdG8tbDL/mhPVgdkYjNs0WDhjXaP/2X6CaYZYThpVKR1qs9SeZrNUXkj9QU0ImPs X-Received: by 2002:a17:902:e48f:: with SMTP id cj15mr87250226plb.256.1555493443333; Wed, 17 Apr 2019 02:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555493443; cv=none; d=google.com; s=arc-20160816; b=jRfigWAfrydopw3WsP65mYNjAQ+3kmdOVED1qWt9eWuXlEa/3Ei+e/aIUqFu8kNA+Z R/CQRThM6wZAqz/DnKXxwo84GWet6//uifs/PW8zvG0jcv+mSlk3BLjaPTDElx5dlqW9 Dy7p7cdZlFhhV0fX98XriiZyI5WPPy0dNn3XLOg3kKxgI0nhXmxYL9hVnoaYs9xZBUhD vTrJ2u6112Fhmj/MlrAnT9RfoZf+NRkGsx+9KyuGxlWDt3ZDIhKbgavgOv48rhVoojt4 xMPlf9DV+mZrxT2WUa6kO9KtcRmOOty8GAokexGa9mqugVgC4tPeaaENVVO3iQuiJvVV rhnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=E6jkXWiiio1AsvQsJLNqKvHBgFRnHSxPO9B36HSZCdo=; b=Yog0kaUqSV+Wcqh474XUmUvvZbqhc7Hf+T+LGZ9E/N/DNjYoALY/T1H68CRHAxahkI 0ftujoefNto2omW6+qE2/Mt4XdX0kmOtYUhtTm5t8FNKiihxkw2C0rX3j4Jl2gUVxX1O Y3hmrxTTZuMco4SqqRFQKuBWSrSX+UkIwr9hp1zNsYxT2wammxk5uiSjE8oYc+XPKRjw Z44KHeLo8LBRwcYwtCH3TgRKeOhyaF2T9stH1zO6/D0GIzEcaQcbh8R30p1bqgz6+Co/ z04WJcSveeF9MKPPQmfYpPUlPgFjeenz64+zztHbqVRiemgKPZpBaaECOItOzE2Eyrno Fnsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=HeJaUFRT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si1906606pgv.484.2019.04.17.02.30.28; Wed, 17 Apr 2019 02:30:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=HeJaUFRT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731566AbfDQJ3C (ORCPT + 99 others); Wed, 17 Apr 2019 05:29:02 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:40678 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726237AbfDQJ3C (ORCPT ); Wed, 17 Apr 2019 05:29:02 -0400 Received: from mailhost.synopsys.com (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id A020824E16EB; Wed, 17 Apr 2019 02:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1555493341; bh=YE03f3P3G56mgus55gIKI+IS1dtfLqdRh9bm7+cSsO8=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=HeJaUFRTj/H+hZXraHw3S/WhRO1kwkIHmkQuqb/7qyEilGnEgbUYLw6j8R+n0Zr5a Wt7AOA2sQ9pcoTTRGHrLZew/I8z5SkJ5u9ri+pHuvDmVgvRsFTiRaJIHBI3O7LwL3n qtjw/h4cLRj63L7PNBd4679KhXm6GMc2bEBga8zij18SUwfr0pUZXPtILpMKz4EroE RSsxLNES7JX2qRJYHYzLSacOFJY9z3KvLUnWg+cOPDn32H8d8YyEPYHzCxgKSrvs2n qVOHMVQkT3q31AAgDXgQ+Kq0djE//IM3SiLHyRyYUALYLIJgb/xY+JdVLhQeIZJtIw 4yitvdS3HTefw== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2.internal.synopsys.com [10.12.239.237]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 8FA8BA0098; Wed, 17 Apr 2019 09:29:01 +0000 (UTC) Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 17 Apr 2019 02:29:01 -0700 Received: from DE02WEMBXA.internal.synopsys.com ([fe80::a014:7216:77d:d55c]) by DE02WEHTCA.internal.synopsys.com ([::1]) with mapi id 14.03.0415.000; Wed, 17 Apr 2019 11:28:59 +0200 From: Gustavo Pimentel To: Vidya Sagar , "bhelgaas@google.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "thierry.reding@gmail.com" , "jonathanh@nvidia.com" , "kishon@ti.com" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , "lorenzo.pieralisi@arm.com" , "jingoohan1@gmail.com" , "gustavo.pimentel@synopsys.com" CC: "mperttunen@nvidia.com" , "linux-pci@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kthota@nvidia.com" , "mmaddireddy@nvidia.com" , "sagar.tv@gmail.com" Subject: RE: [PATCH V3 05/16] PCI: dwc: Move config space capability search API Thread-Topic: [PATCH V3 05/16] PCI: dwc: Move config space capability search API Thread-Index: AQHU9IqM6sbC1HqTtEKb6xuGtNWlVKZAFq9g Date: Wed, 17 Apr 2019 09:28:58 +0000 Message-ID: <305100E33629484CBB767107E4246BBB0A22C0BB@de02wembxa.internal.synopsys.com> References: <20190416192730.15681-1-vidyas@nvidia.com> <20190416192730.15681-6-vidyas@nvidia.com> In-Reply-To: <20190416192730.15681-6-vidyas@nvidia.com> Accept-Language: pt-PT, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-dg-ref: =?us-ascii?Q?PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNcZ3VzdGF2b1xh?= =?us-ascii?Q?cHBkYXRhXHJvYW1pbmdcMDlkODQ5YjYtMzJkMy00YTQwLTg1ZWUtNmI4NGJh?= =?us-ascii?Q?MjllMzViXG1zZ3NcbXNnLTM4YWRhODFhLTYwZjMtMTFlOS05ODdkLWY4OTRj?= =?us-ascii?Q?MjczODA0MlxhbWUtdGVzdFwzOGFkYTgxYy02MGYzLTExZTktOTg3ZC1mODk0?= =?us-ascii?Q?YzI3MzgwNDJib2R5LnR4dCIgc3o9IjQ2NDQiIHQ9IjEzMTk5OTY2OTM2NTg5?= =?us-ascii?Q?MTYwNyIgaD0ibm1JaHp5N3NzTDJOK1g0VWFZNUViZi8ySDlrPSIgaWQ9IiIg?= =?us-ascii?Q?Ymw9IjAiIGJvPSIxIiBjaT0iY0FBQUFFUkhVMVJTUlVGTkNnVUFBQlFKQUFB?= =?us-ascii?Q?WDRnWDcvL1RVQVQ5T3UrekVEYWhVUDA2NzdNUU5xRlFPQUFBQUFBQUFBQUFB?= =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=?us-ascii?Q?QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB?= =?us-ascii?Q?QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUJBQUFBQUFBQUFBSUFBQUFBQUo0QUFB?= =?us-ascii?Q?QnpBRzRBY0FCekFGOEFiQUJwQUdNQVpRQnVBSE1BWlFCZkFIUUFaUUJ5QUcw?= =?us-ascii?Q?QVh3QnpBSFFBZFFCa0FHVUFiZ0IwQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB?= =?us-ascii?Q?QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB?= =?us-ascii?Q?QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB?= =?us-ascii?Q?QUFBQUFBQUFFQUFBQUFBQUFBQWdBQUFBQUFuZ0FBQUhZQVp3QmZBR3NBWlFC?= =?us-ascii?Q?NUFIY0Fid0J5QUdRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB?= =?us-ascii?Q?QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB?= =?us-ascii?Q?QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB?= =?us-ascii?Q?QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBUUFBQUFB?= =?us-ascii?Q?QUFBQUNBQUFBQUFBPSIvPjwvbWV0YT4=3D?= x-originating-ip: [10.107.25.131] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 16, 2019 at 20:27:19, Vidya Sagar wrote: > move PCIe config space capability search API to common designware file s/designware/DesignWare > as this can be used by both host and ep mode codes. >=20 > Signed-off-by: Vidya Sagar > --- > Changes from [v2]: > * None >=20 > Changes from [v1]: > * Removed dw_pcie_find_next_ext_capability() API from here and made a > separate patch for that >=20 > .../pci/controller/dwc/pcie-designware-ep.c | 37 +------------------ > drivers/pci/controller/dwc/pcie-designware.c | 33 +++++++++++++++++ > drivers/pci/controller/dwc/pcie-designware.h | 2 + > 3 files changed, 37 insertions(+), 35 deletions(-) >=20 > diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pc= i/controller/dwc/pcie-designware-ep.c > index 24f5a775ad34..b9d9c9a4ba6d 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-ep.c > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c > @@ -40,39 +40,6 @@ void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pc= i_barno bar) > __dw_pcie_ep_reset_bar(pci, bar, 0); > } > =20 > -static u8 __dw_pcie_ep_find_next_cap(struct dw_pcie *pci, u8 cap_ptr, > - u8 cap) > -{ > - u8 cap_id, next_cap_ptr; > - u16 reg; > - > - reg =3D dw_pcie_readw_dbi(pci, cap_ptr); > - next_cap_ptr =3D (reg & 0xff00) >> 8; > - cap_id =3D (reg & 0x00ff); > - > - if (!next_cap_ptr || cap_id > PCI_CAP_ID_MAX) > - return 0; > - > - if (cap_id =3D=3D cap) > - return cap_ptr; > - > - return __dw_pcie_ep_find_next_cap(pci, next_cap_ptr, cap); > -} > - > -static u8 dw_pcie_ep_find_capability(struct dw_pcie *pci, u8 cap) > -{ > - u8 next_cap_ptr; > - u16 reg; > - > - reg =3D dw_pcie_readw_dbi(pci, PCI_CAPABILITY_LIST); > - next_cap_ptr =3D (reg & 0x00ff); > - > - if (!next_cap_ptr) > - return 0; > - > - return __dw_pcie_ep_find_next_cap(pci, next_cap_ptr, cap); > -} > - > static int dw_pcie_ep_write_header(struct pci_epc *epc, u8 func_no, > struct pci_epf_header *hdr) > { > @@ -591,9 +558,9 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) > dev_err(dev, "Failed to reserve memory for MSI/MSI-X\n"); > return -ENOMEM; > } > - ep->msi_cap =3D dw_pcie_ep_find_capability(pci, PCI_CAP_ID_MSI); > + ep->msi_cap =3D dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); > =20 > - ep->msix_cap =3D dw_pcie_ep_find_capability(pci, PCI_CAP_ID_MSIX); > + ep->msix_cap =3D dw_pcie_find_capability(pci, PCI_CAP_ID_MSIX); > =20 > dw_pcie_setup(pci); > =20 > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/c= ontroller/dwc/pcie-designware.c > index f98e2f284ae1..d68c123e409c 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -20,6 +20,39 @@ > #define PCIE_PHY_DEBUG_R1_LINK_UP (0x1 << 4) > #define PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING (0x1 << 29) > =20 > +static u8 __dw_pcie_find_next_cap(struct dw_pcie *pci, u8 cap_ptr, > + u8 cap) > +{ > + u8 cap_id, next_cap_ptr; > + u16 reg; > + > + reg =3D dw_pcie_readw_dbi(pci, cap_ptr); > + next_cap_ptr =3D (reg & 0xff00) >> 8; > + cap_id =3D (reg & 0x00ff); > + > + if (!next_cap_ptr || cap_id > PCI_CAP_ID_MAX) > + return 0; > + > + if (cap_id =3D=3D cap) > + return cap_ptr; > + > + return __dw_pcie_find_next_cap(pci, next_cap_ptr, cap); > +} > + > +u8 dw_pcie_find_capability(struct dw_pcie *pci, u8 cap) > +{ > + u8 next_cap_ptr; > + u16 reg; > + > + reg =3D dw_pcie_readw_dbi(pci, PCI_CAPABILITY_LIST); > + next_cap_ptr =3D (reg & 0x00ff); > + > + if (!next_cap_ptr) > + return 0; > + > + return __dw_pcie_find_next_cap(pci, next_cap_ptr, cap); > +} > + > int dw_pcie_read(void __iomem *addr, int size, u32 *val) > { > if (!IS_ALIGNED((uintptr_t)addr, size)) { > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/c= ontroller/dwc/pcie-designware.h > index 86df36701a37..4ccd4c706ddb 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.h > +++ b/drivers/pci/controller/dwc/pcie-designware.h > @@ -247,6 +247,8 @@ struct dw_pcie { > #define to_dw_pcie_from_ep(endpoint) \ > container_of((endpoint), struct dw_pcie, ep) > =20 > +u8 dw_pcie_find_capability(struct dw_pcie *pci, u8 cap); > + > int dw_pcie_read(void __iomem *addr, int size, u32 *val); > int dw_pcie_write(void __iomem *addr, int size, u32 val); > =20 > --=20 > 2.17.1 With the replacement, you have my ack: Acked-by: Gustavo Pimentel Thanks, Gustavo