From patchwork Fri Dec 6 07:44:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shradha Todi X-Patchwork-Id: 13896649 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A5C11E1C2B for ; Fri, 6 Dec 2024 08:34:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733474070; cv=none; b=a7s+GdfGCTSEB6g7/KQk3cmeZKq3QdnL906uno02KsWou2FnwuoE3FOE+gDsE2Qu0SedSScrpeH6iJRispCSmSrg25v3iAR7w2u9F7K8gGGYmEbUlD2J8iYXLquwI+mJH5E+lx4wNJj97CrWm0Zv5bxI1vBTh6ARtvOhsZg67ds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733474070; c=relaxed/simple; bh=EhEGYhxLSlKYz9DoJ7L+0wZRwDTYKR4K1VwaUOKojWM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:Content-Type: References; b=KY7TV/JV9qarEnUgR+4iAXmEqZMDiLc9yFnN13Nbmg4WO1LYqhCpAfhUqBPzOhly8cR0I8n73+NeW+iel2xVNdyX+3oixbKCC8ezYM2RQ5SEM2d2dOktB9qyK5oWB7qoYx5tMHeAUqQpJL9b+pSY7i+tZvb1NR1rj4jOZbNksoY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=MS9kBJbb; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="MS9kBJbb" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241206083418epoutp036648d68e03015e9b6584c8337d2c4f21~OiXjStk3A2315423154epoutp03_ for ; Fri, 6 Dec 2024 08:34:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241206083418epoutp036648d68e03015e9b6584c8337d2c4f21~OiXjStk3A2315423154epoutp03_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1733474058; bh=8zKrIcn8Ku+bx3UX7Tz/EWhEyXC2fgMinelJIKpRG+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MS9kBJbb30je8zmlMenh8NCmBwo9aBA6Wtuzd5yD3IXUjmiSe3XyEJjrWLyHsaxqw 9PSTnL/gFjkcD3hja7ddjupd7M2Ah0WAukeNwGyEkJRZD8ooueJ8beWG6zI6F3+RGp snvz448ucqiY8Oh1i5R9e/ZENEV8YHW6Cte/CtsM= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241206083417epcas5p39c67cf3f045df165f9a8451468eb57a8~OiXip7BHT2819428194epcas5p3G; Fri, 6 Dec 2024 08:34:17 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.175]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Y4PgX1Sjzz4x9Q3; Fri, 6 Dec 2024 08:34:16 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id E5.D7.19956.807B2576; Fri, 6 Dec 2024 17:34:16 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241206074234epcas5p3bc1151ad713c702c34581b484e21292d~OhqYKverE2415924159epcas5p3V; Fri, 6 Dec 2024 07:42:34 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241206074234epsmtrp13fdff976ad6ec0a303a823bae8334a40~OhqYJ18dA1431314313epsmtrp1Q; Fri, 6 Dec 2024 07:42:34 +0000 (GMT) X-AuditID: b6c32a4b-fd1f170000004df4-b2-6752b708311a Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 7B.0E.18949.AEAA2576; Fri, 6 Dec 2024 16:42:34 +0900 (KST) Received: from cheetah.samsungds.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241206074231epsmtip1b892024f40d449e2eed582a8b6e08aa3~OhqVaDbkx1378213782epsmtip1C; Fri, 6 Dec 2024 07:42:31 +0000 (GMT) From: Shradha Todi To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, jingoohan1@gmail.com, Jonathan.Cameron@Huawei.com, fan.ni@samsung.com, a.manzanares@samsung.com, pankaj.dubey@samsung.com, quic_nitegupt@quicinc.com, quic_krichai@quicinc.com, gost.dev@samsung.com, Shradha Todi Subject: [PATCH v4 1/2] PCI: dwc: Add support for vendor specific capability search Date: Fri, 6 Dec 2024 13:14:55 +0530 Message-Id: <20241206074456.17401-2-shradha.t@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241206074456.17401-1-shradha.t@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNJsWRmVeSWpSXmKPExsWy7bCmli7H9qB0gzXn2S2mH1a0WNKUYdG0 +i6rxc0DO5ksVn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S4Zp1Wvqe+YO2CBYKd ns/NWH6Er/hdom9yvc1g7SrtFcv1LfuvKLEUZyQaajEXFScCALe/QZzkAgAA X-CMS-MailID: 20241206074234epcas5p3bc1151ad713c702c34581b484e21292d X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241206074234epcas5p3bc1151ad713c702c34581b484e21292d References: <20241206074456.17401-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Add vendor specific extended configuration space capability search API using struct dw_pcie pointer for DW controllers. Signed-off-by: Shradha Todi --- drivers/pci/controller/dwc/pcie-designware.c | 16 ++++++++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 6d6cbc8b5b2c..41230c5e4a53 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -277,6 +277,22 @@ static u16 dw_pcie_find_next_ext_capability(struct dw_pcie *pci, u16 start, return 0; } +u16 dw_pcie_find_vsec_capability(struct dw_pcie *pci, u8 vsec_cap) +{ + u16 vsec = 0; + u32 header; + + while (vsec = dw_pcie_find_next_ext_capability(pci, vsec, + PCI_EXT_CAP_ID_VNDR)) { + header = dw_pcie_readl_dbi(pci, vsec + PCI_VNDR_HEADER); + if (PCI_VNDR_HEADER_ID(header) == vsec_cap) + return vsec; + } + + return 0; +} +EXPORT_SYMBOL_GPL(dw_pcie_find_vsec_capability); + u16 dw_pcie_find_ext_capability(struct dw_pcie *pci, u8 cap) { return dw_pcie_find_next_ext_capability(pci, 0, cap); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 347ab74ac35a..98a057820bc7 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -476,6 +476,7 @@ void dw_pcie_version_detect(struct dw_pcie *pci); u8 dw_pcie_find_capability(struct dw_pcie *pci, u8 cap); u16 dw_pcie_find_ext_capability(struct dw_pcie *pci, u8 cap); +u16 dw_pcie_find_vsec_capability(struct dw_pcie *pci, u8 vsec_cap); int dw_pcie_read(void __iomem *addr, int size, u32 *val); int dw_pcie_write(void __iomem *addr, int size, u32 val);