From patchwork Mon Oct 28 19:05:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13853895 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2044.outbound.protection.outlook.com [40.107.20.44]) (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 F17F61DFE3D; Mon, 28 Oct 2024 19:06:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142378; cv=fail; b=HI1E+I2CoyQ/+bxFyktCp5avYhfhfvYUj24xRp+9Q1kcMSaB1/2/2hYymGUY0VD31STivd3hIjB7LwCxYbSgxlpnHdxzo/yWasSFSRgWUmU7cHIkVVPc3FGlsbEE6kU8CFx/z9+LUYAfWy61/U8fX5/SE2wD5VssYDrGxqacgyQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142378; c=relaxed/simple; bh=1rSpPrZTOLMx4xcaG4Itd6ReEroEzwhMtX2XtNZo75A=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=u2MAgySjgJ0OeepLKgTJhjsKiqcAlhqD+8Lji0WkM4e9Yy/+SgpHJHNvMKprYGoBDoMc2PLXRWZIUPMLg5zsRFGklydNJ4cJEEnBcLaKyTigbWK0g7lsQO51oycWUWJe8pBP0GGdPTBp6y3Va6liYiMCeS0eqzjiqRzCs9gLy8s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=i44CfLEA; arc=fail smtp.client-ip=40.107.20.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="i44CfLEA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bYdR31S7JxRhwuB2Qa+v1lkJ5lEnSOpyh+o/d4iIoKQmdj3Vxj3PMFHJ9iqEVUO+4Myl5fapCCJg6szdamK0ISgbtwIyaEjAOVkbWTWgn3DUUJ0+vANxGzCMDAf9N8f3C7y5MYRuXnnmomKW7Rs52er2kLq/c9TDycwHFS/xw22b5x7MqcXPMq1ei34lXaVcAdaXXEKRITC48lChj0PvhNhFoCFqGaSwuW2jjiJ9ac9Ne0K/DsCtukBYHTdlqQwdkJ5Rtw+tT7jrnjwSJKhz3jGyEMQ0NyjCMnLc6yVafrsn7F4QqtFXcg98NttEOP/top+zF8xXUkitq7qzFRDbfw== 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=j/JXxzlgrGYw0PU9k1GSfpOM2XBdolyCC6yjHKtj9mc=; b=U56AaNicLTW7w20oCYSoDMhA9/kzpNpJLAHudHvbTaHVTgxAp+vcjMhVB/UvHoB9ICcvzhfyWFvb+Ud0bJqWBPWbKh38N5yclpCQzY0ZEGzS4giuHRuuzwtLs/kHQul3WhMF54dtSS45aoNQBJNlujSxOg/0BEHdMV8hnaRa3WGrfGKKl7NBuApP8fqp0IfA/q7aTb/v/85mgoGDTjcr560VQ7zSG30y3ODji8MmlUKancXIlcNyMI7+zxhFZkBd31HGXO+2Vd3kd8ZM+9Y1ktpgHrJF58DgLBeQ5ZARxnA6NxOKxLfUvG0liNyQibPNihmbPFJcB52IZTRc3ubs1Q== 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=j/JXxzlgrGYw0PU9k1GSfpOM2XBdolyCC6yjHKtj9mc=; b=i44CfLEATVuAKr9NkEo5nIT8nyAN0O3131/VQOW+g+pNar4yLiviiHDj4fqxtWQT3NVTQlwTU0sQWbhRrBon4gP4MvU0GoKld3jJFHAfawcO2t/WhpPa+SB0Bm8z3QECX/4wHt6j6Ye9OnsJV1JYOAyqYB3FffytSE5p7/NiQYash93aa+tNn2mqSLaM6BdRiTRwsUrqrlu0TGWf308qRBEjAN5VWLJLVDt+qUM44ggoLCBBaxrh8DsyqkeG93KSxXa82mMe4baL3pM6ELmvr8IzfuxT7cmTdnUPyPM7qQH4IVLpdw3ynBBqly3eMiP3CVd/ccTRu4ZaLk1GCmFYqQ== 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 DBBPR04MB7946.eurprd04.prod.outlook.com (2603:10a6:10:1ec::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 19:06:13 +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.8093.021; Mon, 28 Oct 2024 19:06:12 +0000 From: Frank Li Date: Mon, 28 Oct 2024 15:05:55 -0400 Subject: [PATCH v6 1/7] of: address: Add parent_bus_addr to struct of_pci_range Message-Id: <20241028-pci_fixup_addr-v6-1-ebebcd8fd4ff@nxp.com> References: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> In-Reply-To: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730142363; l=4762; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=1rSpPrZTOLMx4xcaG4Itd6ReEroEzwhMtX2XtNZo75A=; b=J6JHDGWw7+6ttmVw93GRpH/jRwLln1TzuZg5mAkybhPYDvZQ+fEG8f+9RhzC56plqOFdcImic T2IfknfXeVzDnLRpqG3P3EcsV5ohLwEU6D/ZNYt0B17KM190FvUOY4/ X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0005.namprd03.prod.outlook.com (2603:10b6:a02:a8::18) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: b7335a89-7173-47e9-2c42-08dcf7839706 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?HfnyrfoRGKBS0ubqgDlUIAiZ+6nt8hd?= =?utf-8?q?sVpXO/TEdLmCTttZS7gFEXCMj+AI17CTueH4bXdzcmLdmheWjZtx/GrjCSkeho/Ct?= =?utf-8?q?XHbu2rw4ug454B2kWTcpAwspbSwFGSk4YJMxwlFgHJ+TtV3z9fJl0sk9LJq+xqmEM?= =?utf-8?q?+n9f0Vk9b7iB19aP2+Yf6rHCUWAXGcL5bmOvyVbMyZfY4Queeu3O9Co1hIbf2iMME?= =?utf-8?q?AS1gFTlIq7PlIp644dcRNiwqR5NIdhY2sIfy7BCzvlAIfnNFTbNvML3RJ98uCF/h1?= =?utf-8?q?7Vy/8tWCcqo0r8pr66FfTwn+7L9TEkceaqiGVZrzRhbS3SA3UzHTg5HxXBqUQnyeF?= =?utf-8?q?KHE5ltZwXz5yasBVafebIcuP6a/zlYP5VOPwKMOS7HSn8aNzm9MD0SuJQyFUxUeqe?= =?utf-8?q?u2Vuyr+hSSgW/rFBqW9moevUJlzwOiL9tkZYgvX0bQQJCN53tgD+NE5LLCh+iRuvm?= =?utf-8?q?WngeLuBhE5yzHllQ78txI4dcgnQJoy9Z3nFdtzqL5iJLzzNSTY9KT767WRAsDnRnE?= =?utf-8?q?m4uwzX1VZaogFHNXxSGi21A/byPaDqTM/kJZhf9FVPCBqhzGLLiUclNj0K7y3gR/o?= =?utf-8?q?TjJtSDxUZsdSt7WxznkQLbLNJLQxRLjAnY/jpYgN/afMuV7LwFeQDlmo6L7Eg5XHG?= =?utf-8?q?bcEs9vY94m7C7CCgr47slA/xJKHfdbhk0DS3oj97MkX61NIv3ZoDObfvT0JvLVe+I?= =?utf-8?q?ftkSLDCr7NLFU2KJN/Eh7YLOEzGE0Kuee6fVtBRzgVKsQB2+jQ/JpWtgY4j0PqZkt?= =?utf-8?q?L+Z1RjWMcxRFQqs+qig3lGZpw+KlQWg3y5pTo9NrmiqxqGBzgzuY9ZHIh29J79q8T?= =?utf-8?q?ncKcBFkHhN+fZSAf/I1F4siYpmXjUFG0WfQj9kmpcRPAO1SjdAYwDMPMxaFLiiG/S?= =?utf-8?q?ANfPPg2JWz9OS2r9izV+LOniZvTHgXB7+iNj1SfxGIvAeqwHZ9h/0bUts3aCZwBoC?= =?utf-8?q?F3b64FSyhK9NHHUCPbQSD2ZhMIERnd5NWCB7s6bdqPLr0A+l77ySsMK0ywvXE6i3E?= =?utf-8?q?ZsQw9AEv41o3+f5QZ2vWuHk9nJ9RnQQFwNbTAklKF/Mr3bkdpQ4bFkYkpnvpNqAiT?= =?utf-8?q?9AAApQf4499yqu9iFOKP+LxccKfFKbYzlaaVSASYxBGTJLqekp5p7EGvDm5hs5bDN?= =?utf-8?q?ctRsJDSARdPdD2z0JpFFFO5+isVNOY4um2NyKTtYDwUeL3m13LxlyDRgOX0uHsFd9?= =?utf-8?q?zpCUH1IYzJiSfCFV7zC+Xt+/7ieyzTFe6yWkYkpFStlbCBBAR7COGBT6IQi3Ybnux?= =?utf-8?q?KTnWb7wW4PzwjGi+Jpt9ccibQS5FRHnZFSjcAWUzfmLtPXuQ19ifQIzP0oyrZHqqD?= =?utf-8?q?mSYgp99UliHY?= 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wnaxyA6YYxO1o3UFMYTokFGatIOd?= =?utf-8?q?7lGCHrur+dNgPFvncsKoDt863qB2u1eZ/90e3MR8CBoWj4tshJnI9SaaU2ZEAhqaj?= =?utf-8?q?yep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wz+yVqhc1jgRRPlrFSeUAL/Qmf8oOeQSDFRznoptsF4JfPF5FvnUH6IUHv?= =?utf-8?q?G/RngHDxywiGZqc1vcFiQz6TRMTXIJvH7EzPaliAXHrcViSkihq2kN0t04Ytvhg7s?= =?utf-8?q?tJy7MIqqOUXnjn//S2ujho4CmybzeZPeqH35xWvMjszMZM+JWVnV4QjtF2mZ1tWX9?= =?utf-8?q?bHAIlh/ud2LUOeLZ/MTP1shi7O3PdBtdMPl2vjUaZnHv8v47ticglEEtTZgd68UuP?= =?utf-8?q?/M0B21Yx/vKEI16pS7Xe/FQviW8Y+r6mwSV3mb3JakeOEE5Pk1feCtVxF59nBQGq+?= =?utf-8?q?2PsbMG15DXza5v5tqNwytHUFaS8pLf6zwv4vTNrRr7njVj/It8b2OL+FS8ySWyY5S?= =?utf-8?q?RT7kfra5wmWMXCMPwrpKw4YweVl2x/BH90M7RexHfeF2i1ENe8u0mJyQohEj6AO6S?= =?utf-8?q?NoileRhkgYKrQ21IHvRpVbkofIS1konu9QIW0HAZQZ6TNxmfcNB5WM9Bc2ZcCJzi3?= =?utf-8?q?upiqHND+BkQUvvzFpxL/q/6OB014clkapWx3tcYqy3ge3UqZVmHFVs8CHeTntbm1N?= =?utf-8?q?C3nusIImSUTY?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7335a89-7173-47e9-2c42-08dcf7839706 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 19:06:12.7368 (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: jPbyIgtpRxiIuPXYjon8GAYaJTu9MplsXJ9SzDQ6HYMWKdghiBYsKb3CdfLRghskuAAnussHAy4ILdy9nppsYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7946 Introduce field 'parent_bus_addr' in struct of_pci_range to retrieve parent bus address information. Refer to the diagram below to understand that the bus fabric in some systems (like i.MX8QXP) does not use a 1:1 address map between input and output. Currently, many controller drivers use .cpu_addr_fixup() callback hardcodes that translation in the code, e.g., "cpu_addr & CDNS_PLAT_CPU_TO_BUS_ADDR" (drivers/pci/controller/cadence/pcie-cadence-plat.c), "cpu_addr + BUS_IATU_OFFSET"(drivers/pci/controller/dwc/pcie-intel-gw.c), etc, even though those translations *should* be described via DT. The .cpu_addr_fixup() can be eliminated if DT correct reflect hardware behavior and driver use 'parent_bus_addr' in struct of_pci_range. ┌─────────┐ ┌────────────┐ ┌─────┐ │ │ IA: 0x8ff8_0000 │ │ │ CPU ├───►│ ┌────►├─────────────────┐ │ PCI │ └─────┘ │ │ │ IA: 0x8ff0_0000 │ │ │ CPU Addr │ │ ┌─►├─────────────┐ │ │ Controller │ 0x7ff8_0000─┼───┘ │ │ │ │ │ │ │ │ │ │ │ │ │ PCI Addr 0x7ff0_0000─┼──────┘ │ │ └──► IOSpace ─┼────────────► │ │ │ │ │ 0 0x7000_0000─┼────────►├─────────┐ │ │ │ └─────────┘ │ └──────► CfgSpace ─┼────────────► BUS Fabric │ │ │ 0 │ │ │ └──────────► MemSpace ─┼────────────► IA: 0x8000_0000 │ │ 0x8000_0000 └────────────┘ bus@5f000000 { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges = <0x80000000 0x0 0x70000000 0x10000000>; pcie@5f010000 { compatible = "fsl,imx8q-pcie"; reg = <0x5f010000 0x10000>, <0x8ff00000 0x80000>; reg-names = "dbi", "config"; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; bus-range = <0x00 0xff>; ranges = <0x81000000 0 0x00000000 0x8ff80000 0 0x00010000>, <0x82000000 0 0x80000000 0x80000000 0 0x0ff00000>; ... }; }; 'parent_bus_addr' in struct of_pci_range can indicate above diagram internal address (IA) address information. Reviewed-by: Rob Herring (Arm) Signed-off-by: Frank Li --- Change from v5 to v6 -none Change from v4 to v5 - remove confused <0x5f000000 0x0 0x5f000000 0x21000000> - change address order to 7ff8_0000, 7ff0_0000, 7000_0000 - In commit message use parent bus addres Change from v3 to v4 - improve commit message by driver source code path. Change from v2 to v3 - cpu_untranslate_addr -> parent_bus_addr - Add Rob's review tag I changed commit message base on Bjorn, if you have concern about review added tag, let me know. Change from v1 to v2 - add parent_bus_addr in struct of_pci_range, instead adding new API. --- drivers/of/address.c | 2 ++ include/linux/of_address.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/of/address.c b/drivers/of/address.c index 286f0c161e332..1a0229ee4e0b2 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -811,6 +811,8 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, else range->cpu_addr = of_translate_address(parser->node, parser->range + na); + + range->parent_bus_addr = of_read_number(parser->range + na, parser->pna); range->size = of_read_number(parser->range + parser->pna + na, ns); parser->range += np; diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 26a19daf0d092..13dd79186d02c 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -26,6 +26,7 @@ struct of_pci_range { u64 bus_addr; }; u64 cpu_addr; + u64 parent_bus_addr; u64 size; u32 flags; }; From patchwork Mon Oct 28 19:05:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13853896 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2044.outbound.protection.outlook.com [40.107.20.44]) (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 ED4101E009E; Mon, 28 Oct 2024 19:06:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142381; cv=fail; b=GCsTZZGTw+dIPwz2MrGSTbS18NP0gAWVGOotUsV2Ogmit3o0uSe51uwAZGqTks/H9ompI4QAMhMnUgtyQfQtSDm/BaGYLc/m4GiX01FbDQDq37ZjKCNL0yVH29XNcBLT5Ep343xGl0blucgKOIXQhUrh4CpNMQTU3Jv2LcLbBDo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142381; c=relaxed/simple; bh=xiXouNpVhhagOvQdXFLvlfaRhzcVDADSufDDS7ir13g=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=KwW1PUJjcTlWb8kyFN9X1MvqP27//CZW4IqNv2vhV38cTowPwGFvFMyPFAWjZi7xte+g8XXY4gXn1fAKj9e379JZ9I+ViXKv5UqsUMxenJngvvRdFbedUzQw6Ydg+CwQ2lX6SQdUNuqJY3OhWeWfqLwChWev7nVMlnP0DRQi47k= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=YQgvxOlr; arc=fail smtp.client-ip=40.107.20.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="YQgvxOlr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k00L9f9BI4YCq9756XeJ287hUTvHIJVk5PNGhHPIeReAf1qxwDXzzyBz+iH8dhyaGWJTNz7p2kwXxNskAFJCoiP6j4KM4zFGmUhun8lNHjM8jLtVmxRqa7YUnjO/15p/Zlx3guCkKoJV33D6mXhRkhQNf4orlZ1rLaMiclh0LWSoVv6gshpGoIhdZ0n1+UywsejgbyXhfGytxKtdS8YMsCpC3YJFzFWBO0ct56/ZqbwOzOuGz/GnBZJM+XjFl/jNcnaOfKMLGfWqyj6QsKJuD5H80EX7AkniUt3lyHlNJAp3nQKewXUjt9Ca0opLJULjVbmCeQcEdRA9iPL4tGEiSQ== 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=72nw29hHFDlpi9crET+L23if2rJ656JTjj/1lPj7nXM=; b=jqyNrWEbXumyQ8Jtu1oS6TfvB3nPYiPKXDvoQQyWu1TYdRdsb1WkV4z1poXr8vyEuMVLqvp7r+vM2vDTuTuOoYa3DRBycG95gvO3+0abuxjspkk0LWuZbyp8tt37lmkR5/t6duDy0w3MTdX++ts368YGHrAWAEgo9loaI/1DcWOv35n6rciSD2J4lwp2Dg7GX129UWJ7M6x3ZTWELfLxDB0eIYe/fQy8yzOLC+SAr0vMeQP4TPCUwlUErNhxDumH4nP0XrfC0yTBBWIapJs8/GTnacqrk64XtmDnxxY1vnjZrXlzuLAkdQVH6sZMDs5bVWlsF7huSpfIJrrR+lYAcQ== 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=72nw29hHFDlpi9crET+L23if2rJ656JTjj/1lPj7nXM=; b=YQgvxOlrCjV0BhbDAPSweEuhr5pwW/M/Alb56QDsrCzbtVLA6H5GHxkB9UUJExh4J13VcgkJ1shQ6aG+GRLCi8f11AQey+EjwBNgspFmvcWv414RUed63n0ynTlkKI8QNo4IlqtFlhhec4j9RtUhlmC9uN7vRMvnRrEygEguG1+vWBEOzNTBIMTOtnI2PTbs/EmkQqKS2QUqTFgUARpk+tKzlzj/DglUni4LctNBXKNjUhav2B+LOr/eMUjUlqFeOyooZWdoI9EcaPa5/qZ4POhZhXSRwyFXQUwAD2xEotkVTOoOAOfaFwU82UZo9H4rZ6CsYW9NMcSLEXn87cq5tQ== 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 DBBPR04MB7946.eurprd04.prod.outlook.com (2603:10a6:10:1ec::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 19:06:17 +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.8093.021; Mon, 28 Oct 2024 19:06:17 +0000 From: Frank Li Date: Mon, 28 Oct 2024 15:05:56 -0400 Subject: [PATCH v6 2/7] PCI: dwc: Using parent_bus_addr in of_range to eliminate cpu_addr_fixup() Message-Id: <20241028-pci_fixup_addr-v6-2-ebebcd8fd4ff@nxp.com> References: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> In-Reply-To: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730142363; l=6907; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=xiXouNpVhhagOvQdXFLvlfaRhzcVDADSufDDS7ir13g=; b=1XAtPwmnz6utgJb/RgXFDtavRFJLTmEvREIQo8R68WR2nw0mr9p7AuMh2ILH2KG9QuZC0XOqd GVmw+rYESP/AvIAsufScZqwYRpxvl/2uw0EzbJk+uSP9fWALk43Bj0/ X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0005.namprd03.prod.outlook.com (2603:10b6:a02:a8::18) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ef1ffbe-4d91-4a31-5adc-08dcf78399b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?tncp/HuV7NsTf2TYhjaL/nylJbSnSH5?= =?utf-8?q?4l3KB4DtBFMTGm4M2reijg3NpEXJa7rwYkQkV3aAPTZPxj4PtEcZNzs/5dBVuIK1j?= =?utf-8?q?1B2UJFzbevalQYOQn8PY1TjREplfTpapvbIf2dNU/fc0hgtX2VuTRG3L3K8NmSLc6?= =?utf-8?q?KfZefBuTjoJc6HjocAKnuGHOdNF7V1hVu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qoFx4OJ7x5Ozug+V7w4EGxWiF35Qy?= =?utf-8?q?NZ9K/MJtemGXXEAvjLAzOpAj8PuZMnGwg8Nv+NsHzQkROpgAj7Qk3l25N8a+IvCGs?= =?utf-8?q?RRceBbDlLau7TRZL2ZBic/K87+vCdCr/OJ02+6/jbYtezspwyyJGC45iVmy5B7wrG?= =?utf-8?q?duLK91iqEorU5XQXXCnxK35/6Ng0Xf665Ohzlkz5WFE/f5R66LAfFgl2/wWS3JXnX?= =?utf-8?q?qrCFO+nJbCqDzoWjSgfTD+cugGKH+Q8ehSiix8BDmrvvek9x49pD25TUx9z4EjJia?= =?utf-8?q?czuh5sg+5ait?= 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?qDZxvvlRYjRMbJ4g7xOoulLH/q2T?= =?utf-8?q?faxnusJC3dYbN1RXhwNRns4j9H1jV8eMWTn26p4BkDPNT8Fve8dXIwk3/vg/tZqPQ?= =?utf-8?q?euwuI8L79zN2Ds5t503SFndzDlCDrUKNwJc6D0bx/XukidyZxxw62LBTITacS6TD6?= =?utf-8?q?2Ld40pWgLT9U9w/1k+awErwIF7eIUMQwFvh108Wg0K/WX6beziJoFe++tCqPqhv6w?= =?utf-8?q?+/CSybP+4VSeFV/zpUDlixrj5RYinVQXz21R6UvLCxUCumuEdJY/zUFED44d+tK1z?= =?utf-8?q?cF2I+IhW9bu0mb0PJEVRR0QllO1nB643Dal+1/Go1PnoMDRHm+gL5w1vnBpQDV18+?= =?utf-8?q?wzeVJFfN0VedKfae6C5p+ZHvW+VzeEfVV2WtpJQ+xbWO/wVEAh7U/6y4z3Y8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InLP?= =?utf-8?q?NnIDuBwu382N6YDqDArWFIN8VxVbqIczovBlxl8g753ZR03fDQ/iSWaVq4MLt1Rw+?= =?utf-8?q?e1bJvsz+PbeHi1HioCEGcaGuaVtlkPROrny9KoHjYHYrIr4fXsE+rjLWW9WyQhgD2?= =?utf-8?q?K/yWa1KZir9nu5oSOLIX1wqI6DImdODqhH7xFWINojkHA4aErC5+it9uzirXC+94w?= =?utf-8?q?Uc2fCscQsRH4TtsCVJPuv7JHC907Wd3aok14TKZD9f6UkprJQsJAF3+hjtGjs+CMb?= =?utf-8?q?YzShTYzZHuCd?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ef1ffbe-4d91-4a31-5adc-08dcf78399b4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 19:06:17.2531 (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: +H2/7q3a05XVFq77nLUer3jVCQhN6+brmNfuZ1W9SBtiE2eRVbjuA+OH/D7TgPfOyR5R5TGfscue3S7eF5A+rA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7946 parent_bus_addr in struct of_range can indicate address information just ahead of PCIe controller. Most system's bus fabric use 1:1 map between input and output address. but some hardware like i.MX8QXP doesn't use 1:1 map. See below diagram: ┌─────────┐ ┌────────────┐ ┌─────┐ │ │ IA: 0x8ff8_0000 │ │ │ CPU ├───►│ ┌────►├─────────────────┐ │ PCI │ └─────┘ │ │ │ IA: 0x8ff0_0000 │ │ │ CPU Addr │ │ ┌─►├─────────────┐ │ │ Controller │ 0x7ff8_0000─┼───┘ │ │ │ │ │ │ │ │ │ │ │ │ │ PCI Addr 0x7ff0_0000─┼──────┘ │ │ └──► IOSpace ─┼────────────► │ │ │ │ │ 0 0x7000_0000─┼────────►├─────────┐ │ │ │ └─────────┘ │ └──────► CfgSpace ─┼────────────► BUS Fabric │ │ │ 0 │ │ │ └──────────► MemSpace ─┼────────────► IA: 0x8000_0000 │ │ 0x8000_0000 └────────────┘ bus@5f000000 { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges = <0x80000000 0x0 0x70000000 0x10000000>; pcie@5f010000 { compatible = "fsl,imx8q-pcie"; reg = <0x5f010000 0x10000>, <0x8ff00000 0x80000>; reg-names = "dbi", "config"; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; bus-range = <0x00 0xff>; ranges = <0x81000000 0 0x00000000 0x8ff80000 0 0x00010000>, <0x82000000 0 0x80000000 0x80000000 0 0x0ff00000>; ... }; }; Term internal address (IA) here means the address just before PCIe controller. After ATU use this IA instead CPU address, cpu_addr_fixup() can be removed. Signed-off-by: Frank Li --- Chagne from v5 to v6 -add comments for of_property_read_reg(). Change from v4 to v5 - remove confused 0x5f00_0000 range in sample dts. - reorder address at above diagram. Change from v3 to v4 - none Change from v2 to v3 - %s/cpu_untranslate_addr/parent_bus_addr/g - update diagram. - improve commit message. Change from v1 to v2 - update because patch1 change get untranslate address method. - add using_dtbus_info in case break back compatibility for exited platform. --- drivers/pci/controller/dwc/pcie-designware-host.c | 49 +++++++++++++++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 8 ++++ 2 files changed, 57 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 3e41865c72904..a4f2578700eb3 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -418,6 +418,34 @@ static void dw_pcie_host_request_msg_tlp_res(struct dw_pcie_rp *pp) } } +static int dw_pcie_get_untranslate_addr(struct dw_pcie *pci, resource_size_t pci_addr, + resource_size_t *i_addr) +{ + struct device *dev = pci->dev; + struct device_node *np = dev->of_node; + struct of_range_parser parser; + struct of_range range; + int ret; + + if (!pci->using_dtbus_info) { + *i_addr = pci_addr; + return 0; + } + + ret = of_range_parser_init(&parser, np); + if (ret) + return ret; + + for_each_of_pci_range(&parser, &range) { + if (pci_addr == range.bus_addr) { + *i_addr = range.parent_bus_addr; + break; + } + } + + return 0; +} + int dw_pcie_host_init(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); @@ -427,6 +455,7 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) struct resource_entry *win; struct pci_host_bridge *bridge; struct resource *res; + int index; int ret; raw_spin_lock_init(&pp->lock); @@ -440,6 +469,20 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) pp->cfg0_size = resource_size(res); pp->cfg0_base = res->start; + if (pci->using_dtbus_info) { + index = of_property_match_string(np, "reg-names", "config"); + if (index < 0) + return -EINVAL; + /* + * Retrieve the parent bus address of PCI config space. + * If the parent bus ranges in the device tree provide + * the correct address conversion information, set + * 'using_dtbus_info' to true, The 'cpu_addr_fixup()' + * can be eliminated. + */ + of_property_read_reg(np, index, &pp->cfg0_base, NULL); + } + pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, res); if (IS_ERR(pp->va_cfg0_base)) return PTR_ERR(pp->va_cfg0_base); @@ -462,6 +505,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) pp->io_base = pci_pio_to_address(win->res->start); } + if (dw_pcie_get_untranslate_addr(pci, pp->io_bus_addr, &pp->io_base)) + return -ENODEV; + /* Set default bus ops */ bridge->ops = &dw_pcie_ops; bridge->child_ops = &dw_child_pcie_ops; @@ -733,6 +779,9 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) atu.cpu_addr = entry->res->start; atu.pci_addr = entry->res->start - entry->offset; + if (dw_pcie_get_untranslate_addr(pci, atu.pci_addr, &atu.cpu_addr)) + return -EINVAL; + /* Adjust iATU size if MSG TLP region was allocated before */ if (pp->msg_res && pp->msg_res->parent == entry->res) atu.size = resource_size(entry->res) - diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 347ab74ac35aa..f8067393ad35a 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -463,6 +463,14 @@ struct dw_pcie { struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS]; struct gpio_desc *pe_rst; bool suspended; + /* + * Use device tree 'ranges' property of bus node instead using + * cpu_addr_fixup(). Some old platform dts 'ranges' in bus node may not + * reflect real hardware's behavior. In case break these platform back + * compatibility, add below flags. Set it true if dts already correct + * indicate bus fabric address convert. + */ + bool using_dtbus_info; }; #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp) From patchwork Mon Oct 28 19:05:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13853897 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2079.outbound.protection.outlook.com [40.107.104.79]) (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 483D41E0B78; Mon, 28 Oct 2024 19:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142386; cv=fail; b=o1yx4EQK8vOOAMxq0p4/zxoTd5crypSjeLI80SYnC2oz4qY6oCTOylTJveSCpG9QGWMJ6u8AQcEn4Ltrxkc217W1K02C64MQqpyLMLGTKpqH6c3yarg7vlyur/dZhIsjPw21x1+a96enOCYhBwBUdBi/F6/tKumDMvuWZlpB2Wo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142386; c=relaxed/simple; bh=wjq39b1bSlaqsK6CqdYI9THTeDF6beeukudaMwC5+eM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=kIIe4XJ07fnWHxpJovbU0Goev3VtXJHRAUA69YokT8U4vXAIPjlgybdq2ejFOj2g/h9s+SsfW1mSyGUJkB/38xUoyoN/B4KIgF37kBWNiysgJ9KMbDH0qsOyVTrl0Tku46mV4m/3VDkwinltZK0wYcnGs1Rj8/caruap5ocm/pw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Behj/9mt; arc=fail smtp.client-ip=40.107.104.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Behj/9mt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YnFsSnT8dtkr9cPeii5vvS6munI7Pi0twrD7z4imwDDM5FPj7WeIdwPlqrFgdI9KPr+5KAVgW0s1cRkv//y02go/g4T0QeAX6xaRnCIY9nhrRNsqmFJxew1tDtzc/FymqPtDMqFrKZdPD+lfK+wlhNisEmoQoeIJI//t9G1OgQcN5ofRIj6jhT8Jte8XU+8g9CW+R8J6544YN1guYIATnBEGfSSqoaexq84GGFuyKCZkxR4Df2dYIjFId1YiCId2VXCnv+hMldNpyqWZmTsxjam2cTp1BWWwwEe7zsdqEVG0Np34bkSgqzLEGp5hclBOK7jYqjMTaQq3aJSRk3OniA== 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=5ilQ06dZ+gRqsAnBOtuudd2FBhIfbsL8re509y5kH6U=; b=utDSc75tLU/nUHT1jvwjwOQ0puDGO1spxw1/+HgCS0YG42CKIiqZ+P2bBVjPBYH0Ma3fxV6upw/hbW7VFwTZZEWVqzCdGxlscYA1ehHXwqMTQnO1VizK0ZnSqTqv+dn2QIByIPC6nXwrBwdrVXgJ0yly3v3A86FfOAGQw3hUHgnmN2pW1FtP3KCKfC9BdggtgHtBEwSOrNQDeRCAhFpESABO4kOAVQ+E0ANs2S10JODjCI1jEVVOy5T58K7giAatEYbf+03/vyFvsIH2Z8rQ5riGHBQ0aRsti+DNztRzz/kEq+ObBZGo7smflBd8lXA1tGIDDdBlaBARVMUPPzzNQw== 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=5ilQ06dZ+gRqsAnBOtuudd2FBhIfbsL8re509y5kH6U=; b=Behj/9mtJ59S3b8sm4ogk3Zqk18D2EXHG1m25RLSVX7etMM64u9v1LLpIlximVYAKI+YulPMU3bsR9IvTV8JJ9NrbWwSrH4dMSKEIoKmuKfGnRXIGJUZ/9nf89xbp/o0xxEgl3/9wInW8snwYFUePiYUWRw+DTyyh1uZAfnbW1ukkjYSdYkOacy82geJd/paCKkXghxJvQ7WiV7dYtuKjv9VWlg7xSQcCVVAPdWPrfZmjcnCRaEYpZHX4KEKvxHB/bPoWbS5+nPpwdn4Cjtldni236Ow9VdBcgDznYxw4iLLHfXFKzAldGutRLZNHun5ILpil/9wnYcP/jY1GN6ZHg== 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 DBBPR04MB7946.eurprd04.prod.outlook.com (2603:10a6:10:1ec::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 19:06:21 +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.8093.021; Mon, 28 Oct 2024 19:06:21 +0000 From: Frank Li Date: Mon, 28 Oct 2024 15:05:57 -0400 Subject: [PATCH v6 3/7] PCI: dwc: ep: Add bus_addr_base for outbound window Message-Id: <20241028-pci_fixup_addr-v6-3-ebebcd8fd4ff@nxp.com> References: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> In-Reply-To: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730142363; l=5630; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=wjq39b1bSlaqsK6CqdYI9THTeDF6beeukudaMwC5+eM=; b=OkTwnRGEyTpEsvbOP8JxrxmK7S1zO2r8ZqzQDDCSgQTstxt0IDtyadD3Suu3yRVF7yfa7/KT5 lp1tb+eBOuqCLfKtJaGjwCcceNyXd0Rh0P3jBTkUfn64VE6+oYN+1el X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0005.namprd03.prod.outlook.com (2603:10b6:a02:a8::18) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: b641c80d-0b8d-455e-f3d5-08dcf7839c65 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Dj1Wctz0vv7Gio6yE/+f+IXssZoKkaA?= =?utf-8?q?UwC2CWtdhE4DfOpo/R2BeTkV8zpeNTEfeGsEEgafULSnvXbTleptVuWMwUKPYctmX?= =?utf-8?q?aH9vMtluwwsiEyZUOwamXPXjkvSsChUjKP/lsHMcns7kUYP+wpsaQ9RVNeT+8cUO+?= =?utf-8?q?gXQhNgFP49uno45YKTuxpwMI1VqCchB+035mBamT0jQcUx4wgZ4x921pe8w41lZmP?= =?utf-8?q?Ev2Unw3cKKvQmgL5e31iLZ76c6q3cxryU63M6T6YzG70h4VRk3iVUUD8uIRV29HM2?= =?utf-8?q?nX9kfHSoI2RWdViwL46aaFy/cIjvg84PtrUZF+EjsfZGxUkRg0n3Q64jrz0FD4aYT?= =?utf-8?q?ZMhtziHrVHgiNOYkb1fexbwU4D5iwhEfVgrdbzYOcMrnjttNOKY8idlkybYfXXVT8?= =?utf-8?q?EpZnltmm9/xPM2RGYLTjUUohK/R/MwElVYiETw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ryWoc+gh678qTr03demvZ1EZiZbXTx?= =?utf-8?q?LaVUXbf0iF4Nz0L8089gB0UqDwSZT5KgTQ=3D=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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kGfhJuqtLR7oG7mvuT6aLPhjfHHF?= =?utf-8?q?fvKiFkijvlHCoqMTpEc1xwDxKfexj+e6GcazEFg5EfQZY736eDm9E1YW0qm4UGwtB?= =?utf-8?q?psM17QlR9RM+orJkVLoRMky+vlbrM4wy6uYMtVmQddaijpbK24/Ui9We2eAG/iSYy?= =?utf-8?q?/C9zq0kME/LR5eI6ARB0UQ3XLakmME1QR13cHMgOQlnuOdyb/v6JXaE9yeZTLV+rD?= =?utf-8?q?Hr6flijFcik1oelOld1ZHA14tpbrcJjln3d5zjDje6b2diboCcGws9xKR/c97WawH?= =?utf-8?q?dB0XKwYwAo577sRzITForGRKjQyA5btPVBGQB0EIFQqQKOqpy1RV7H2o8nDYPc8ec?= =?utf-8?q?EiNhLg/kOmmqRUvJnNzW2jbpyd7rvcnOdeqa2OfakgGpf26up/lY9kStSYoMN5rRB?= =?utf-8?q?dvH6NHkt403Iw0+ruaxqSraa4iV7TsVzN0GTX6G2gSzV759MiCiMKuwQgp9tDiEVW?= =?utf-8?q?U9U/FUokBRFbgLNFlrd+NMx+cn2hREwurg5gS1OCiLN+RrM3UDYPBMGG7qljpZ7QI?= =?utf-8?q?/nWzmFUpS5FNxupQ1Bl0IGpHbUe2K/ZtbIt+0mBEq/V9wMSi5H+XQ/bxcaqgBtO7Y?= =?utf-8?q?ISQW2HHLdYdpI9zNDa1sp1zvlLX/lfb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B1pSh7whwDp2j5vR8zC8FX6?= =?utf-8?q?Lgiw2LaRCJRV?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b641c80d-0b8d-455e-f3d5-08dcf7839c65 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 19:06:21.7565 (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: QPD8tend6DRo+XH1G3qGxRN7VGdu142qLEuVFTF2tFuo8xViqjpRlqSjW+plZyQqSAiDgvhGL3oRFWk/hFlPiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7946 Endpoint ┌───────────────────────────────────────────────┐ │ pcie-ep@5f010000 │ │ ┌────────────────┐│ │ │ Endpoint ││ │ │ PCIe ││ │ │ Controller ││ │ bus@5f000000 │ ││ │ ┌──────────┐ │ ││ │ │ │ Outbound Transfer ││ │┌─────┐ │ Bus ┼─────►│ ATU ──────────┬┬─────► ││ │ │ Fabric │Bus │ ││PCI Addr ││ CPU ├───►│ │Addr │ ││0xA000_0000 ││ │CPU │ │0x8000_0000 ││ │└─────┘Addr└──────────┘ │ ││ │ 0x7000_0000 └────────────────┘│ └───────────────────────────────────────────────┘ Add 'bus_addr_base' to configure the outbound window address for CPU write. The bus fabric generally passes the same address to the PCIe EP controller, but some bus fabrics convert the address before sending it to the PCIe EP controller. Above diagram, CPU write data to outbound windows address 0x7000_0000, Bus fabric convert it to 0x8000_0000. ATU should use bus address 0x8000_0000 as input address and convert to PCI address 0xA000_0000. Previously, 'cpu_addr_fixup()' was used to handle address conversion. Now, the device tree provides this information, preferring a common method. bus@5f000000 { compatible = "simple-bus"; ranges = <0x80000000 0x0 0x70000000 0x10000000>; pcie-ep@5f010000 { reg = <0x80000000 0x10000000>; reg-names ="addr_space"; ... }; ... }; 'ranges' in bus@5f000000 descript how address convert from CPU address to bus address. Use `of_property_read_reg()` to obtain the bus address and set it to the ATU correctly, eliminating the need for vendor-specific cpu_addr_fixup(). Add 'using_dtbus_info' to indicate device tree reflect correctly bus address translation in case break compatibility. Signed-off-by: Frank Li --- Change from v5 to v6 - update diagram - Add comments for of_property_read_reg() - Remove unrelated 0x5f00_0000 in commit message Change from v3 to v4 - change bus_addr_base to u64 to fix 32bit build error | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202410230328.BTHareG1-lkp@intel.com/ Change from v2 to v3 - Add using_dtbus_info to control if use device tree bus ranges information. --- drivers/pci/controller/dwc/pcie-designware-ep.c | 21 ++++++++++++++++++++- drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 43ba5c6738df1..a5b40c32aadf5 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "pcie-designware.h" @@ -294,7 +295,7 @@ static int dw_pcie_ep_map_addr(struct pci_epc *epc, u8 func_no, u8 vfunc_no, atu.func_no = func_no; atu.type = PCIE_ATU_TYPE_MEM; - atu.cpu_addr = addr; + atu.cpu_addr = addr - ep->phys_base + ep->bus_addr_base; atu.pci_addr = pci_addr; atu.size = size; ret = dw_pcie_ep_outbound_atu(ep, &atu); @@ -861,6 +862,7 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) struct device *dev = pci->dev; struct platform_device *pdev = to_platform_device(dev); struct device_node *np = dev->of_node; + int index; INIT_LIST_HEAD(&ep->func_list); @@ -873,6 +875,23 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) return -EINVAL; ep->phys_base = res->start; + ep->bus_addr_base = ep->phys_base; + + if (pci->using_dtbus_info) { + index = of_property_match_string(np, "reg-names", "addr_space"); + if (index < 0) + return -EINVAL; + + /* + * Retrieve the local bus address information, which is sent to + * the PCIe Endpoint (EP) controller. If the parent bus + * 'ranges' in the device tree provide the correct address + * conversion information, set 'using_dtbus_info' to true. This + * allows 'cpu_addr_fixup()' to be eliminated. + */ + of_property_read_reg(np, index, &ep->bus_addr_base, NULL); + } + ep->addr_size = resource_size(res); if (ep->ops->pre_init) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index f8067393ad35a..f10b533b04f77 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -410,6 +410,7 @@ struct dw_pcie_ep { struct list_head func_list; const struct dw_pcie_ep_ops *ops; phys_addr_t phys_base; + u64 bus_addr_base; size_t addr_size; size_t page_size; u8 bar_to_atu[PCI_STD_NUM_BARS]; From patchwork Mon Oct 28 19:05:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13853898 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2066.outbound.protection.outlook.com [40.107.20.66]) (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 BF44E1E0DBE; Mon, 28 Oct 2024 19:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142391; cv=fail; b=ajpNreGv2LKOGm9DSstRPE74uKA4IYESsNA+X8clrumE+yiA0blA5m3YOvJFYW63aXbC6YRhqDnmQb72QSN0qEhMZzmX5F8yHbIriF956+7wUnqmh+5ABBpoqoAw01mBxN4o7lXBAbNu4acKouOgzyN3cE5KtUvbCijo4p1Nah8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142391; c=relaxed/simple; bh=Z1ygha9+xD7FlYOYS9zQvq9PhEUCSi65GmFlWznej58=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=RDnXiDhdYDsJUBl4mBG++wH6JOvYYeRnq9Ml2XFEl+5dNaINNRC1NTGHYfDG6ZYPHFoTa22FmmzNOuG3LpYFSDqX3kop+7/J+e6rxtvsWDcNgEZJQuNa/Cc73u3j7idzZZ3Li+KHKb1MAh9xcQ+MK8X64CK9CqzrPRDLDScJqkY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=HUxrZEDO; arc=fail smtp.client-ip=40.107.20.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="HUxrZEDO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=av9e+Kc2JrWaLyEWhPZYlXWiqCa6euMp5DW0RrxwtoxYDIzGF4pooHtlvgV4E8h/Bld2rDdQAOY0pcj58U6FJx8LisFkSxViziaQnkgqHP97YX8n3X5Y1z9MvDe/jFfiC9/RYx3IZqvBx7rAC3gJ45rC5wVaYFSY0vHK42+A+a9IY9o8hJShIC+qihaCAziLkkWrmBwhIrzwbaWOXcthaWQ6tclspvvaLXl2FnW1P/QjcADE1YaqlSvoARlxChH4yWMJ3bsF0K7//sOd8eog/FqRi8jY8H+840fnYz6pJYsXa90lcj1wJRZjDpWKmI1AbOG5L1kd+/tyC18iByXE0w== 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=JQeePKxiG6VD8uGDrodNnYj3a8VmNmBfPCLUrcwxvY0=; b=TlGh6s1La7ck1FxUs+0t9xuG7eQweL3/JTD75lHfhl1nzHVQeqYUT+dZuGKHHOhg8tKQ8EXghKlDEIMFlTsoG/e+TkWljTpD5LZIcKfSwanSEeJUG+pTG4/6a/RnoMVacEMg0o32dvmwmQxX8eN35r5UWR6A1nPdsl1t+nJnoGj+o4BDFVSKjr2LAgNWgntYQxa1Kl6+7MF9IH31gZiIIFr+ens+2RQIsLxZRqKc+oLezOcxOYVrSKrVQLLdmBKxvfmoq+BXzlkLDLni55i/h3sjOPmc3mkcE0qf3X1Cjexl6tgD0Jp9Ehp72nC/wlohX2yKpXeCkxlJ3x/Al8B7XA== 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=JQeePKxiG6VD8uGDrodNnYj3a8VmNmBfPCLUrcwxvY0=; b=HUxrZEDOhFypuVm7mu2ROiFs6IU2Xlsyt6imA9EMl3RXgR9r0vYWm0Ld03zEcLhkqlxACn2gNTgGb+VsT4cTiK+nmDcIl+JQwr0a1PCQ9WPkjVo47C50F8hEHq+rMslGVTaOim+xyswYDW7dbemp7mmzNoxHi+1NsiZ5mvnC3lUCFbOAvL/k/eLH7NUX19/ENEgK+MzKEnP2ipZALr1BiCCRv4ZRO0eVCzWSXDbcWYMWecLs2tnXfvqEZmfi4p24WnjFVO5Yhkg165SygSg80Y2uFrX0fCVshk/1W0DQhP1Zcj4UquIoYR80PbT9sjCP1HR33dJECMREeXJKv32RoA== 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 DBBPR04MB7946.eurprd04.prod.outlook.com (2603:10a6:10:1ec::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 19:06:26 +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.8093.021; Mon, 28 Oct 2024 19:06:26 +0000 From: Frank Li Date: Mon, 28 Oct 2024 15:05:58 -0400 Subject: [PATCH v6 4/7] PCI: imx6: Remove cpu_addr_fixup() Message-Id: <20241028-pci_fixup_addr-v6-4-ebebcd8fd4ff@nxp.com> References: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> In-Reply-To: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730142363; l=2455; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Z1ygha9+xD7FlYOYS9zQvq9PhEUCSi65GmFlWznej58=; b=3yp3+KMBu8iS9BIFCUUKquHWkCCIC92YBwOFNA3a2qFhTRSk6+IqYryloMK6W1SDbP64xj0I7 6YW3oTyxAU8D7qNmJaahKNlaWRnHHnM6Za1QPBZDnv+KmuNK70AJjCb X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0005.namprd03.prod.outlook.com (2603:10b6:a02:a8::18) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d445dac-04b0-4180-36e5-08dcf7839f15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?xgvSVIBWwie6by+PsmWeaNQ0FclRWz4?= =?utf-8?q?/MFKIktgp2PxbB9gaoaWMsNg9NNpzxWF7ZBvFgV+GrjWciaqzJhjpd207vnj63W5X?= =?utf-8?q?f9gcFsSoRwtQLnu05mMIAInkbzlxDXBP9n+8dRYFSRz+a6h76AQdrT5Nt9+knNMec?= =?utf-8?q?9EHcoMKVSyY9ClANJExrEzSrRiOErojk9HT1zchioTS6BBa7JhHuntvfwuMgkz75h?= =?utf-8?q?dABYHdqRCoNuj9Sv6JZZL0TUT6KXzhXjnDcCUPy8RqgrXU1cbHrZbfLdda0Sq55J2?= =?utf-8?q?q2fAhG0xglPB3hLH2Ia+DJNtOWJqf9tVvkfAiXqwcYaAu+1J8F10wrziiXv/V88+F?= =?utf-8?q?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m7g7qt2R+sC1034eo6wfxNLzqMvHiUlnv8Qg5vS53HHr+zJKo7ZdVPGdyN?= =?utf-8?q?2Kpbw1pXnS1lEep4GyaNuZbLiEsjrLMHLMJCniG6Q5CGxOJpBhF1uHVfVuN4L4ZwD?= =?utf-8?q?lgwS4mBUqdgt?= 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?qLnOlseo1Bhs/ZiCFkVQjP2IQ4t7?= =?utf-8?q?RX4/cZiUO+d8zE3zJz5cm2fgsKV/966jx1NsKbcGuO8JHfEehdHIi8JcvXj6hpnKP?= =?utf-8?q?UiPDc4IwVX+vd6dHhRtI63GI/aM+HS7uF+WX+5B790WWySnrGd5YeADxbYdexPjU6?= =?utf-8?q?1XnKDhGw4KlvXTO/C7h/uW132bKiSyH3u3L68mChdYkUtS+uRh09w/tG4LhThvAud?= =?utf-8?q?9NUL8n6N2d8w4Mo2COVms8kAOS2WlWB1hQZbsBRzVnQFK1Cpv/z03qTqBc8MjQNFd?= =?utf-8?q?lMLG4IzW39XxWMwFUV5076syeAr9OlLD3gNHIoAMhbtc6dkrnVK9PosB3px8NnPoq?= =?utf-8?q?6M8tuorfXqhC8y+A0flzDnmqNsuieiUSjqSvGU56eOAa3JDkyCK2Xz1igCob9CTrV?= =?utf-8?q?N/ZB0CHJ62CDSc0zwL1uWNOo5WuLlnBkspAxVncmYKCL0xmeK60Dsbh/AHrCxqTNw?= =?utf-8?q?ycDwreVKiAhAsFN69P3rUYWAzR6nQsFaE1v1lXSh33uNTxdamqrsCCjKo9La71alu?= =?utf-8?q?dXl7vKFnlQW2hwsSTFrjuk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ejfMB1zg5bvtwtYbLgYcVbDSBqdubWR9aofJE3DOQtj?= =?utf-8?q?LFcYHTp7HdgFbFTfAAsjq38v+Cfku+q3Ok3WuTwAaC/y4L4etvjmr1B77KOSnBfri?= =?utf-8?q?zgpd8+3BCG88?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d445dac-04b0-4180-36e5-08dcf7839f15 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 19:06:26.2626 (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: PFUPx1u1bdEFlK3NSpIk4+6fAbdpxzV+nlXtPgXt9FKbCi6bh8YPT5EVnI2OZgMWcDqe6HUMZO9EXfcUSZ9xSg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7946 Remove cpu_addr_fixup() because dwc common driver already handle address translate. Signed-off-by: Frank Li --- Change from v2 to v6 - none Change from v1 to v2 - set using_dtbus_info true --- drivers/pci/controller/dwc/pci-imx6.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 808d1f1054173..533905b3942a1 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -81,7 +81,6 @@ enum imx_pcie_variants { #define IMX_PCIE_FLAG_HAS_PHY_RESET BIT(5) #define IMX_PCIE_FLAG_HAS_SERDES BIT(6) #define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7) -#define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(8) #define imx_check_flag(pci, val) (pci->drvdata->flags & val) @@ -1012,22 +1011,6 @@ static void imx_pcie_host_exit(struct dw_pcie_rp *pp) regulator_disable(imx_pcie->vpcie); } -static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr) -{ - struct imx_pcie *imx_pcie = to_imx_pcie(pcie); - struct dw_pcie_rp *pp = &pcie->pp; - struct resource_entry *entry; - - if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_CPU_ADDR_FIXUP)) - return cpu_addr; - - entry = resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM); - if (!entry) - return cpu_addr; - - return cpu_addr - entry->offset; -} - static const struct dw_pcie_host_ops imx_pcie_host_ops = { .init = imx_pcie_host_init, .deinit = imx_pcie_host_exit, @@ -1036,7 +1019,6 @@ static const struct dw_pcie_host_ops imx_pcie_host_ops = { static const struct dw_pcie_ops dw_pcie_ops = { .start_link = imx_pcie_start_link, .stop_link = imx_pcie_stop_link, - .cpu_addr_fixup = imx_pcie_cpu_addr_fixup, }; static void imx_pcie_ep_init(struct dw_pcie_ep *ep) @@ -1446,6 +1428,7 @@ static int imx_pcie_probe(struct platform_device *pdev) if (ret) return ret; + pci->using_dtbus_info = true; if (imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE) { ret = imx_add_pcie_ep(imx_pcie, pdev); if (ret < 0) @@ -1585,8 +1568,7 @@ static const struct imx_pcie_drvdata drvdata[] = { }, [IMX8Q] = { .variant = IMX8Q, - .flags = IMX_PCIE_FLAG_HAS_PHYDRV | - IMX_PCIE_FLAG_CPU_ADDR_FIXUP, + .flags = IMX_PCIE_FLAG_HAS_PHYDRV, .clk_names = imx8q_clks, .clks_cnt = ARRAY_SIZE(imx8q_clks), }, From patchwork Mon Oct 28 19:05:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13853899 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2050.outbound.protection.outlook.com [40.107.105.50]) (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 866541E0E13; Mon, 28 Oct 2024 19:06:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142396; cv=fail; b=Ul8qLmAfrFJ+HLh06WlhveOBXU2zdftmNl0Rh5AWpI/9xHREiJj1wHhD0JvQzeYzVYAbTGp35e8atjvIeRWjTJ2/9aEJzrjCFG1I2zmvNRlCdW6A6LaRd+fMHFq1Ica33xRrQzSbJ7MVQbZos5I0h9D86zPFZLiBhwDelhfh3tE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142396; c=relaxed/simple; bh=RzDiJjc+I6wcWk13KTVhystqp6RElq6XYrrJPcrtUXI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Bal1JvJjlezuqv1029/GiB0PU29j9XyHOHTXq7z4PpjVKgU6qaBADS3rYaKMqRS+fjxTaPsh5wO59bGep3nH/YWRqj3h6Ty1SQb1/ldQy+i7HraB209hA6hZJjtRw2zqq3ZXiB+hm/tWclMg3If9pQHbVvHM9geDnkASDQauQlU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=N44izmjO; arc=fail smtp.client-ip=40.107.105.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="N44izmjO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sSV+ijxIhHNlbKkF4M6O4HgbJnOQNTIpVEn5Ir2S5Lgj0CrlWC8agsZ/31TGylcjMD4MdMBP9wo4qrFVgTBgLlU/SJto08/DQWj5FmID3XBi+uRnQMsnGvkWL+YhwBEn3VZzG9fNUmoVftHREgt/Exvyp8AAshe80m3DvKUOmSDZZtHzE3vZAy6AasbrSldFeRrlyjPEuYi/XKyzXM3W8s6RrpsWsM/VqDq0bpbpFC6BRHYETYAe4Nw+lI3bsSX1BCkEKp7YTg7vSZ4hhmQeduxqSJmymp3tOqhtmNI2rt8kTW2HURXjSXloqfwE5HORehJnFpmczyAS7mErO0orBw== 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=/fLhtILW+VZvuJWqnGcQ5qJ8MgmTM/8+pr67M3KgLGg=; b=ENpnqWiLJBBLV+VCKlM30qePXQpCzPBVLwk2VvO8T/TI0U7JOIJHFwbUXF2cN//oakm/UzLO2CAlJ56UulQeH+W6VAyaqslOKH+AEHhUALXDVyxHeFNhy8lnksZ12x72V1KxmKLnl8FuVgJW48wdjMytMcVyqo8c7P7/J65z9AS3oaRZhvbWArkMyb77z2iNw+/i8gmOZbQKsduWqCQIYaHODBFrC7zzdFXbttDdisz4J//v+JbTmOALdCrcFZr2CxVIDwfU0I23hi/UMpk4v2giki9Gn9XCuuGeZPlNybrES9PrKtent7we61jR4G5615VRjvEkZDyWjxIAT3ZzSQ== 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=/fLhtILW+VZvuJWqnGcQ5qJ8MgmTM/8+pr67M3KgLGg=; b=N44izmjOI78GLcEWrcxyAngSHk8NPOM8ScBeG6C6KQdKDCNVhhGb+rZSaJJTRsdUmDnAn+QaxShl5uPzm/x6oc4Q5UhjGq/t68pvctNxMfTuMdPazGJAWfeBCAw/tfuAyVKufOsLGWenMQw02OKfTEk1tfF5u9xxvtofOo0oSnJ68WQaurJxSJQu24EloGVhooLspRXtLo/i6/DGLRExJXPS1cfRcMPvjbUJ83cizpkGO8z+/ZlDB2NeBKWchKXDWjjIU9GVMgIUbPnuOi5hWfTvmrf3rp4kyzkCog1Q+H2V3fxAX+CaKHaxQ0y1lkYlHuyiOQIX0jqVOTL1MFRcDw== 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 DBBPR04MB7946.eurprd04.prod.outlook.com (2603:10a6:10:1ec::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 19:06:31 +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.8093.021; Mon, 28 Oct 2024 19:06:31 +0000 From: Frank Li Date: Mon, 28 Oct 2024 15:05:59 -0400 Subject: [PATCH v6 5/7] dt-bindings: PCI: fsl,imx6q-pcie-ep: Add compatible string fsl,imx8q-pcie-ep Message-Id: <20241028-pci_fixup_addr-v6-5-ebebcd8fd4ff@nxp.com> References: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> In-Reply-To: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li , Conor Dooley X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730142363; l=2245; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=RzDiJjc+I6wcWk13KTVhystqp6RElq6XYrrJPcrtUXI=; b=4pLCC0gu4iUv8H3jhxnhRvuIaw/u0nXT1sQLIFaamEuBI4cI2BBNKfVSbOkgwvowA/asZbAt6 PlbQkvTs0tnDhy+C0RON5/FEnA+7pRc0hrxhondKCLzaAboBcbUHIO4 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0005.namprd03.prod.outlook.com (2603:10b6:a02:a8::18) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: e22b3740-aac1-45f4-f963-08dcf783a1e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?6+x8v9Q1vvGWQyvwWIXe7jpcj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TlsCw8t?= =?utf-8?q?/7lsXmrV3AsSkvcRn48t2aXdvL+I7w7RU2penzG3fc7Afjk6yksqh23ahp+0h0QtT?= =?utf-8?q?OHAgyjQ/A2OCxcxjKAeLEgEN6Gm5iJj6MYLtiv3+hfd3NBSTbbUO6A8ZpKh6QFSew?= =?utf-8?q?s8W1wGrLrbFdh0zZ0n9cOraaiJAZBCsIsQIr4Q7ReHlZS8T7oKnYBZavGtCfpiG5z?= =?utf-8?q?51/+LMpyD3W0oGopvnmok2Bn2mUAuDjftXGdqqpX0jvfs7E4Asj4+8ZDXBMNf2LJC?= =?utf-8?q?DkJKsiDNa/Ok7i3nXg2TbeVK5L9Xsz/3w2TukwbMWymLD73cQUMExPo0VvJ1HC6Hi?= =?utf-8?q?1wFKr4FoZveSvUlhubkSkSmaxVs/NOMcgVLOCpbBzSEYmJu/1FD9IKc+xs03y/gLE?= =?utf-8?q?IA+5Q1L7Qvd5N/xIr/ooam+2sRinFVLmatlRvIFmflFQx47KMwl3AVWmiVZtwVZ8B?= =?utf-8?q?URK2NUJgsNB/?= 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?E8NX2BYmqI0pAYYJg+CKA5R7YM0I?= =?utf-8?q?5Rc/bf/Ns6bDXx663OfzpLF4cay168GUNV388PhCCFoILSfIV7bvTtoTD3q5fA3S/?= =?utf-8?q?VjxOYIeNXVtIJS/5g1cZdP9avZ9Nj5IJRP3cwvIhOMLLbPQ91uHbzVKGKCDEz+Bpb?= =?utf-8?q?aQD/6tOczZysiEDTsVncH21u2tq8Og7ov9QBmum038pqArWheOPez7PQKRcppBAO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= =?utf-8?q?a4DQVkozZGJ4WANhmwKd/CpeMVQv23sGL9Gk4+Mu4wB0FQtkjJcBuPgcvx6KT8ST5?= =?utf-8?q?8l6Xj2kR3BZbZFNVA3A5XgY2nMJ6kJe+FM1l8XxL4cByd0ii0Q7I+bzf9x7p/cEAZ?= =?utf-8?q?hjtWuGJK10O1QmyWXsxJOjFcqa8+Dln4WwVe3QkYjZo0zVA5+KFYUwxkMVcLtYkff?= =?utf-8?q?pRTy3z6SWai6D/moQwPf8VVecLr8oKnV4plz5SWv7Hdn3dEd9EZq/duBHLj5tz38c?= =?utf-8?q?masFIFa3YssHmciwId1weSuaVwmqg81zOHuCvE7wq/bkXgAL1S8UYhdfHQZB0Iads?= =?utf-8?q?vlihG+BA6cl/r2TlbIKtuX5y701Ee7KRYCp3Irb/mh+mYycoFZDuKxTxNJo7SDysl?= =?utf-8?q?QNHnuHDrzIcOf4Ut0Ggl/AflvgI60mbuT0IQt/PYuz0L2ywgVz5d1dqaePksWiQFt?= =?utf-8?q?XP+kvaxN4zpY?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e22b3740-aac1-45f4-f963-08dcf783a1e2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 19:06:30.9591 (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: ecl2W0LQDKHR13T4eIaNja4FRVInU+ehU/8l4+DPFb2nzx8mqLk4VFf6C/QygXAFVWT/Q/SAqTV1LmtkU71QDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7946 Add new compatible string fsl,imx8q-pcie-ep for iMX8Q. reg-names only needs 'dbi' and 'addr_space' because the others are located at default offset. The clock-names align Root Complex (RC)'s naming. Acked-by: Conor Dooley Signed-off-by: Frank Li --- Change from v3 to v6 - none Change from v2 to v3 - Add conor review tag --- .../devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml index 84ca12e8b25be..7bd00faa1f2c3 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml @@ -22,6 +22,7 @@ properties: - fsl,imx8mm-pcie-ep - fsl,imx8mq-pcie-ep - fsl,imx8mp-pcie-ep + - fsl,imx8q-pcie-ep - fsl,imx95-pcie-ep clocks: @@ -74,6 +75,20 @@ allOf: - const: dbi2 - const: atu + - if: + properties: + compatible: + enum: + - fsl,imx8q-pcie-ep + then: + properties: + reg: + maxItems: 2 + reg-names: + items: + - const: dbi + - const: addr_space + - if: properties: compatible: @@ -109,7 +124,14 @@ allOf: - const: pcie_bus - const: pcie_phy - const: pcie_aux - else: + + - if: + properties: + compatible: + enum: + - fsl,imx8mm-pcie-ep + - fsl,imx8mp-pcie-ep + then: properties: clocks: maxItems: 3 @@ -119,6 +141,20 @@ allOf: - const: pcie_bus - const: pcie_aux + - if: + properties: + compatible: + enum: + - fsl,imxq-pcie-ep + then: + properties: + clocks: + maxItems: 3 + clock-names: + items: + - const: dbi + - const: mstr + - const: slv unevaluatedProperties: false From patchwork Mon Oct 28 19:06: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: 13853900 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2064.outbound.protection.outlook.com [40.107.21.64]) (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 635BB1DFE12; Mon, 28 Oct 2024 19:06:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142400; cv=fail; b=cOB55Aq1SqyS0LX4Fudh95Ig/dwb+7HV7+PevEXGjGqYnTMDRRatAn3SjkgRIXTWzMtl9P3vWhfOHumnJYw9bRH2RMO3ocodKlyodb2IF0OZ9qjRvfR1kaB0fZ59d501jsIPc0cWFduDfPaJS0cqjA7r6Ef9tP2NR8HWNBtg/9g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142400; c=relaxed/simple; bh=MHdl1pBB8ltbGON7gH0Psda0JXVx4MU6Xi578sObIvc=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=MWZEjDY0iwsucjueILUQkeGumSRUKUtaheGfToRJOgZ+G21eYGVdeydE4TwnZcAe8gmhqgrRZnSaxutQXBDHukwbpX5nacVe/4LaInS8I8Ace9typHDztheh1waxHbdZexJin8ZR4iJhE1P4KTy8gvhfpW94VdFIY2uZYpTK2BE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=kwSBa+XW; arc=fail smtp.client-ip=40.107.21.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="kwSBa+XW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Rl8rssUPgB7EqAco+rWgN4AONyKlI2GMKHiLYpZ90bOPM5DX+oYY4jgl7tJvUYFHes/JwUJjwymV0Qqm+jxmSJd5BpirOtOYJjMXMSjbdEGOByFpUkX0JzqfQqU3zWLQ2mO44rn3mlV4tAZuKSd/7TL1nZtv1pt5dEVPN430gekYJM/pA92gyvh5kYUsOzYiBza0FeZ+gVbkW/xKg3Y2Dkze5LWz7TOiGUBDC18uUmtYOEoC31LE2pbrjI0jzEqWSH+I/JUrCPiBvuSOS9FI3ORAVljOLLU8MzFn491GFg19yAjuetmL++3ajntIFrG9XaGZp1MK2MMkUzzBsmRl9Q== 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=VMSng6Hkq1ZytcY3Ph/5wRTVWQF53XvR2y3i6XkNIAU=; b=hKFWGXSLsciIIHk9poOQIr90ZoUGJvTnc2LobhrrvIStDgvRmXYNspPkGhFtZjYblTYXSM2B5Pk2Cl231cu7Z1LJkgmna6glmFS0tu5BTgf9wGqEhjDQCSfseTS55F9eKxnMtexiL46kNcvnjrZyc36yPQ4YbZJxhcKhYBMA2XQV8US2x6fTZnZK6gEn90svbW5x5txUrn5TlzfcALo5DRzWAWVn6Kmj9BVrKDBuhC7JJAFVT4GIjUr5c2XawR1HzO/HX2ypuvwuJKQDOVxqETInVBoDr0jrIo4pdFVZ9QMFDVLXM59TlLaK/XBADmUp9lxIqxO2NH6sJWXMFJTvhA== 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=VMSng6Hkq1ZytcY3Ph/5wRTVWQF53XvR2y3i6XkNIAU=; b=kwSBa+XWWEKfv8Ow/I8Pq/QWeUkEWZuB5giKah165ILfxBvigkIIGdJQVbBj3/iQrHi02kcYjDz8t7ITK0pHWzoM/iN3ki10/xu8KgWhpQ4WRj0i4H5VraUAyOH/jjiDFrgHOLxRi9vIYvw4U4R8YYWutOzYB5TL82QP+ZMOejaklVhSGum5BBb7smLRQ5+ONfkvTSPXE3gLU1K1WHAHEPJi5NT4V6S8r7yEdIxO41M5ofm5YfLeHrMkxJHLrVn70qKrFJ5PeU8f06wwGd2wI3whICrVPTNbCh2KHZLC8ODKS6LeqwNtWc53cTTlwI/8tQaTP+QFD5AtBnPRQ5QBoQ== 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 DBBPR04MB7946.eurprd04.prod.outlook.com (2603:10a6:10:1ec::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 19:06: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.8093.021; Mon, 28 Oct 2024 19:06:35 +0000 From: Frank Li Date: Mon, 28 Oct 2024 15:06:00 -0400 Subject: [PATCH v6 6/7] PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() Message-Id: <20241028-pci_fixup_addr-v6-6-ebebcd8fd4ff@nxp.com> References: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> In-Reply-To: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730142363; l=1266; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=MHdl1pBB8ltbGON7gH0Psda0JXVx4MU6Xi578sObIvc=; b=7wUDVK/qc/0ISWrgJoCoXb3D5iiXVsBocxv53p37ZhxLt0LjJqo1X/hN5j1q0wzpE6MNwd8La s2ecKtb1BEPDqaXSP6/atN5z+Rz0exk3hLtpdmJKiRY6peboJCyfSQi X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0005.namprd03.prod.outlook.com (2603:10b6:a02:a8::18) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: 678cf69b-be54-4e49-c5ab-08dcf783a492 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yq41CZCPsJIh7BxKueBsJPgXSFDXS9I?= =?utf-8?q?RuaMGzU7RJktYmjLFRUTuL5qr8HGE32dFuQlfR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eF6BN0xahNZiYY5vI3YU5WWEBho?= =?utf-8?q?eQEbMcSMsj53ECD0fCAMWGM7Qs9Rmu9cN68FQ0CdeFweC4K0mA7J/MkcSXmWw1VBA?= =?utf-8?q?ZqTTPqk7oB8oJYqj8PDFdw8GPdYvZU934bUZCclztcnpehHOYD4aOdKaOsvuFoabl?= =?utf-8?q?8oaYJdDwMCoxIzmnADuNjO1LwcYd+hxS/7RFRQJf93jxG95LEOg+UPtTmcqMf79s+?= =?utf-8?q?Ut5Kw6MgavAEG/Sj0jKVlIs5youSCafJZgFH5BJAaCVfH4JzI39HC8J7IeCbJy2SO?= =?utf-8?q?j7F3TetuehMRvDwPi8vcmkmPZ+89xfaVlqy5zWA9u3k608iTgcrz37ggFcOuoIQcC?= =?utf-8?q?VSJq1BPAXTGOvnx8zdFCcZ97mUy3AAklRKJbM3/exOB/ejCwPhACV5BoztbV1WAPu?= =?utf-8?q?ICSiRfuaDJ8G?= 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?xVHzBeg+XjXrl7dgR/ky+PBRCjK+?= =?utf-8?q?vAO7l0HzfyuFD3KsIVHmhVHtJtURjJYtNp+BCKd1Cb6gtO9SAlN+nmnvEU7K6R5rt?= =?utf-8?q?Vt0Xd1L67InT0m2uHaXlrdp/ey7MbAatpA7Q1MFlCgw0nt4skXL52kvFMPcPn2V5n?= =?utf-8?q?pYbcObEby3zO6de1xVbInTcQsEhoGefMvoAVZIbKsmD4nySpO906Bpx+ekV7Na5sE?= =?utf-8?q?lnOQOHjLCyb9H/TaWhGqyqpnpH5zK2T7gRUMS+LlmhcFMky+5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Qn9L48hf5+/No58OEjGgc?= =?utf-8?q?AaIb1SfED4QGNI9De4lX3F2kSASsZuBz79n3rpuxSsY3RiFxPD2w3ZjRFNFpIn4LD?= =?utf-8?q?CqApBbYjx5O3m6zEaKzfvtbPpHs7weD+fCf62uYodHmA5V+Pj8fQA984tWYZmzB+d?= =?utf-8?q?1lOOawvPxt1YRsldClpGrwNBQdcxhoHiXO6SCgRJX+uLzFvXfg7qXYr3RvahYG2qa?= =?utf-8?q?XY6ga8j9zcPs2fikwRvEAXvNS2WQaxwM7GBegOuB8707iw1QR4J2YyuPx5+b0amUJ?= =?utf-8?q?vEfMxwk0uFjF7VbqiH6/mxUxko7CtbFtOPecyHKXCK/pxFUsgYhLotS9710+DM2J1?= =?utf-8?q?FmbcYkqnCNc4AebyCEH7zBz2Yo2C6de2CsdBrPxLpxq2J7qA8ucN3ldZHoPczDFpX?= =?utf-8?q?kujVBO+C0BJB?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 678cf69b-be54-4e49-c5ab-08dcf783a492 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 19:06:35.4833 (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: ApzZgWhIA5RqpgnstKTIqxBvurNVXszvXzdVw0om4KFMvkA+UApK3RvOGZSjwfT/JZrCFKjwsnWjY/UmBTyKQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7946 Fix hardcoding to Root Complex (RC) mode by adding a drvdata mode check. Pass PHY_MODE_PCIE_EP if the PCI controller operates in Endpoint (EP) mode. Fixes: 8026f2d8e8a9 ("PCI: imx6: Call common PHY API to set mode, speed, and submode") Reviewed-by: Manivannan Sadhasivam Reviewed-by: Richard Zhu Signed-off-by: Frank Li --- Change from v3->v6 - none Change from v2->v3 - Add mani's review tag --- drivers/pci/controller/dwc/pci-imx6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 533905b3942a1..8102a02a00b38 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -960,7 +960,9 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) goto err_clk_disable; } - ret = phy_set_mode_ext(imx_pcie->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC); + ret = phy_set_mode_ext(imx_pcie->phy, PHY_MODE_PCIE, + imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE ? + PHY_MODE_PCIE_EP : PHY_MODE_PCIE_RC); if (ret) { dev_err(dev, "unable to set PCIe PHY mode\n"); goto err_phy_exit; From patchwork Mon Oct 28 19:06:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13853901 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2082.outbound.protection.outlook.com [40.107.104.82]) (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 B903C1E231F; Mon, 28 Oct 2024 19:06:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142405; cv=fail; b=q78AVhFwdx0yWPQoXvKjl4uzpUlKMGDYLnDvsm6+zCysyiWha0TklpknSYXjFyAa7XhMe2A4dAcvuTrXkvp07Ummh5K/EE3BXIjpRPp7EfO+RXGNr2uTG4eDIetp/ezwUxD6VNhkuAjBDbj62vC9spYNpEuuTFoeFZ5PZVE8bSg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142405; c=relaxed/simple; bh=oBTuOyGf1p5J6QSrmR/H90B4rkHNLZfeWqkQs2nR+Ss=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=tfdhIA5cZqUN/6MB7EVZhBF138U17l1S8O+JRekg1h+SMVtMhS+YC1lEZZ+c8DFqYQvfw1n2wRjnD1ScpGYOC0ABUkhWiSxDRKzUdIp6XmFBD/3RHbJUjCPUyBXx0Q9LS/QWYYBk8hAk1BTUe7tKeqpQnVngbByewADjZBWOAZA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=cVjjYAoK; arc=fail smtp.client-ip=40.107.104.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="cVjjYAoK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MN/KylURMhw6Bu2u0iiTSF4F2KH0xrbMV6d+BYBHUnVITbL2N5ZscSa8MYHRFvWfx1jGZMKPxWG74C7GSZSNtc1TYawMwv1HxHSwIXgRTzVyMg3TdWBaPO8Vh7OJwpcGKvxD4DC6YiqogCx3O6xIX2TPeKBoUmTCsB8mC1FCvW9bz+pCxP/59cbZvsIcwKaa6V481KtWWlevKoyQaayL4yZJVXChp0wEeGVYtynrEC1ZC+iyijwvTD5VLgpD6T/zziWkc6ji9WETbD4M/caANL2x5wjHNX0vVR7p5jNNYTsAsA0H/Ap6r2txQJAb4qGfLQB9au6/7SPYGUBMRQKVDw== 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=eIG3DwZHBHBFPNj0et0JCjxq4EvOWJCsaM4GFikwMac=; b=KGalesmhdrs97FKwb1YskqE5YyEbhNPvcM4PShIWVkKCc5KDYd2I2BQsTSmdQZ0Em0R1G+7sGTUrCzLkXy9DZVRAJ1nQgDykDqRtOFmQqQ88W8ljtUx8obb0xAx7qS08PEHrMW7X8b1olJTbqbbwk+gGx1M47uPYet9jkbmr69pEiDBJriwjFPPgW15fWyCfPaAn0UhS04Vq18Y0in5sjMBkjBWgurDfqSg7aFUuHRSPc/JuRSA31u/OdeHvZo0Snw89kW1f1OiNm3RRQGotuMhwqlFaIrVCnH21YbdPLNv904bPXj+cQWaxHEdn2azsbhpUMDpdDLn48q11P3g0dQ== 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=eIG3DwZHBHBFPNj0et0JCjxq4EvOWJCsaM4GFikwMac=; b=cVjjYAoKGv9tyLZOG460zuHGCtEzSnYcqBQpLOXYKCGdmX7b1MJJFOWMEWV1ngyXlllud3Fh6/R433Khn0WKkCKI2IGQ5x6Mqxhz2KwH1/emAJv/8akbt7AkgCK1tbhSYbcapUFybGCrEBOZOHN5ltYuySzo5LoTtY/mRB+BeCZGSxuCrULhrvvCoCkBeatHD/JsfjdCmpkmKNXAPmBAUW44cbK4W1O4p36ueGYU4ikUA5JyDdFIpL3bPa6POvAT652CDP9UX45U5iqTlRmkc86lH2xy+5NHwP4ankoxQ5QpDjJl+JdmnEXgS2QBzLeSKARndXFOiSUlOkvyIR0E1Q== 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 DBBPR04MB7946.eurprd04.prod.outlook.com (2603:10a6:10:1ec::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 19:06:40 +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.8093.021; Mon, 28 Oct 2024 19:06:40 +0000 From: Frank Li Date: Mon, 28 Oct 2024 15:06:01 -0400 Subject: [PATCH v6 7/7] PCI: imx6: Add i.MX8Q PCIe Endpoint (EP) support Message-Id: <20241028-pci_fixup_addr-v6-7-ebebcd8fd4ff@nxp.com> References: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> In-Reply-To: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730142363; l=2548; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=oBTuOyGf1p5J6QSrmR/H90B4rkHNLZfeWqkQs2nR+Ss=; b=k4cpxKXncruZS/S2xE5yJeROU6BdD2P8NV5gQAPw2o9sbickQbk8X+D0+Ae84EXIXvqc1vNFM S7JCn5F1nIZDZAhOy4Sjg7I1qnyHVWxCW0qVQBdGH1avRdG2zevRSPl X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0005.namprd03.prod.outlook.com (2603:10b6:a02:a8::18) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: e334dac4-ccc8-4c37-37cc-08dcf783a780 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?hFYCuDWz6rkbjqYcPkXa/gCnOzYhJBw?= =?utf-8?q?E6yoKuQsMIJk1BM7/SERWZcrR/bopqLHR64qsTBPdxaSYXIexMYoQPUR9XsbrxWGM?= =?utf-8?q?8Q+++4h9s/yOKc1c7gMTJeIAPhhhmGGLBhYoHg/q57cN4//ii/WGABiCkc4mMA38p?= =?utf-8?q?km6r/1QVsiEhE4JKP7z3jN0++rTu9D1y3XcBIrgU0NSkQvXqP3DKRpy9Iz9+9Qr7B?= =?utf-8?q?V6SCmFZRWremELj7rXuyIRl6ihMDOd+HzgETu1A1fqg+dXsLWzdtSeWFDctVudCp4?= =?utf-8?q?5OW0/qDlSEWp6wlBQpNkFWqlCUZiobp5U9SHxpwi/BCETVgl7Ov4ySDutw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yFtzmYNB?= =?utf-8?q?7tl5h8Hrdhz9icUw9BYHZRJLqgME6SACcVx4h+IlQtRBNQHzCRWFKJDd2z7VYbE+6?= =?utf-8?q?YJp+gHwY6JBTN3atFuORVoMt8qoaFDlH4xn+kDRXw0a9S6Lt8FgRZ8ezrd6naJiTa?= =?utf-8?q?OIReBliVnLMw?= 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ECMP0wd2FvKAUt4niYS0qENtPfE+?= =?utf-8?q?OkPmG9pSqStLnzIHekSt5zPVrQ9E+fu68iYxqkMqfycxU57Nnd1jcuida6BYeC9KF?= =?utf-8?q?VIu/Sjngb+0OEg50Hk0Tszafce1WJ6g89gr2e74PkBWljPV2/z+fU4gX+ab4uriPV?= =?utf-8?q?7S5xrfn7YOikQfPwSEft2APnLzAfjnJNfpiwkLScYhEdiBAccIBFwmeJDU9n0nNx1?= =?utf-8?q?eY1onWXbySJEamCutZsW3a4h3cphLjM/G+8k8koD6oYaU7pdyecF1iwQcRu3UAFPb?= =?utf-8?q?s+DcJc07GWcw0Bg2XAPosiHFUPLK6TGIMQzIX8kn61Sn6WVt+OoQFYAbWWFkjuDJy?= =?utf-8?q?eQHqGWQa9pUf+F4nxgs+lIx3uXsImAPJp7tMR39l6+TfFUtnJto4l28TFQhU8GxdR?= =?utf-8?q?uftHaTCvv+c3sfblwtvSqmxGVi1kk8loh+f7vlMKtJEsKukcjD862nODW8aOvdypO?= =?utf-8?q?uSDBBAAfA+tMM3VRv4Xi4AV9EB8Ao8qgUqod6FEw7lpa0FdiFL17wLKFkh+zFZ3lU?= =?utf-8?q?MZ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UghAvD99hr3rwXdqTCFCDOcQPgTtHZ4xSzDLgM2WcXd+yf9cnI+AC?= =?utf-8?q?H598EocTOydLt0RXnL0STmEkXeByM6hBmwpHRWi8HRBc9QF4lHibeq/RXrVC+Vt9P?= =?utf-8?q?rQtpIw7Nrb33?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e334dac4-ccc8-4c37-37cc-08dcf783a780 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 19:06:40.3650 (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: W77i2dcd1YOj2GEBw28Tk2rkQHBJqC6DLfsPi+81pW9cFD2LIEnU/9qYJMEeI0CxUvlX+l3nIEVK/t7WbBfZNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7946 Add support for i.MX8Q series (i.MX8QM, i.MX8QXP, and i.MX8DXL) PCIe Endpoint (EP). On i.MX8Q platforms, the PCI bus addresses differ from the CPU addresses. The DesignWare (DWC) driver already handles this in the common code. Reviewed-by: Richard Zhu Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Chagne from v3 to v6 - none change from v2 to v3 - add Mani's review tag - Add pci->using_dtbus_info = true; --- drivers/pci/controller/dwc/pci-imx6.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 8102a02a00b38..94f3411352bf0 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -70,6 +70,7 @@ enum imx_pcie_variants { IMX8MQ_EP, IMX8MM_EP, IMX8MP_EP, + IMX8Q_EP, IMX95_EP, }; @@ -1061,6 +1062,16 @@ static const struct pci_epc_features imx8m_pcie_epc_features = { .align = SZ_64K, }; +static const struct pci_epc_features imx8q_pcie_epc_features = { + .linkup_notifier = false, + .msi_capable = true, + .msix_capable = false, + .bar[BAR_1] = { .type = BAR_RESERVED, }, + .bar[BAR_3] = { .type = BAR_RESERVED, }, + .bar[BAR_5] = { .type = BAR_RESERVED, }, + .align = SZ_64K, +}; + /* * BAR# | Default BAR enable | Default BAR Type | Default BAR Size | BAR Sizing Scheme * ================================================================================================ @@ -1627,6 +1638,14 @@ static const struct imx_pcie_drvdata drvdata[] = { .epc_features = &imx8m_pcie_epc_features, .enable_ref_clk = imx8mm_pcie_enable_ref_clk, }, + [IMX8Q_EP] = { + .variant = IMX8Q_EP, + .flags = IMX_PCIE_FLAG_HAS_PHYDRV, + .mode = DW_PCIE_EP_TYPE, + .epc_features = &imx8q_pcie_epc_features, + .clk_names = imx8q_clks, + .clks_cnt = ARRAY_SIZE(imx8q_clks), + }, [IMX95_EP] = { .variant = IMX95_EP, .flags = IMX_PCIE_FLAG_HAS_SERDES | @@ -1656,6 +1675,7 @@ static const struct of_device_id imx_pcie_of_match[] = { { .compatible = "fsl,imx8mq-pcie-ep", .data = &drvdata[IMX8MQ_EP], }, { .compatible = "fsl,imx8mm-pcie-ep", .data = &drvdata[IMX8MM_EP], }, { .compatible = "fsl,imx8mp-pcie-ep", .data = &drvdata[IMX8MP_EP], }, + { .compatible = "fsl,imx8q-pcie-ep", .data = &drvdata[IMX8Q_EP], }, { .compatible = "fsl,imx95-pcie-ep", .data = &drvdata[IMX95_EP], }, {}, };