Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2226121/?format=api
{ "id": 2226121, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2226121/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260422093549.407022-3-sherry.sun@nxp.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.2/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260422093549.407022-3-sherry.sun@nxp.com>", "list_archive_url": null, "date": "2026-04-22T09:35:39", "name": "[V14,02/12] PCI: host-generic: Add common helpers for parsing Root Port properties", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "24ca7dd14553240deb8714f45a67794ee8d3bd66", "submitter": { "id": 77063, "url": "http://patchwork.ozlabs.org/api/1.2/people/77063/?format=api", "name": "Sherry Sun", "email": "sherry.sun@nxp.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260422093549.407022-3-sherry.sun@nxp.com/mbox/", "series": [ { "id": 500954, "url": "http://patchwork.ozlabs.org/api/1.2/series/500954/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=500954", "date": "2026-04-22T09:35:40", "name": "pci-imx6: Add support for parsing the reset property in new Root Port binding", "version": 14, "mbox": "http://patchwork.ozlabs.org/series/500954/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226121/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226121/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-52935-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256\n header.s=selector1 header.b=TD7m9QwC;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-52935-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com\n header.b=\"TD7m9QwC\"", "smtp.subspace.kernel.org;\n arc=fail smtp.client-ip=40.107.162.14", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=nxp.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=nxp.com", "dkim=none (message not signed)\n header.d=none;dmarc=none action=none header.from=nxp.com;" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0vN16B3lz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 19:40:17 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id EE7793069FE9\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 09:34:24 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id C38443563C4;\n\tWed, 22 Apr 2026 09:34:24 +0000 (UTC)", "from PA4PR04CU001.outbound.protection.outlook.com\n (mail-francecentralazon11013014.outbound.protection.outlook.com\n [40.107.162.14])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id EB6E1231836;\n\tWed, 22 Apr 2026 09:34:22 +0000 (UTC)", "from VI0PR04MB12114.eurprd04.prod.outlook.com\n (2603:10a6:800:315::13) by PA2PR04MB10129.eurprd04.prod.outlook.com\n (2603:10a6:102:3ff::12) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9846.18; Wed, 22 Apr\n 2026 09:34:19 +0000", "from VI0PR04MB12114.eurprd04.prod.outlook.com\n ([fe80::feda:fd0e:147f:f994]) by VI0PR04MB12114.eurprd04.prod.outlook.com\n ([fe80::feda:fd0e:147f:f994%6]) with mapi id 15.20.9818.032; Wed, 22 Apr 2026\n 09:34:19 +0000" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776850464; cv=fail;\n b=US8w3hjy1zB1QJUvGrXAXNdyNQGCd8iDnMXTPwY7OwyT4zIfpAefrhFgCtyrA0MyQHeLM8pCVJf0KQI/PQKaeUfM+3glCfgsfDnYJmlbZT9zkTZVXISzwkKeuMyQP2X91ARjcnAVSnPn8APyq9tgf5QEeTBPAfRdU8K0P2phvow=", "i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=NuRs1hSMBiv5zS6rO88PVjKhAGYSEVa2oMSTwUAmuc7AzlgWunIynLskzLwlV0cX/L94+xsZB+M6fdTSRQk13fhihg/nw7p0LG97zG+ftoecwULov2VXrSZJ8GLi2pAZpeinOB+2pc9HfhnDQogRdAtVAoP6qgYA6iErxdJOr4DHYkyiE9ac+GmvwMIdrYnMIrY4aFqtmDHD6z6JRzRp1OMrmu2gfSWGktFPKd4/AFpsdaxHTb/+7pyCDf9d2SPUhnEGEBh8C1jhJHvC+AEC6DhcpPMvd4gTSFRP28BdFe9IInfSoeQ3vBx5S1Utfsc2BVWjsog94mMPkp+8b6TyNA==" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776850464; c=relaxed/simple;\n\tbh=A++ytBZo+0feJHUr1Rvi+b01Dxk7S8vyCF0Sue7S+D0=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t Content-Type:MIME-Version;\n b=tn9U0jMzs8zoXjssuGwfJB+silTXWd9PAKUlLgElUNNzVMUkoHMTZKxgNdoxVIsapqY25gjb6a94G4fTfXaSBaPQzH9R3pKLU3F77ugYnCQ4k1LeoWFihhlMJn5oaBEj0TI1U4T/JcGIi+2/HcLcu9K0dMdCSvghQKIq8xinn2U=", "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=sXYL9hD7Zb+bYERt9M3ghxoEy0ChaVYvDjQmA1hXq3U=;\n b=MncimihRaBF9sND5bwpvjtPS685piwTx2b1hWLC6VUpg4ghGMSn0yIDfEuInGvP7pYSDr6JS1o3d5Y5WNqiJ3iBjT5cL6iDWZE/pAK5wkLGmVj1MakYi4wjOSQ7tzlc3Oug059imi2RqOUTkOfZ2ilc3V9aHpSuUjLPF1NOSR79ArM5By6ZzqDtaxpjdTpGXLqFpqrjpClqaJK+J59ftJfY4YCOg9kK67wFX6PNlfLgcqYXhnBZBNA2cFjcIq4Zr+yBOgKN2qsTu2t5k7tqZNdpWt2ufAjkqWRpnDtQnGALaLvq5RUk6DUvKMZ/GjTNTg+TBM1pL9E9ZbM6oSPOhMg==" ], "ARC-Authentication-Results": [ "i=2; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=nxp.com;\n spf=pass smtp.mailfrom=nxp.com;\n dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com\n header.b=TD7m9QwC; arc=fail smtp.client-ip=40.107.162.14", "i=1; mx.microsoft.com 1; spf=pass\n smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass\n header.d=nxp.com; arc=none" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=sXYL9hD7Zb+bYERt9M3ghxoEy0ChaVYvDjQmA1hXq3U=;\n b=TD7m9QwCS83qM3TZj0gaLePlu4EUWEDDDN2OEbwX+p4BYFqWkkWJdyLJ9fBEE5UW8ExX7nbOG5ruBQtJMaFJh3Ad/EPfMSEGKLVTMy5diXNILSYPJavTkrAuxvo2ild4x96HtMX745N9yHFWllIFeN89fNFQqz0WL6NPSmpm7doZr2ouLEqJ/sdU5+AdqTzAeLlPzRITdMyEBgUqdqoTzySr5y55xe8pEXBKCB0QP1ILDoVMlFWXf+205nrQcmFzT2RdIbK5cZvk2gpF9Z6Hs4yEgNFZY/7EjtNVDysBPNA5wSm3ZtkFYkNCNAT1CV44ySRu/g2pkCGUokrSJT5l2w==", "From": "Sherry Sun <sherry.sun@nxp.com>", "To": "robh@kernel.org,\n\tkrzk+dt@kernel.org,\n\tconor+dt@kernel.org,\n\tFrank.Li@nxp.com,\n\ts.hauer@pengutronix.de,\n\tkernel@pengutronix.de,\n\tfestevam@gmail.com,\n\tlpieralisi@kernel.org,\n\tkwilczynski@kernel.org,\n\tmani@kernel.org,\n\tbhelgaas@google.com,\n\thongxing.zhu@nxp.com,\n\tl.stach@pengutronix.de", "Cc": "imx@lists.linux.dev,\n\tlinux-pci@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org,\n\tdevicetree@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org", "Subject": "[PATCH V14 02/12] PCI: host-generic: Add common helpers for parsing\n Root Port properties", "Date": "Wed, 22 Apr 2026 17:35:39 +0800", "Message-Id": "<20260422093549.407022-3-sherry.sun@nxp.com>", "X-Mailer": "git-send-email 2.37.1", "In-Reply-To": "<20260422093549.407022-1-sherry.sun@nxp.com>", "References": "<20260422093549.407022-1-sherry.sun@nxp.com>", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-ClientProxiedBy": "SG2PR01CA0140.apcprd01.prod.exchangelabs.com\n (2603:1096:4:8f::20) To VI0PR04MB12114.eurprd04.prod.outlook.com\n (2603:10a6:800:315::13)", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "X-MS-PublicTrafficType": "Email", "X-MS-TrafficTypeDiagnostic": "VI0PR04MB12114:EE_|PA2PR04MB10129:EE_", "X-MS-Office365-Filtering-Correlation-Id": "2ec5b9a4-9f51-4ed0-cd85-08dea0525461", "X-MS-Exchange-SenderADCheck": "1", "X-MS-Exchange-AntiSpam-Relay": "0", "X-Microsoft-Antispam": "\n\tBCL:0;ARA:13230040|376014|7416014|52116014|19092799006|1800799024|366016|56012099003|22082099003|18002099003|921020|38350700014;", "X-Microsoft-Antispam-Message-Info": "\n\twc9QwWHZEoko3COLD2yUkHkpea+qxW8sAWlp75z90hU+s4kSk6FtBmCotYWyGZpoha94uYTApDxZ9ej41mcL9tFyKSEetu385yzQb3229TOVj3bvCs9Kyl1/rNKAz1yUCmn6TFCRNHYwJPMAljhY81k3Xm25sjbQfjCwsSuIYQpp4Yk5alyOH/+JtnA6FwCWm9URv+Yc1suja35L05xozImeRtslu7KXiDaFFzKPWDT4kyyhgnp4v7LrUIn6MpwAcNyqxNnlc8wgETE17I4nCn0h8cks0I8ghdv/pYXST6/kgJvYnvR49WL1tEQv10MncoyhIodjYWQMuder/mMwl1P/Q66TmtZRm6Tjebzhd7e+pfYUGqOY1qo/bYqJ2183Wd92FeLPJ64HiWJhomLn2OhiSRhIzoGgCKyaR6JECgE5jCv8Vegg0Hz8qMb7+kMUamdfi2oPxerXUlAvySlnQgHA6GXAEAucIlCqhAfxI+Kp1bu7M69KMu5kg1OxoyD8Dzz+BqnqMxWd1F0lbdGydMZAFel7mYdml515eTZYCzYgM4bDzYpjXtRLnrZlrbtREPOIE1izjY1+yskjiazAzJLztHLlQJ7Fnhmu5ZMnktpiLJpYstnKvTGUWutBaQBZjY8/HKZPjDQNicpCS23XUhrverJfJxLw2gl7TWEwvvm8SeDQ91Kij1hKBTseAjoQ1TXNxgZEopx7xm8zwQktLw05cgMOSlExCFelmUWnkHfxji1FRTXa0pbPG2Ol45zGzIOuKScYHSCCxLvaai4KSkNrsAMP5YxdeomYZC4tbRefaHwzI8MwHqQMrqOAhLFc", "X-Forefront-Antispam-Report": "\n\tCIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI0PR04MB12114.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(19092799006)(1800799024)(366016)(56012099003)(22082099003)(18002099003)(921020)(38350700014);DIR:OUT;SFP:1101;", "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1", "X-MS-Exchange-AntiSpam-MessageData-0": "\n LQlNFFxPSq94CT81WfB51yv7sqF+FHfkF07tSHLWoVTa83ECcVw3Ccxo1XhGPUkqwcaw0wug80x51VSHvMWijMBuWYuQB1kxpBxC8n5qJUBnOcFf++PYo7X49v6mXKA9VFKQgteiEo/Abghss4rMDJkJy5RzHRJ9LCEYeXUgQsIbK0CDj5JuRBdMwAeooCCn5yArLOPxi/HRd0CNRA4dyY3wCZvntc4LX5WxyhXt3zvLeSvx8y/8WiV4bbJMWKr9Du1jUe6e7cd790ynBpKI9vZm0OGTZertlVjm9of9BCEiw3WXhu5E+bfYpzSxdmtxsNcx3R65zee4c2hRjUrdetO8U55CbgJeoVQ7qBD1e4+QAmnLmS4pviEqI/4/4t4r3d3owM5S2TUhGCjO6x8wlA+y0z0pyotUTXMRAmpNY22a0teiF09NY0mg4Yygal+RsWyNVWbebG8vUOTRSpGsO6VxrXAMAwk/zSgI6EZfOZsa5imON6TtlAgCp6FQiGo94fHtsi/yXT65MccEAWZQuqDe34VhwyKvNiUMR/QzRscMZG3uDb7/pAuQbgFpU3Cts7udCd7rqVXVmibFo40PhUqY1iaq3IHFwWLhxjL+X6wEoTgG7z4v6x3h7Sr/Z90b8VpwKaa35V79zJru5krZpghL+ef0oxQsL/m2T04YmrrMtUl0TsS2xbJHujkCDGoCuh7HlHhlfyKLS8YtqXVEDxlYugAAc4fX/Q+griviOfUM4ttYlN+6Dgb2xxWGmis4ybimtuJydKF5cWLAuLa2eQo3FQaqAumTIn4LNbDMRwpkUmlGuR8+wVLppWPn7UOEJVp4usPIi5fVGKpTNHuCdSGNnyV1rzRtsuuTA982pKk2igNl9RqGKqAI3CZbPGMd9m8JtC1s/Eye/qyKNPi8y8GgJP1cZdoRYvW5QUJ2OvcAiOx8SBHZsnPXcWTGoiQfBjvj64srBNJB+lHdU/gXjCCuub+AVJHaK2nirJeNUZVR0n80AFo0jcFtLNGXRmPxFraUxbQRkDi0auef7nKFP/GZBaQZcHL2KPlcYHVnPT7IfIcfp8bHmBmjwJUMLR4XWJZBly7iJ0SJSivnI+HrrMaD8ESdS30a/3JIdx1ySrmTrrCz/bQefmnKTQ4XTce11j0olMlhalRGKYBIaDj5Y3EEFbsvP83xw8WB4v9RqXYRy3MGG9MEQth4I/w3h4WrG5qoUGI1dSaq8Voc6CwsPXoGzjEgYa6FLef4IwRsWi2dUgOwq02RIbKbIyt1ayAF/LsXb5CD6ErfON7nVhXdpEp9X4mQkQoUceaHOvPPLyd7AiPmtHrqomJR42Yqvhd78yv1s0nLm0qyvYCCNAFK6r78l87C6dFDbLklKe00QzOzixVySlNUCkMz8JVRCFWoyFd/gdYx/OsQD4dEDnEuiHSrD0ZVtQZChaG0JLEWKbA5tIovd9lXuRW8LMOacdZc81U2UXAOicEH7IQXuhuMFtrceAGWBRj21LnW180lFAoHCJu25L/PK3ZZZbOw4dyba5z4Lin1Vk840Owa8H64qzIcH4EbeSFQ8sUIiyHI7otyBNRYLjPH1EqgAqzmrATdCAIW8+v1GjmK5vZE5V+OQ1OQefe2kUkJ94ZVPPd75mL4gmzphC1lzYGXNVdjb2B5BNlLcnuHdfTX8FlUNB6ZWt9d/VkEOdQsQecWgVoJ6u/Jn++YRvNEDU8Nd+gjMvvKwVwFv1pcnnryz4F0lixd0g==", "X-OriginatorOrg": "nxp.com", "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 2ec5b9a4-9f51-4ed0-cd85-08dea0525461", "X-MS-Exchange-CrossTenant-AuthSource": "VI0PR04MB12114.eurprd04.prod.outlook.com", "X-MS-Exchange-CrossTenant-AuthAs": "Internal", "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "22 Apr 2026 09:34:19.7548\n (UTC)", "X-MS-Exchange-CrossTenant-FromEntityHeader": "Hosted", "X-MS-Exchange-CrossTenant-Id": "686ea1d3-bc2b-4c6f-a92c-d99c5c301635", "X-MS-Exchange-CrossTenant-MailboxType": "HOSTED", "X-MS-Exchange-CrossTenant-UserPrincipalName": "\n 1HtRdviUSr41HisYj3pnaGYjbRqBroKfO5PVlMxEwA2eiTIQdjMxEsjLMmOi32nZ1b+CfVuIOSMF53dLDURdfg==", "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "PA2PR04MB10129" }, "content": "Introduce generic helper functions to parse Root Port device tree nodes\nand extract common properties like reset GPIOs. This allows multiple\nPCI host controller drivers to share the same parsing logic.\n\nDefine struct pci_host_port to hold common Root Port properties\n(currently only list of PERST# GPIO descriptors) and add\npci_host_common_parse_ports() to parse Root Port nodes from device tree.\n\nAlso add the 'ports' list to struct pci_host_bridge for better maintain\nparsed Root Port information.\n\nSigned-off-by: Sherry Sun <sherry.sun@nxp.com>\n---\n drivers/pci/controller/pci-host-common.c | 164 +++++++++++++++++++++++\n drivers/pci/controller/pci-host-common.h | 28 ++++\n drivers/pci/probe.c | 1 +\n include/linux/pci.h | 1 +\n 4 files changed, 194 insertions(+)", "diff": "diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c\nindex d6258c1cffe5..77905c728d0d 100644\n--- a/drivers/pci/controller/pci-host-common.c\n+++ b/drivers/pci/controller/pci-host-common.c\n@@ -9,6 +9,7 @@\n \n #include <linux/kernel.h>\n #include <linux/module.h>\n+#include <linux/gpio/consumer.h>\n #include <linux/of.h>\n #include <linux/of_address.h>\n #include <linux/of_pci.h>\n@@ -17,6 +18,169 @@\n \n #include \"pci-host-common.h\"\n \n+/**\n+ * pci_host_common_delete_ports - Cleanup function for port list\n+ * @data: Pointer to the port list head\n+ */\n+void pci_host_common_delete_ports(void *data)\n+{\n+\tstruct list_head *ports = data;\n+\tstruct pci_host_perst *perst, *tmp_perst;\n+\tstruct pci_host_port *port, *tmp_port;\n+\n+\tlist_for_each_entry_safe(port, tmp_port, ports, list) {\n+\t\tlist_for_each_entry_safe(perst, tmp_perst, &port->perst, list)\n+\t\t\tlist_del(&perst->list);\n+\t\tlist_del(&port->list);\n+\t}\n+}\n+EXPORT_SYMBOL_GPL(pci_host_common_delete_ports);\n+\n+/**\n+ * pci_host_common_parse_perst - Parse PERST# from all nodes in depth first manner\n+ * @dev: Device pointer\n+ * @port: PCI host port\n+ * @np: Device tree node to start parsing from\n+ *\n+ * This function recursively parses PERST# GPIO from all PCIe bridge nodes\n+ * starting from @np in a depth-first manner.\n+ *\n+ * Returns: 0 on success, negative error code on failure.\n+ */\n+static int pci_host_common_parse_perst(struct device *dev,\n+\t\t\t\t struct pci_host_port *port,\n+\t\t\t\t struct device_node *np)\n+{\n+\tstruct pci_host_perst *perst;\n+\tstruct gpio_desc *reset;\n+\tint ret;\n+\n+\tif (!of_property_present(np, \"reset-gpios\"))\n+\t\tgoto parse_child_node;\n+\n+\treset = devm_fwnode_gpiod_get(dev, of_fwnode_handle(np), \"reset\",\n+\t\t\t\t GPIOD_ASIS, \"PERST#\");\n+\tif (IS_ERR(reset)) {\n+\t\t/*\n+\t\t * FIXME: GPIOLIB currently supports exclusive GPIO access only.\n+\t\t * Non exclusive access is broken. But shared PERST# requires\n+\t\t * non-exclusive access. So once GPIOLIB properly supports it,\n+\t\t * implement it here.\n+\t\t */\n+\t\tif (PTR_ERR(reset) == -EBUSY)\n+\t\t\tdev_err(dev, \"Shared PERST# is not supported\\n\");\n+\n+\t\treturn PTR_ERR(reset);\n+\t}\n+\n+\tperst = devm_kzalloc(dev, sizeof(*perst), GFP_KERNEL);\n+\tif (!perst)\n+\t\treturn -ENOMEM;\n+\n+\tINIT_LIST_HEAD(&perst->list);\n+\tperst->desc = reset;\n+\tlist_add_tail(&perst->list, &port->perst);\n+\n+parse_child_node:\n+\tfor_each_available_child_of_node_scoped(np, child) {\n+\t\tret = pci_host_common_parse_perst(dev, port, child);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * pci_host_common_parse_port - Parse a single Root Port node\n+ * @dev: Device pointer\n+ * @bridge: PCI host bridge\n+ * @node: Device tree node of the Root Port\n+ *\n+ * This function parses Root Port properties from the device tree.\n+ * Currently it only handles the PERST# GPIO (including PERST# GPIOs from\n+ * all PCIe bridge nodes under this Root Port) which is optional.\n+ *\n+ * NOTE: This helper fetches resources (like PERST# GPIO) optionally.\n+ * If a controller driver has a hard dependency on certain resources(PHY,\n+ * clocks, regulators, etc.), those resources MUST be modeled correctly\n+ * in the DT binding and validated in DTS. This helper cannot enforce such\n+ * dependencies and the driver may fail to operate if required resources\n+ * are missing.\n+ *\n+ * Returns: 0 on success, -ENODEV if PERST# found in RC node (legacy binding\n+ * should be used), Other negative error codes on failure.\n+ */\n+static int pci_host_common_parse_port(struct device *dev,\n+\t\t\t\t struct pci_host_bridge *bridge,\n+\t\t\t\t struct device_node *node)\n+{\n+\tstruct pci_host_port *port;\n+\tint ret;\n+\n+\tport = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);\n+\tif (!port)\n+\t\treturn -ENOMEM;\n+\n+\tINIT_LIST_HEAD(&port->perst);\n+\n+\tret = pci_host_common_parse_perst(dev, port, node);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/*\n+\t * 1. PERST# found in RP or its child nodes - list is not empty, continue\n+\t * 2. PERST# not found in RP/children, but found in RC node - return -ENODEV\n+\t * to fallback legacy binding\n+\t * 3. PERST# not found anywhere - list is empty, continue (optional PERST#)\n+\t */\n+\tif (list_empty(&port->perst)) {\n+\t\tif (of_property_present(dev->of_node, \"reset-gpios\") ||\n+\t\t of_property_present(dev->of_node, \"reset-gpio\"))\n+\t\t\treturn -ENODEV;\n+\t}\n+\n+\tINIT_LIST_HEAD(&port->list);\n+\tlist_add_tail(&port->list, &bridge->ports);\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * pci_host_common_parse_ports - Parse Root Port nodes from device tree\n+ * @dev: Device pointer\n+ * @bridge: PCI host bridge\n+ *\n+ * This function iterates through child nodes of the host bridge and parses\n+ * Root Port properties (currently only reset GPIOs).\n+ *\n+ * Returns: 0 on success, -ENODEV if no ports found or PERST# found in RC node\n+ * (legacy binding should be used), Other negative error codes on failure.\n+ */\n+int pci_host_common_parse_ports(struct device *dev, struct pci_host_bridge *bridge)\n+{\n+\tint ret = -ENODEV;\n+\n+\tfor_each_available_child_of_node_scoped(dev->of_node, of_port) {\n+\t\tif (!of_node_is_type(of_port, \"pci\"))\n+\t\t\tcontinue;\n+\t\tret = pci_host_common_parse_port(dev, bridge, of_port);\n+\t\tif (ret)\n+\t\t\tgoto err_cleanup;\n+\t}\n+\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn devm_add_action_or_reset(dev, pci_host_common_delete_ports,\n+\t\t\t\t\t&bridge->ports);\n+\n+err_cleanup:\n+\tpci_host_common_delete_ports(&bridge->ports);\n+\treturn ret;\n+}\n+EXPORT_SYMBOL_GPL(pci_host_common_parse_ports);\n+\n static void gen_pci_unmap_cfg(void *ptr)\n {\n \tpci_ecam_free((struct pci_config_window *)ptr);\ndiff --git a/drivers/pci/controller/pci-host-common.h b/drivers/pci/controller/pci-host-common.h\nindex b5075d4bd7eb..6b4e43e6ff22 100644\n--- a/drivers/pci/controller/pci-host-common.h\n+++ b/drivers/pci/controller/pci-host-common.h\n@@ -12,6 +12,34 @@\n \n struct pci_ecam_ops;\n \n+/**\n+ * struct pci_host_perst - PERST# GPIO descriptor\n+ * @list: List node for linking multiple PERST# GPIOs\n+ * @desc: GPIO descriptor for PERST# signal\n+ *\n+ * This structure holds a single PERST# GPIO descriptor.\n+ */\n+struct pci_host_perst {\n+\tstruct list_head\tlist;\n+\tstruct gpio_desc\t*desc;\n+};\n+\n+/**\n+ * struct pci_host_port - Generic Root Port properties\n+ * @list: List node for linking multiple ports\n+ * @perst: List of PERST# GPIO descriptors for this port and its children\n+ *\n+ * This structure contains common properties that can be parsed from\n+ * Root Port device tree nodes.\n+ */\n+struct pci_host_port {\n+\tstruct list_head\tlist;\n+\tstruct list_head\tperst;\n+};\n+\n+void pci_host_common_delete_ports(void *data);\n+int pci_host_common_parse_ports(struct device *dev, struct pci_host_bridge *bridge);\n+\n int pci_host_common_probe(struct platform_device *pdev);\n int pci_host_common_init(struct platform_device *pdev,\n \t\t\t struct pci_host_bridge *bridge,\ndiff --git a/drivers/pci/probe.c b/drivers/pci/probe.c\nindex b63cd0c310bc..6094b6c1fc90 100644\n--- a/drivers/pci/probe.c\n+++ b/drivers/pci/probe.c\n@@ -660,6 +660,7 @@ static void pci_init_host_bridge(struct pci_host_bridge *bridge)\n {\n \tINIT_LIST_HEAD(&bridge->windows);\n \tINIT_LIST_HEAD(&bridge->dma_ranges);\n+\tINIT_LIST_HEAD(&bridge->ports);\n \n \t/*\n \t * We assume we can manage these PCIe features. Some systems may\ndiff --git a/include/linux/pci.h b/include/linux/pci.h\nindex 2c4454583c11..cb5f3e7e8e48 100644\n--- a/include/linux/pci.h\n+++ b/include/linux/pci.h\n@@ -636,6 +636,7 @@ struct pci_host_bridge {\n \tint\t\tdomain_nr;\n \tstruct list_head windows;\t/* resource_entry */\n \tstruct list_head dma_ranges;\t/* dma ranges resource list */\n+\tstruct list_head ports;\t\t/* Root Port list (pci_host_port) */\n #ifdef CONFIG_PCI_IDE\n \tu16 nr_ide_streams; /* Max streams possibly active in @ide_stream_ida */\n \tstruct ida ide_stream_ida;\n", "prefixes": [ "V14", "02/12" ] }