From patchwork Thu Sep 19 22:03:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13808016 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F0DDCF3973 for ; Thu, 19 Sep 2024 22:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: Content-Transfer-Encoding:Content-Type:Message-Id:Date:Subject:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=U5hyEexqSJM3L1dF/wpAUvlH8NDjFDFwAw0HSKX5rIo=; b=P6o1kEZgHosVDl97ofm08+a1OT 3J1QbteLKPryoBntEmtU/YXoDeEkb8nDdZ+4Y9BvC09Un1VEF5CNiTytWwz+W2WF73PxrASUerxLj GsZ4uu1IXAbrRYDcmYyeBqyldWnXTyyNKP2bLr8JTe7b3XCaJIRRxRqd5cM0yTkDfEMyZ0bRu56oH WJigYoh8jg4V99xoqUckRxRM4ntmZzAEOR9w9VFHh1/HWHO4qK632WDNoioJOKEQ4VTE1EQJLj2n5 R/7258bxxLBPBy6GtrL7nF9zTbLIVmyN0Mvd3LBepfwCcaz8fHAty1b75tAvoo0ccCDb1at3C4wTN GcDAkhTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1srPGo-0000000B4rS-1wDq; Thu, 19 Sep 2024 22:05:02 +0000 Received: from mail-vi1eur02on20624.outbound.protection.outlook.com ([2a01:111:f403:2607::624] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1srPFf-0000000B4XU-20wJ for linux-arm-kernel@lists.infradead.org; Thu, 19 Sep 2024 22:03:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rYj4sKsPjhvr2tbwUyGchCUDYK3At7VVosFmz0IIJoBI7nMujCrVlqsjjz3B7MrPQ23Aal+ojWIZxrwCWsFCJ/HsTp7pcwO07rywyKONcAnfLeVDdboviuI2KnxtwNUVU7mnYZcuUK9xMQzPMJA/8hLDusRjmxCZtDQzp/4w7eygboGIiLZxowPilhAQpsqxEASUnEnHxEpWQzPx5ejJzbQmF0UHXulBGDQkC8SHAMfQ9KpEp1XUEDIOvxzzr41LPtmcRBr1wuRdJP8XBwo3VBXsuvnscdrcURb/pG3rLZ6M6X7P72WXvtCTPP2Jz89L4BSflLIbet0xtDGvDj3lWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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; bh=U5hyEexqSJM3L1dF/wpAUvlH8NDjFDFwAw0HSKX5rIo=; b=Iyx94DMLfmLwFqj/j3cNsGTDTKATJVcueBdAZrz002ny+XoFNpRB5dFbKi/AeA0HonqPuiVKpcBkbyaAMWRkAhJbLLy97JN0e7Ft3cMuwxC5S/Tvf3KzqjBNOB7jcx9qMQrHENPdd/TH2pQgD9LdhETHghJjooXN5BHTpLYUJfAs0EPnjhUcPaZPaYVN3hSR82im6je925wYuvAXCMIfp0Tx9U6eEkvx7q92v4t5ETuF4+BPVrcCxryZDUyLfYRoXXFVmtFcW55Zivh/LjtYdIpitf+INXzvDiwXHLrdsIhYocf+FzKYWj5infXs9DpCMv2s9CReM+Ac5EtR+hdzLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U5hyEexqSJM3L1dF/wpAUvlH8NDjFDFwAw0HSKX5rIo=; b=PlOKsvuEW7EB8Q3j8VWZT/gyLGJ2FOL3cZ+az7O6TJJHWOI2/EQkNbaTrrRPyuxcdyivVqcwDd8IQhJjcnuwEgsnGz9dUfyH/e8MvU6AFsfrqcAEabWwFw5ilynkUu4ZVkLJhN/VdIg4yYgJKK7r2OrHxhnwSCX61bT4/1U4jzAzT/0LxC4U2k7Uz3NEy8q2ZIqjelczegpZhK5jr+GC4kXr7Vvv6m2BDRGGgmmDTnO+H9oWhKBfENu8/5Em975IHdFA921HpYMAyXjCQIYBYWdGsxoNhtsmEL7uNkJzIK5AM/vkA6xitudYYGmi4FYhWa06pwTg/EhxyRSo7YlBAg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AM7PR04MB6965.eurprd04.prod.outlook.com (2603:10a6:20b:104::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.16; Thu, 19 Sep 2024 22:03:35 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.7982.018; Thu, 19 Sep 2024 22:03:35 +0000 From: Frank Li Subject: [PATCH 0/9] PCI-EP: Add 'ranges' support for PCI endpoint devices Date: Thu, 19 Sep 2024 18:03:00 -0400 Message-Id: <20240919-pcie_ep_range-v1-0-b3e9d62780b7@nxp.com> X-B4-Tracking: v=1; b=H4sIAJSf7GYC/x2MUQqAIBAFryL7XaBWkF0lQsJetT8mK0QQ3T3xc xhmXsoQRqZJvSS4OfMVC5hGUTjXeKDlrTBZbXvtzNimwPBIXqrswxAGdFrDOCpNEuz81N+8fN8 PoJIo118AAAA= To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Abraham I , Saravana Kannan , Jingoo Han , Gustavo Pimentel , Jesper Nilsson , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@axis.com, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, =?utf-8?q?Krzys?= =?utf-8?q?ztof_Wilczy=C5=84ski?= , Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1726783409; l=3664; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=vDo0CTqtXkW2vkHMQRmkJR3TexBHqAnWrGWuqBuQVvg=; b=I6GHA1h9s7oxVcrQiepOky1wY4WBDAWvoAELK38hjFatMhxl9TjQCU1qH4K8R9CQEa5XC9FWP tqewaEtk+C9BmZMg1Jyx1bXGQfTgiNoGmybMsfQZMxwN39pFMw6cMBf X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0057.namprd05.prod.outlook.com (2603:10b6:a03:33f::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM7PR04MB6965:EE_ X-MS-Office365-Filtering-Correlation-Id: bf423d20-649e-4aac-8ed2-08dcd8f6e848 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?MIntzpL8U9RdJvkhePRvj+gRgB/Mr3n?= =?utf-8?q?09S5KkoMnBtnEN8Aisf3Nt+hu5UnbzPnVeQW+xybK/XuCi187Lpzfk1c5ZTn0Fzat?= =?utf-8?q?HTuHRI+FI3iBPFXxV54zexEyRF+4kJXBwuyo3BHmBPgoSQb0nOhQHHzOtjAfiuCqy?= =?utf-8?q?8p3XiFL9PMNT0VwiRgzbDCI2qPvAsQB2PA/zf0/7Iuxm4pbqIfwkZVyZusCa2emae?= =?utf-8?q?atBN/L3RbS95bvmQcU+NYg6jBDZo4WbItcXEUZk+STEJs+OmiHVW57qLMrGYisltg?= =?utf-8?q?4PJM41g2KOgT7/NZGiJSQpQ/tbugs56mYe8TKTdz/Kr5xvvQTwknvP76PnNTAuVkC?= =?utf-8?q?ebZPArPH0dY8gImAsjdMo5WTb4o7pe/eHlAYzgQj+1OPT6T7CVcX/ua6va/sIfr2U?= =?utf-8?q?As1oRPbqnL7LC3XPmyIzbJN6uZ1qJ8rxU/6dGFfVDen27fBYrwC/r1ttiW4lHUHHg?= =?utf-8?q?Ko3f348FkHkhyLIsdfWRvrhvUmlOpRibO50/odZdJkeCcPt/c7n0pEupGi6NZzhBD?= =?utf-8?q?gqg63b1W0QoDwr8quCTRGFfNClHxYXs8iU5YId8rVAuKZH5BSRlDPa5W0mInlUypo?= =?utf-8?q?YxX/MBmuUMBE48Rq99k25FUlBa1CLnLaidW06e78Unf+VfBobZHw1NngZFh4hYb6h?= =?utf-8?q?bdv4oIui0bkfaKPusbf0OeSrWhfSAF/5ndkpXZI+McnoUIh3v3uOXzvwqGt0YLYBb?= =?utf-8?q?+vCjMhR2H8FJOo14jZmLHOPrDNYV8wb7I8/3uhXPDl2mZ4waRwng9d/AHCqhy2E4h?= =?utf-8?q?/GMQyrCmOw/EaZBMCCY+RSVkuASXitK8wgoDx6qxWHrlHBywsV8p/4+Paa8kF/T7r?= =?utf-8?q?wNdL2StXZ8pqu6rSkcVseISj4yuuhDimbb/Wd4m6fR55L0QczhEfFgi2bhAfWNvby?= =?utf-8?q?z3cyWI9N/H89aNbxXMF1xc+A8J8pshkRtRdEnXvB0o14GQ0uta2uPM6S5Hj+YjIk9?= =?utf-8?q?MvdN1gfPtuth3LdInySmtxscdwsoF+OpGbnOTeZyOGkckK7bO2vhyrDa8EU4Yo7Ll?= =?utf-8?q?8I2xHHrbZEI6Hdi7DFkwrujlsd6SzWM/NqvZdJTzpNpkp4gXV2EeGjaOWZbRhNlD3?= =?utf-8?q?ayPvkihRZe1Js1QjpqPBOAG/G06y+epEd5OcdMsjH6nr+gNlZcm5lmw5wrRUqHlzP?= =?utf-8?q?ropP9GPpTzQJGNBV7dHAHiJCqrSzGBThDcL4c/IAHnXeY1dT4uDBToxxapvi7XAfP?= =?utf-8?q?LFWCeYWEU9LbdsU6wzUuOSjM/5R3DohSwmDkKDSGuLrXiUVqUEmAVTjXXHWona7vc?= =?utf-8?q?GtuDBLIG7OSVKQQw62siJbO/R7eL0MxAqlTUmNHlsYCoiCxrRy2xJsflrdsxVvoPt?= =?utf-8?q?AkeDeqecIxTVui6tRfgL0k08ZacZTojwax/eD0ijnsisnDtFKu6VXBM=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(366016)(52116014)(376014)(1800799024)(921020)(38350700014);DIR:OU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3AcG+Jw5M4z1lcTw3m2C6pVCJKO9?= =?utf-8?q?ELhPBqC5r18Triw4q7qRxdrxtQ/+6GgnvzjQ3y4THV5WjOkXRaeMYIS8kIIdWO6Td?= =?utf-8?q?b1Cz43GuabMLga+tOZ593h/1VFJlSLajwkOSBYud0vA4vitnn5Jjy5L/nbG0LgFBi?= =?utf-8?q?SVgi/w7YJOQZ+EFCB4Ceng5adt8HQfw4/SX1HJasDiM5cJlSlmz4m36U5+EYcXHZJ?= =?utf-8?q?qB7b5MCWKkoLHnEGSGlbe982fWmpk9vxxSzfMsF8LySMLj6FSoe5D+tEv2sec3P0c?= =?utf-8?q?v1aT/nbWDGWvDKtBr0LBGu/Z1dfwvqrJ5yDDC6aPrTyL3n0JOPFuC+hLy/qaXsgGf?= =?utf-8?q?KloQOgeKcLu7QPEeDh8WDVg9L/bDTnPVusXZogxNFJ/WpK0+gpFbsUzanwxEY9WSR?= =?utf-8?q?icWX6xrlodidVnejkuYxmWFBdtgRfoPjUOTTWVc4qMeV75Mknbb/MfKDt8VkopIer?= =?utf-8?q?MyGSQJqh02s+Uo6J7ancgbt7PuUjv0Ni481avs1PWWWervh3QhAF/BQQx4+FqxWwb?= =?utf-8?q?V7VuSTd0ILJ0ZXmb/3BLE/xSh6/wKYKtGkMGiq1I8b6RQa9Kq7aaEesNANZ4E2jws?= =?utf-8?q?59/o+F24VKxnPQChp9TmAeA/65UPV6WBwXr5BMAjLOSQjkWSz7d/uZzqDtUtlTKVj?= =?utf-8?q?gXpFUvNPq+7nZj2cV20qtDWXyn/GIHzMhgz7vP5S6yBN3cpbagRn2cW2E+68ZxG2z?= =?utf-8?q?2ydo3fWpuj8Q?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf423d20-649e-4aac-8ed2-08dcd8f6e848 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 22:03:35.2372 (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: ksc92cuzfDh9UvMJ62no/s2yZ5MfO8SYD0IwnJjH6WkhgJ/czYuhP8D0NBQ27/XVYp9dHpYiYaVm0GbJwYg5Tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6965 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240919_150351_594168_CB9665BB X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The PCI bus device tree supports 'ranges' properties that indicate how to convert PCI addresses to CPU addresses. Many PCI controllers are dual-role controllers, supporting both Root Complex (RC) and Endpoint (EP) modes. The EP side also needs similar information for proper address translation. This commit introduces several changes to add 'ranges' support for PCI endpoint devices: 1. **Modify of_address.c**: Add support for the new `device_type` "pci-ep", enabling it to parse 'ranges' using the same functions as for PCI devices. 2. **Update DesignWare PCIe EP driver**: Enhance the driver to support 'ranges' when 'addr_space' is missing, maintaining compatibility with existing drivers. 3. **Update binding documentation**: Modify the device tree bindings to include 'ranges' support and make 'addr_space' an optional entry in 'reg-names'. 4. **Add i.MX8QXP EP support**: Incorporate support for the i.MX8QXP PCIe EP in the driver. i.MX8QXP PCIe dts is upstreaming. Below is pcie-ep part. pcieb_ep: pcie-ep@5f010000 { compatible = "fsl,imx8q-pcie-ep"; reg = <0x5f010000 0x00010000>; reg-names = "dbi"; #address-cells = <3>; #size-cells = <2>; device_type = "pci-ep"; ranges = <0x82000000 0 0x80000000 0x70000000 0 0x10000000>; num-lanes = <1>; interrupts = ; interrupt-names = "dma"; clocks = <&pcieb_lpcg IMX_LPCG_CLK_6>, <&pcieb_lpcg IMX_LPCG_CLK_4>, <&pcieb_lpcg IMX_LPCG_CLK_5>; clock-names = "dbi", "mstr", "slv"; power-domains = <&pd IMX_SC_R_PCIE_B>; fsl,max-link-speed = <3>; num-ib-windows = <6>; num-ob-windows = <6>; status = "disabled"; }; These changes improve PCIe EP support by allowing proper address translation using 'ranges', ensuring compatibility with devices that rely on this information. Signed-off-by: Frank Li --- Frank Li (9): dt-bindings: PCI: pci-ep: Document 'ranges' property of: address: Add argument 'name' for of_node_is_pcie() of: address: Add device type pci-ep dt-bindings: PCI: snps,dw-pcie-ep: 'addr_space' not required if 'ranges' present PCI: dwc: ep: Replace phys_base and addr_size with range PCI: dwc: ep: Use 'ranges' from DT if 'addr_space' is missing dt-bindings: PCI: fsl,imx6q-pcie-ep: Add compatible string fsl,imx8q-pcie-ep PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() PCI: imx6: Add i.MX8Q PCIe Endpoint (EP) support .../devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml | 42 +++++++++++++++++++++- Documentation/devicetree/bindings/pci/pci-ep.yaml | 30 ++++++++++++++++ .../bindings/pci/snps,dw-pcie-common.yaml | 4 +-- .../devicetree/bindings/pci/snps,dw-pcie-ep.yaml | 21 ++++++++--- drivers/of/address.c | 30 ++++++++++++---- drivers/pci/controller/dwc/pci-imx6.c | 24 ++++++++++++- drivers/pci/controller/dwc/pcie-artpec6.c | 2 +- drivers/pci/controller/dwc/pcie-designware-ep.c | 23 ++++++++---- drivers/pci/controller/dwc/pcie-designware.h | 4 +-- 9 files changed, 157 insertions(+), 23 deletions(-) --- base-commit: 909eac36208b70a22fd0d1c3097e3af98dca7599 change-id: 20240918-pcie_ep_range-4c5c5e300e19 Best regards, --- Frank Li