From patchwork Tue Oct 29 16:36:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2003816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=hH567bhz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-pci+bounces-15544-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XdGBJ0sMGz1xwK for ; Wed, 30 Oct 2024 03:37:12 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A11AF1F23086 for ; Tue, 29 Oct 2024 16:37:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B19F61D7E33; Tue, 29 Oct 2024 16:36:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="hH567bhz" X-Original-To: linux-pci@vger.kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2078.outbound.protection.outlook.com [40.107.22.78]) (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 EAD251D356C; Tue, 29 Oct 2024 16:36:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219819; cv=fail; b=Muhmk/qIZMJRyg+bSrASg23sIvygXhyYZN5arfUStcdfvItIN8Bua0srJXZeBUDwfscVLNn+ayhnP/W4hV+dLab+Qlx2Npqwy4qoOZnHxv5h1rqmqm/CbRvWsAVq7cX3ra01HyiuTH84PQhaeg27/RpCXojqtFjBROuyvpDCmCo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219819; c=relaxed/simple; bh=NXPlQLd0GR2adwrv2G7c7lY2KTqdBSor+PQ9mBUtQ80=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=kWaTja9Pv2UJFfUg9A8yWWs2hFKx/J14oPc2ghFESCBdXm2p/0Sa14UBHCKiN6yz+Ef/kYwm4WjciMuvUvxpKYzUFby4eR86BA5c6xCe+VTUToXDuhYXgfYeYaZZQXrAeaugVmeyOcgwIYi2zaiIeIfP/YGhY1qFsrkirvtMjK4= 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=hH567bhz; arc=fail smtp.client-ip=40.107.22.78 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rmdVwjo3zi67xX32jAJf74p/P6OQJO4/fIfkj9/5oH+6s7/wA8B2VT+G+4oddXHau3YVxKblPpK3mR1KdI6HpjrIRfgxJZuNqR4a67FoGM4XrDkD+3geZVsWt7y2qGJAzenE4LfZSlgxQwoBJ2IieYt8h9RZIPC52Tti9yhk2WcKbDBRuPzWO+K6s/Q2TCfaMhoE+M8SLmHCfPgZvy4nYvnlHqQVJPeLRb83I/+4TnP4yL9jXeln7XMOFQMN6LdDMH3SMclsZj7ZvsXPrpMQR6f2EOoeIh6ooggbfFxWeM8pcTiLKje8GQWR8FdG2GRqQHlevQAQ1qcYhYbLR7NiVw== 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=Ud83vvAahmvbVVwLXJh+XRg0BtdbsLLBcRBvfAPBPxg=; b=JhtKn4SjY7qcaBJSh90k2axFthZ0rw41vz1bgfZNDj0PR0rtFFAfFfm82aV9ivyyNKlenYC45N/UFpkyM9yJyKR1kKOkAjRLk78zQcJAMZ5cuaUaJ8SGZSP3XrgbVfP0Z7lQfXE+M/lo98bDorpbUcDaqcVQXtjO957DZ25Ddx6lPEP1owv74FUV5VKbvgMHvvoVqkbsskC2WWO4EWKrGCsHOCdz2yQeHr1P7mvKrgSgy1H4q6pHB1WYn+MbNpRP1tJOKhXOyXSuwy4Mlcnypqaw8hkLyv4AFGBBF38AGTOsSwztE4O2AN1Af1cK66wppT5S5/Wlb7FFROzYj38/DQ== 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=Ud83vvAahmvbVVwLXJh+XRg0BtdbsLLBcRBvfAPBPxg=; b=hH567bhze7RcsZIt/dSSdLPe3536P1FolOVz0Z3tPRsUB9Peg1Kyc9XZoLDSriNKnJ8mEDx0HUEExtoGXwatifVohb5jk8v1Si/SnjbT/E+HbD1tZeQWNpalwuuXHxnbgPEqhF5lACkmk9OgIb2wznPjkBOJJabdIkmjdcuQMlSvahM6eJ0/jSkLc7OqL3S6WWLbByKh+AjxzEsolahRBueyRIPPDoKBTMfJWkY8MTir6vsyfmfndDPBrI8KYKG/ZcaSlCiFNU1G7mDcWWwGTqC1Qq91GyR8rrdZyY25rvYRDFBsYWP10PqVOoHM44N6LVkhVwsiRHApORaJviDY4A== 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 DBBPR04MB7577.eurprd04.prod.outlook.com (2603:10a6:10:206::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:36:53 +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.027; Tue, 29 Oct 2024 16:36:53 +0000 From: Frank Li Date: Tue, 29 Oct 2024 12:36:34 -0400 Subject: [PATCH v7 1/7] of: address: Add parent_bus_addr to struct of_pci_range Message-Id: <20241029-pci_fixup_addr-v7-1-8310dc24fb7c@nxp.com> References: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> In-Reply-To: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@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=1730219803; l=4762; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=NXPlQLd0GR2adwrv2G7c7lY2KTqdBSor+PQ9mBUtQ80=; b=neSi6t48nUqyzgiIKTUZl9yWlJkBbL7wWbrra3WS67+WJ+N01sWoD8iSDTLVwIWxL1iHAFl1A No5VXxlt/FtDeAhPpwlFiaiiRA7gh7fF0cH5iTnc+dVO0zU/+Ym0F60 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) 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_|DBBPR04MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: 433bac44-f019-4d52-a88a-08dcf837e4f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?pO/s+S+uNyEa98vqJ/K8XiduaXbWeTE?= =?utf-8?q?nqnpHbDRbqXhWDgBF9EDxIcaI8NwbwgIS1J0ombqwQvvI6IV75m6On1r6WO8V/CL+?= =?utf-8?q?uz3rVngB22Jvlqy6qsGEDnYzqxCWzOwnk0qXu8ng4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uh7P5qMPFf8FI4lm+1?= =?utf-8?q?wQ2Zc8ZoXvZHrKgeLNFq4trBFW6s4NnTdIqCTbN00LAvqrl318wKLP2z9u/3jo2Wa?= =?utf-8?q?Srk0R5upyJGRl7LO5DBP4Gjp2qkO7oIEQ64IUJXNf2kFZILv5IKsz6hiT0Xbhk48r?= =?utf-8?q?xyrh9w7UAK9EvCjC8BQ/aYEjxcOyg1hR3f99bl72Y/IOKmidTNvt1v4cUi3K+2KGE?= =?utf-8?q?i3kYoRVgNqEegatlTvlOy/P6vmRiDkPwwn2Vdwnj2sZ8ofGciWLV5XP8VMo6kZ0it?= =?utf-8?q?7M2DQ8QhT/rt85S9AqlOz0c03KINvTZxC/StkJLoSNZehxn4SfKoRsuJurQle3zy9?= =?utf-8?q?usDjy57/slxR?= 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)(1800799024)(366016)(7416014)(52116014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?aSBIYJxQ4ck18pt66AdwFADwn+nR?= =?utf-8?q?kwnv3g/ZE7ERIzTW/P/Nxa7r7ylxb7qnpe9MeKyFXaF8kYp/2+5jpM9U+TqgWePJO?= =?utf-8?q?Qqnadf/5hF6Wfn5CW28xROhI81CGo6WOkbw3s50NS+HMU/M570DIDWtQG6QfQM0Ep?= =?utf-8?q?SvZYFnjr8OE9KnQGWVVn75HkkeMYbe1q4g9pwIuASZ+0dJMC3e4KrOPnWbil4xidZ?= =?utf-8?q?5mViJTKxrUtMVz3uATtIRVGpMs9jirQ0+aRMykcobDrEC4uix40Gn7W7FBlrmUFZE?= =?utf-8?q?QUHaPOSKOlRiDPu/b9CZ8EBgs+0IuXHZ2eBXRtsphepZyQz8KC22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LjZXVUHB?= =?utf-8?q?UYRFJH68UbTZTF/ZZkq2eskmjMnzWO34hJ0pw/7yfzDHFQwY2ULsLShsh9b7G1ANx?= =?utf-8?q?OOuob8y7OJKQcgdZdeCqO+/uNdsNQZWZ4F+NpdTSoRH8QTxsEEdx/OJHjLjyYOovl?= =?utf-8?q?2c5fOd4j/SOnWv7t90NX5rsFFLUWi+MGDDp9y26LHyTyxIs++uc/v6G/1EFs27cn1?= =?utf-8?q?dlDlVl0XOARWy0yrTFPJglT5yHrYEo+PCIla0bw/ureb89J5Kj3xW+8b2i0VsQktW?= =?utf-8?q?U0MHrpI4pbyxGMiKGyzu7cFovlBFc1K1PLFHKApxL+4w/uLvfyYD4rS/m2mjfkvKK?= =?utf-8?q?GxYCQizC6ik8?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 433bac44-f019-4d52-a88a-08dcf837e4f5 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:36:53.1386 (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: 0wm6A7BX+57kAHkj7vLw7G0mMiq1ztUOn2MHp4rbUdsFxTVjL+o+Nh1EVxNqPl40dulaMt0sMWfC9i+Nueiydg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7577 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 v7 -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 Tue Oct 29 16:36:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2003817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=Nd2zkdWd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-pci+bounces-15545-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XdGBW6qmJz1xwK for ; Wed, 30 Oct 2024 03:37:23 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C08951F21CE0 for ; Tue, 29 Oct 2024 16:37:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB4051CC17A; Tue, 29 Oct 2024 16:37:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Nd2zkdWd" X-Original-To: linux-pci@vger.kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2078.outbound.protection.outlook.com [40.107.22.78]) (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 DE25C1D86E8; Tue, 29 Oct 2024 16:36:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219822; cv=fail; b=mnjWjHdxsE4kxgapevqwMFEcq8xtaEtGwhq0Y79Q0mogTqgH49jT6PKW+xOZiGwF3qc++3y093PDlOkiZ9AUs0dXs8rJ6l9GMDfPzZvKdiPFnKum4NPxz6PnzA+LkEq3mAqvScORetwd5LrwR1+Rg51xpqXsCtSYGr6l7R5h5kw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219822; c=relaxed/simple; bh=iJ6/KG8KKdayrGbVtcslMDA3WnqF1vdb/oRmxj7ytWo=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=OiT/VMdVnOkM3lv25eiwDUOOc+wVD4AZpSVIB0viIEqLYWj/k8sBY+lKFnQFktFvuy5HuA1x/0QbYIRG56AfjSeKSA7jxYCJ2NkzAGL8dN0/hUYBCwwc8YExWPqgP2fGE0r186svflmiMUBov67lzrV8wUlwFowVKfImksWOnCk= 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=Nd2zkdWd; arc=fail smtp.client-ip=40.107.22.78 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=no2EibCM2q/PwFQZnjfCZ3uyDf6xmybAfevqnKeTxodDeUtfrffCAs3wZvCz2K/HH16tb7Un+Co8awAt/8R22JHQTh6FDKUrCTpbEA9dC/jym4Pgt21cxu2DEYun/pbidRYWuv3JoP4kGMnRN2BwN+mxEcutMRiJtrbJUHTGfHVuquC6//63KQ7I1zZ4L4M5NWy7v1OUuMbE1DOgdMzS7fj/AhWcBtIqIKI+XgtfBuW8SZlunv1VqsD7CKsZICI35hMP4Ix3Hwfxm6mhqH37ytACzMsQabtFu1BoRkXJFyRFMwkr2WY4AAxd+4J66hVXxFsWQtYLbsLoltyhm8ry6g== 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=L/VhIsVSTv0d5u3ZhfKuu8Af1yUZKW5mR3qA1hzH6eg=; b=WPRJyaZUmUorQXf2OnX1OyD6XK6Mvne36sZzhlij18w16epGGn+NHfA+BKVeIJzN5sD6hjnhJGe+d6TglFWI1UlRGOzp6+LOtDUbhWpoGVpvt0d57AzFF0m55iG4RkbNGLTOSvHWbE90iFkg2KKa2j+ZIEE4JMtiT/F/s+p7Gxz6WIXa2CyQPMMCvv9/Z/8CKGZkdgEEowjX4VlHV5sSCuU5fnBo/x+LmwowE/VATj1XBX0pcZLLLFkErhwPpE94793kbn1UYghn4BkqV39D8byOHR4b8u+UDJxCK2eGRcAznlq3q4UI9Ja0R1aqpTbRb3Mdv4RoUl2Wwb+iIOqlQg== 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=L/VhIsVSTv0d5u3ZhfKuu8Af1yUZKW5mR3qA1hzH6eg=; b=Nd2zkdWdRTuQGfjT+aW3/ESI+sIPPEkLzBwsYc1BL/aNkozNm6FocIHJj4rz7EkAo9MiW6ejMMwjp+PICGnMqYpyFBXluZmzAQeoUZCzPa3Klm0ylvFhZg/gevB0M+B9VS8PyKJJBQ34h419XitOndcNgpKq+ZOtR0a7NCRz9AQz+V2lXOF7JifB4oQmwOLVJM5LKXJ9/CDj/+KC2hz0eSoL0SGBC8u+WZMYdvRpUefIgp4cxJSmeJoXj60u841/8StdfOXnN47GhS327Y4poLNTHMe7/IM+udHco8Z4CBsfFD2zAVc6lr/LblYx3zMTAy13B3tgtD9K+UT2XwmZuQ== 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 DBBPR04MB7577.eurprd04.prod.outlook.com (2603:10a6:10:206::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:36:58 +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.027; Tue, 29 Oct 2024 16:36:58 +0000 From: Frank Li Date: Tue, 29 Oct 2024 12:36:35 -0400 Subject: [PATCH v7 2/7] PCI: dwc: Using parent_bus_addr in of_range to eliminate cpu_addr_fixup() Message-Id: <20241029-pci_fixup_addr-v7-2-8310dc24fb7c@nxp.com> References: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> In-Reply-To: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@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=1730219803; l=7546; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=iJ6/KG8KKdayrGbVtcslMDA3WnqF1vdb/oRmxj7ytWo=; b=/jyC1OwyX6tQ2kmRI4ZCCYPxvzLkz0MGYm4a0Brx5F1Kkn8GhdcAtbdlD06qrkdD0LTIsD2uo OBcTNM26FD1BCYGNjWDZyfWNRxIg2plSPnneyymPTKZvICtRsXJwVDO X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) 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_|DBBPR04MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: 85cc176b-3eb8-4586-3f14-08dcf837e7bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Yx0o28YwqKaC4XSsjCmF6fBfBBqxy6e?= =?utf-8?q?lJgkHbyT6QnQvltOa/4lqOrYgfluUvjhZBYoyoCHCEdidQzp09uMkU7+vvMaaVdcJ?= =?utf-8?q?ENLPvAErHvNaDXca01XZcS97zRQ/yJ7b2AaSHODjjz3ZIWHFU+QYgt/WvjxiVQE2H?= =?utf-8?q?llLjgnSESwFvfyLA3FJj3DV5Y6l6fZ1xaRdez4Pi35C40jiKEHwsTMIHrpHbJ4RUy?= =?utf-8?q?k8owXSkO+WNBH8WyIVcYCJM6G4yRG3LmVbxIGjiZe7hvbzUVbnKFWqPhKv6cpWZ1i?= =?utf-8?q?KMklWlDzj4hwWx2aFELpbDf4XOTdz0ipXkF1Dz+5GHcG0EdO2orOBqhfezJOHKN1F?= =?utf-8?q?cLkTWdRLfpKIFk7Z2yaAYHPNFLSvxsABqls2vxJda8L/gu3YUPcO7SYwgjRAajvc/?= =?utf-8?q?rB7RTemwhw9puYOguWDCNO+DGCSgqhOsPlNHKy7krCfqLREzMKYQC7/hZEkTp2mmd?= =?utf-8?q?60rm0C1D4/rcNAZA5YSJvwWihFLYawqEbLEXa06lhmfu3ThZjEbGg+koU0kdtwni6?= =?utf-8?q?h51SijzZnK4NM0LrLCOciQeziGnyMFQtH6q2XnvpPl9OT6rzFBTHZcP8+Z1laijLZ?= =?utf-8?q?cv9BySrU56gK9sn2CR8ppSIk0yREXzWDKTViJDSM1oPy5lRyU8AmNfPymyWRjVLN2?= =?utf-8?q?wABnbAUOLVJPcQEny9hFRvqfr3ft/yVB1kvYcbxJsfJnraM56vRCS/iiopHWNJEip?= =?utf-8?q?3Kw38/7UHCfTsRCpEku/zIIO8lSmiuR+V87S9TQsXriox3FdGYy5BNRlEscsA4EQH?= =?utf-8?q?YTUtMSctskUJOmLYIOradiZk1HDTg3WciIgiv3wKMDvfWWShB0olfckmNTotxUmak?= =?utf-8?q?tfDRFEEUkTUGauPmAHmWYhiMv+Ut84MGlKYajxHrGy//bLoz/vMrmB49u19uru4Se?= =?utf-8?q?H6Bqlevo2Cafgv8SDy7RewIdYzkRFs0Q9Y6LG2pmucRKvCL27sdIWvDnILx3G/+eW?= =?utf-8?q?P97kj7QF79neLMhOpWwGKueVq9YKDkoN3VVDoyb5em6HPh0GDIS85ZuNmDa8/AFOP?= =?utf-8?q?T3AwzK72GV45ZuhqaqnxwJowoyiGc6zAfTAyUBT+WnD1OVagieT5RYhUNBqZfEfsz?= =?utf-8?q?efgmKmuzdNMWE/ahN2XeuFqpOxVbCHhZdL88fDb2nTZ01V3TTnESc2rI5kK9bqvwa?= =?utf-8?q?OLtXg2JDo/FBj88PrBVnJHQlJAYcgchLjWILKTo2GhaGm7jxVekTc2oWSVkJsyBMM?= =?utf-8?q?V1vi3tlJ5VPrMXUUBOKR64DhFs7euLfypLbSbbLhB21QjxQbpBg17cSAEDjZhrtXJ?= =?utf-8?q?cDIKEiLpyiJoijyN5OSZsMraclBjwr4FTM+0beo/+QT4uLyDfsSLE3mNhdqprlKrZ?= =?utf-8?q?V2RmrKP2RFn9?= 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)(1800799024)(366016)(7416014)(52116014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?T9KJgRQrq/lFD9gcwRszVz1bxNmK?= =?utf-8?q?MSg5N/BEmoe0t3kTRAkR87aWUoA97U4cBeudMXrMDbxBUdEU7T8/UT4AnzZytsH5m?= =?utf-8?q?ARC0fGVvQ/Fz1Fzc4XSCqjoTssRp8t0FsE3Yj0rTP1j2FRFSWFcGGYMqmVLGcDu2U?= =?utf-8?q?h66SHyX+OAcRG8Pj05IYEIhmpaYyZ3PK726Lo9xBmG76E3DsMBwOKBJc/ALCDySFN?= =?utf-8?q?qFXGID0c5/RCnv4h/N+XmhcFalRUAV3XzOeqCDhD37sf6R6qMgoHWCML6wyyu66KA?= =?utf-8?q?sHqQ2qoKWCXR0vFQOvRQ4PuDTLdBh571WvbZWzP/p9+gUvqujn7lFF76vYvmeHtUb?= =?utf-8?q?709JTuU2CJskgwGW4itC3hFjp82h+icuoua/lCSU9/x+g+xanZIQYYrIXFSq5bUo2?= =?utf-8?q?oPO+zOpz4Wrx1bYo7UQkEy5wmVnTW9ysKYul6yNlfJCCmF52dHrUGA9XUI+7XxpH+?= =?utf-8?q?pQdzvEK7NY60lzNEL3sp533xCehKx7KIQaNefqZT4sDgtzo6XFktvmu1OEXKthDBj?= =?utf-8?q?KkPisx5xKhD1uWaJ9Aqom6F7TvJScJmnt4uEnk4ziVJentTd/ztml2VOyxPv+22d5?= =?utf-8?q?cwpCEHRkFFxMTfjeO+4e8LZnamThEAayQiLut1Vi4fAkvJKuos5o2qPVp6fcS/xZz?= =?utf-8?q?ww2hY/+PfCOBGCV5KH7vJ2NKqXjP118nI1PMx7aozPcMk1yLQ2J0DjlQ6pfBuHEHd?= =?utf-8?q?j+lHnCMaUe1K6fLI2/h1WXJ4VefcPrSxz3VEpt8/cxtU74yHv/B/hElySB7sa3P6F?= =?utf-8?q?jkfmZ3x4rWnFDPYasgP6gRJvVKiO9pn/CkKq2eMoZQXMMI5mDKGAtV2hef8YXFt/M?= =?utf-8?q?x5fjMEIEA3ghJZfnS6owywoVzNxKuhLMB1V3c6tfavnvHnoUsPHOoFLgoqay5I5FM?= =?utf-8?q?a+B7Szii6YvnNHYA1FpXlRsFCaZaoOF4rw9o7+tJ2d/ui1FcOmq2wXRE+fh/uuIo1?= =?utf-8?q?s1evo2fFyk1ce0Yks2NTMjwy6pH2P8Cv/Bp/ijm0nr+ClzNqX1iuVZdERRX25uEI0?= =?utf-8?q?GwbaYcjO1NpzBoh3S9a14IXCIKGrs931HPIeaQRyX0dtJpr0PHp5H1yCg6vf65e9T?= =?utf-8?q?gOSToZPoeegpdJe+QCT9VpYvzIvQlLApo+zUXMvBk/syr7FsqO1Z9WBnENA9oLRxs?= =?utf-8?q?DMrPLAgiTCFzc8TfUw37TCGe+YzCb4zEp+Bvw7C5Q1kLueZBaWI39ryfoxcDsQYNQ?= =?utf-8?q?JeATNuQja94LtecDZX/9Q4BSXALeot2oO3pm8YDHATSa5k2PZ8Y90Kp6axmUgVQNO?= =?utf-8?q?D0jUvfDvOF002mwBkt4aY8azPOhPCde7craitrdigX4X5svsvdtFoXFDXIq5whotv?= =?utf-8?q?uO5okO5onWWGEVDHB1fJbOLFWWVBR4gwZOSr6xwDooTXx5ldLXcbOp1ssq68HrJNa?= =?utf-8?q?AmfyBimWoV+vWwtpK8BOFubewjcHfKST5DCdun8QAlixC9F4zT9iEJ/RgV9tEyRh0?= =?utf-8?q?9UnhK+6vdbpIjys1kKiWl9ANVbIMHuxW8q0jLo3o/J4+1DBlmI2v5eOREN5n+x4/I?= =?utf-8?q?RWIVMhanDGA8?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85cc176b-3eb8-4586-3f14-08dcf837e7bd X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:36:57.8597 (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: 6DYc4LQEd0Bs4wItpa5YksZoJgZ/d708Zgq7udOL247gdwDdiWb9sBuKa4q5o/94gdmnH8sMMCVBXohcgUkG/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7577 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 --- Add a resource_size_t parent_bus_addr local varible to fix 32bit build error. | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202410291546.kvgEWJv7-lkp@intel.com/ 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 | 55 ++++++++++++++++++++++- drivers/pci/controller/dwc/pcie-designware.h | 8 ++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 3e41865c72904..ea01b7bda0a76 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; @@ -722,6 +768,8 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) i = 0; resource_list_for_each_entry(entry, &pp->bridge->windows) { + resource_size_t parent_bus_addr; + if (resource_type(entry->res) != IORESOURCE_MEM) continue; @@ -730,9 +778,14 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) atu.index = i; atu.type = PCIE_ATU_TYPE_MEM; - atu.cpu_addr = entry->res->start; + parent_bus_addr = entry->res->start; atu.pci_addr = entry->res->start - entry->offset; + if (dw_pcie_get_untranslate_addr(pci, entry->res->start, &parent_bus_addr)) + return -EINVAL; + + atu.cpu_addr = parent_bus_addr; + /* 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 Tue Oct 29 16:36:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2003818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=izJQ6Xrv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-pci+bounces-15546-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XdGBn53qTz1xwK for ; Wed, 30 Oct 2024 03:37:37 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6FDB8285EA0 for ; Tue, 29 Oct 2024 16:37:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 290171DC1BD; Tue, 29 Oct 2024 16:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="izJQ6Xrv" X-Original-To: linux-pci@vger.kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2073.outbound.protection.outlook.com [40.107.22.73]) (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 54C1C1DB37A; Tue, 29 Oct 2024 16:37:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219828; cv=fail; b=lckTTgRj3cvQNfqIM72G8mKYtXxuYg5FkV/tQYyLYBdMYK0v59Z6bky2OYcWRLGhtD0LIqDUL0QCdWn9jgQCo/UunClKkpocyymJf/9HfyH+34QHndHAtRrdZVULPCt/fSxZ1CsuiZk3gIVIB5Z5UG7oxFLudV1K0CzbGJS/+yE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219828; c=relaxed/simple; bh=IMipsZtRh42ozcH33850bFCfms+HZHuAJ8oMSR3hzdU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=jtRI0h9hZaq+aMTOPZ83bdW7k/8Bk12DbiwVc702IzK4dZGZOA34eFY7HwhkGS1qFf1IC4zmfJYPwjWo7mK8ydOi8Kl0t1gz5Zc7fmvqrwrPxpmvfl5JFr2dD1Ge3M/h3WsWy210cAjKDVFjmtJ4Qk8Sx2hCyo8shew2engZPnQ= 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=izJQ6Xrv; arc=fail smtp.client-ip=40.107.22.73 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AuO9ePFZdXOcBZUWHRZW8UF/5alueua+z9cSymhZcJD5gZZMS4k7TkgUh8MOMBMqsW0JWcQRai26MGt6iuFyeQcBzEj3eB7KR1imXlk15jOTj8bBIAqQ15uVyaDbzEgYQ2YnMFqT6D4OQzOKeQ4hkOS3kpXbtERYPpY60Zwf3N7aRQYXfRCKNsbtJwiH3CJ60j20EfTsmT0syShncc3ZwfgHnL0BPRfscCDrLR5wLOkP0ftvhcxT2ZMd51OW5NVVOvEFIYl818lWgwWLim8aFyky2xV+O/Qyl6OoCeqim9Ro0CkfGaZHUThrPFEKccsapkdT8ZlNpKmqLKZJIjgAqQ== 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=3cE+RUByeBM+zxwx0nFzkXWP0WlZvWmSl98mTrUt0WM=; b=x90kMYg9a5eLLvo4xsxgD86xoEaGwOY2eEkkBFCKai51G9ytCi/lVcwnLJzT5WPey0rZ0tuDB/zj5gHJ9FhPCMsGAI4J7LAfDIwLNYvHZmCx7wsnmQWxYs4QxWMyldsB5/iViFc6H/S4v6/MfMVjO5kEOmXB29qjZMeWubCehjUIdx0sZtARTh24SdRb5YsyIP2p0XV4Exc1uf9NpdVZ+hYnVBuIEUdCGBrkqGN9PLZ/fPTS5eAzLn7CcwanUjJGHNJPTQZCZstQCtVWmSIm+6DM6ydBUr+h+GEmrIaTW2YXnfJB7EqCoEH1V8w8j8IMfC3Zd2nqmhLVpm4uG8Da4g== 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=3cE+RUByeBM+zxwx0nFzkXWP0WlZvWmSl98mTrUt0WM=; b=izJQ6Xrvjfz2ZMujKMRe8bpAWHStD4V7yYH0VrVUa9dygYifTEFQF1ILT9cU5DCAeRK0NYtrwS1QSNtzmaEGeuLsWoK/STjxQEAfxH+rDIKZxW1dFFgQAgzOCTeAT0S2FgjtTAQcizCPrcFz+Iq8f2qoe0qeUlZ69dg3ewo1BRAJkigMkvUYvQSsKfgipm+n8dPSRNwWKEApkURdWOfea/pMJQf3/7QPkWCfJERL10NKnB49CjjvvXm8UQrOEzok3uQRMpcc99Kw8q8QnxFgXhnGJOZx1YVgGjFIJ+PeesabAyzVr53EAJPb3M1vmVs8soDYbhpvaM3JQ9EezUWcNw== 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 DBBPR04MB7577.eurprd04.prod.outlook.com (2603:10a6:10:206::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:37:02 +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.027; Tue, 29 Oct 2024 16:37:02 +0000 From: Frank Li Date: Tue, 29 Oct 2024 12:36:36 -0400 Subject: [PATCH v7 3/7] PCI: dwc: ep: Add bus_addr_base for outbound window Message-Id: <20241029-pci_fixup_addr-v7-3-8310dc24fb7c@nxp.com> References: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> In-Reply-To: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@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=1730219803; l=5662; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=IMipsZtRh42ozcH33850bFCfms+HZHuAJ8oMSR3hzdU=; b=FKTkpRxObUzPe+YEiqYW8Y9/yElh1Af5kmudHZK9r0Fshr9nflpupBLircq1RQSrr4tcidQ2u r2NuBCH7+QpBgYu3eaURUZKm7goAuMUfwdU0J3DonLt4ygIWmAcGoqz X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) 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_|DBBPR04MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ca8fada-dbc2-4b4c-6b67-08dcf837ea8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?CmCoQ9Ht/8ycG8b1YpXidbhjS2KmVPJ?= =?utf-8?q?zHLZrwS3yw21dKbc2aSjG4yiCEvQwA7A0q9zl9P+RrXfKdquglJj238/w2ZevomhP?= =?utf-8?q?Eg6i2UfZiaw6WopsZqGttxlF5b9GxkoOCpqN+NjtLi24Gyo+6eXiYn059akytW7As?= =?utf-8?q?F4VNdMwresEHiuxwHU8AQ7Fz07Ki3+7sZ7Gc6aOZVnGaeeeI4EI5RZ42B29B6Yqgm?= =?utf-8?q?BALO0V4PGuG22deywj+amuCVBJd9SoU9vHDBBm8cjSA24/0t7cuxxIpKXHThdqUSg?= =?utf-8?q?kcm5D8u1VmdbveVPZDKjLX61HpkhqL6jq8hh/I17CeG1VA+OxShEYiVX0D+Hrrb0E?= =?utf-8?q?7PjuZg2BUgZ0QiYgQ4Gtzc2inqsKEXy8PfgmKicEqqgh4jOEnRc2H0/YthxieH/0h?= =?utf-8?q?NBxzf3JslQxL07voO0iYTV7wjL34KGiEZu3aT6Vky+gsi3SGoYeinKkQimykPwGQa?= =?utf-8?q?PTQSaiYVheny8jwwvZs88IKX9gp8U8bQGGepnnqexHVgWKw7Ffag8nLoso+fEmb9Z?= =?utf-8?q?kxzADQ4xCqH+9dmDKV4A3tRyq0fj1mpJwdgSuSnKKtdAeMcTXqaOs5PtGxkv0+G2C?= =?utf-8?q?aPs5cuPKAm/a51k/lps2EBtYSb/H3ImIf0sRCxnWkTZvVJrUGTPtn3c3OATpGYKeh?= =?utf-8?q?vQmsBCy5+Hpbpt79IQMKJwTQ/JYaJEWONW3XLb8Zm23Uq5vNgHAFzuUblxW4VMZCB?= =?utf-8?q?+pNX0Y1FtZiMttZ6YxL/p9d8IuUpJ/dWoekDrmBzCg1gqr975jEWRJR+TaYpxQp30?= =?utf-8?q?DMeFJN4fiLPo42lgqM8wxRzlZtRmTJMeXWrTo7ATuZg48vWpATjmE/x3GN/8ZTxej?= =?utf-8?q?Nq6G9IpzN4KLICW9yt1Rfjjj+JM1K8e1t0afNaz2h4dWykIU6s7iuj3TFynQYGrOC?= =?utf-8?q?h+rqhFw5P7kx2N1yMlWacxSVzjPpWJ+hOn5RchcVZsBeo2dXR4Gyvp/sxbfwrINRJ?= =?utf-8?q?jNMQX0PpTREqO9RfhjQrce+0bOWNJ5Zm06Uy+4JNi/Jk/SLEVUpvYVPDUjdjlyUrY?= =?utf-8?q?z9aJzuR8OooVsOhOEU8bv20PHc4J02u1OeFSYWnAIqCUGIgNceyfKuQEdimdMPk56?= =?utf-8?q?Q6stOJE3/iLKkYbcR9mSoev6KhQWy42MWbcOQgSB5dc3BLTZx78nqfD0eiScVC3O5?= =?utf-8?q?LWFD5cTF9D9y/QTlQiOSCpWd/bf6IDreC0mRAl4skpDqbci/a8OWXh5pYAxPqvAtF?= =?utf-8?q?zhJSRCgt9IOaQxNyNdZ3JApcOCGD/rS8TFRRaPSWx8uY2Bep1rhzRJd/eAcMwpDQZ?= =?utf-8?q?twGdIYAQ16aBupNvf2WEM9Z1VmI6QvAZvXVnO9Sy/Pf+yo3VtEDLrHHOIHJd3Tbuv?= =?utf-8?q?CFL0lJeSOM2uoYTRKnE/Hbo7wQ2yXf/DOQ=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)(1800799024)(366016)(7416014)(52116014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?yU5ydLLz80jfLA5ZCMvhgD+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R?= =?utf-8?q?IUT/ObolJq9lVWjQ0eDwhZyDjSol8ffJ2cJ27EPaUt6v+2BefIUH9XKGiAZYdLhgy?= =?utf-8?q?igiiFTV3vspdY1bt8ubHlvz6JrptBIlJ727lUWL0Cc+3QtDOK1uyLGb3pCcFVW2MU?= =?utf-8?q?OX4VYavPq6wfCzHWiy2yz609LFeaJHUnzhIQ5QJJuWPY5E6lzPxgi70q0zzkTm9uE?= =?utf-8?q?zaGkdNtRt1xSQpTbB0B+kgu/YHYbUL21P9KpVK8hAGWj0x/41EydQOKKZ/D3HufYN?= =?utf-8?q?4UNqXn65wceo8HKqhn1MNF0KF45FZtPgp0c0CtsfdV9BA1n7FYam2+BKLC6OtKYBk?= =?utf-8?q?PsG/fsSoytkqXoucNq7WQfFYLEUttZCqYDCB4LDNoGxroxt6y2uoGR/Lesahn+HZA?= =?utf-8?q?c+NCe/dNb6QZDnu6gSiZaZ9MrOX3DBU9ZZXd/3x+emkeNzcb0dFMt6EKG2fBn8klY?= =?utf-8?q?1ckg52KeJpk53XQOrRDXwl/jFQva1gOwjSe010wViYB+am+vw7W/K4KGRaLWpLDjX?= =?utf-8?q?BwTD9p17iXEdzpg6KuZGu9KZYQjB1WHpWDoMIMgFroyZa9BOjZ6VOL0aEV/z8IYZP?= =?utf-8?q?OLTAs3XPF/pRC6JHoB2WgNhXb6H8B9lr2rNAGcvnRgh3zaEVkSy0dYgogIHN/LHCc?= =?utf-8?q?EbDznKWACUyU?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ca8fada-dbc2-4b4c-6b67-08dcf837ea8f X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:37:02.5378 (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: 9CCCn7cz3AH38vpgZaeSpChUNkWhNGyT7ELq9B4XKzuJBhXLJoO05Ga0OCNF3TxInF/onuRYwINr/lWqnyA9Fg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7577 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 v6 to v7 - none 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 Tue Oct 29 16:36:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2003819 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=Te2JhypP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-pci+bounces-15547-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XdGC93BmTz1xwK for ; Wed, 30 Oct 2024 03:37:57 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5155C1C209FE for ; Tue, 29 Oct 2024 16:37:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 861261DE2B5; Tue, 29 Oct 2024 16:37:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Te2JhypP" X-Original-To: linux-pci@vger.kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060.outbound.protection.outlook.com [40.107.22.60]) (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 DFDC318FC9D; Tue, 29 Oct 2024 16:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219832; cv=fail; b=Dy3EFB9vRJibGKjymSw9MwoWpfobiKostR2ZoQW2Bs3bOPx/W8A77AMMqZrVdbb2ItI6LONIEaW7qs0lyFubDoEMe1bQ3C651PT1ly3kxQEYZ12fmbdTqMQVPxh+Jn6nv5zokQMMu6FfP3mEoSzrOEBykB8bZzC9rUne/23/7+E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219832; c=relaxed/simple; bh=QOgfKyodPSXGdn059Wbm5lzn0V1+zBWDoUWmg/pDYgY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=DfoE6jLRKvwOTmSYNQodx3qmCRA7SGrLb5fFlRmxQN/IBB9EaIX6usT2Ud+bjBw0cm/88xpzuJ8Oxp2VurIEit89C93zWyEIcRxhLrITCiz+LkyDr99o26y8p6iGX1gs4ZLk0GMKuu+EQ8JriM8tzLR6/YnmEE5uqTe1fmCwMs4= 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=Te2JhypP; arc=fail smtp.client-ip=40.107.22.60 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LsW/o/rlbIiN99CIYiFjhAecK6heBjS5Cpsxkqc6uVRVC+sVqgm+CPVh7ubi3wucIMQaNPujJ5OvS+z/sicl9Fyr3FRR6KLdyWQx9JO0hkrNxhV3j0qieYcXhOujoAcduCMKGwtnIUXoO/mer2SELppel5PRmtVuB/qQ2fSi5705Td1WeTyHgLrzDDxXqWiYg9g7pSknm4TVLcmlTZY1cE9fpnkoGwtU8KQtEdHJeq63fY0Nz3ayQzSRyFhOY8B+JnDwQggs9f5k5BNxiUJlCMxbVpFrusvL7AdHJZOtsy8/Wx2mmpvfsSTu6l2zWhE/vuFYMLuNISDP1mRr5eJmtw== 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=CIjUKF1pCR2NnXoJoZT8XtU0SA8MMpxu73bnZDj5E6g=; b=DjbV04Tw27NNn0Jv+M3oLI4d1OqP/xxDb0G6iO7V+7g47KR0dooRNOspzmN62iQjQcBi20jSBaXEslVlPAsedTvwUGQLCWH7o0HKLTVsCBH+lnBhaxY2CdNFAUdjO2opUfg9bpmio8KqdselMZrwZCRhLP/eKp0LFfqv/epdgd10CslJ8kxRG7cwCB030V8pYv/N+LJZt5YedFQ1ZOQ6ZOXDuaaHKbkHjveiJaid4sQvFD37DRsA3/TFofGWLxYON3NOgGxdMHuEpj0B5RwZvvS4ldkoofEsPuonjkLVKdp6zQZpuiiTs+BsxMXzRw4eOJdDOQ2ijvf1B1V3jWMDFw== 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=CIjUKF1pCR2NnXoJoZT8XtU0SA8MMpxu73bnZDj5E6g=; b=Te2JhypPy3Z7re/gLb0TBIIhQh5DrKOFggl+BB6gnZ4AW2iQ7uX3QVuwh53HyCPGF3vaVn0z6gXtUhGz0yjMbXl5CU05il3W89gd9SvJ7JBZyVOPhpCb/lPFUq0LSBIAFMWh8diR4mAzVMPPCdXykkmFymEXr83KsplPnSzJiVfm2lXMof9p61nyC/JRllw04q+0IaB1ChsvW2mkXqdqNzjAfPSOaTG02jjQAkRAH8MdvVxVVGBChv0fb13Nf/h0hRXrOcZ6Pj1vwi4/jdUhJlB37qGxFQKKhnzrqEDiAuexu2zlL0ylS6ByEOzuEPuer1itxtDyupJKvkQMfOxslA== 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 DBBPR04MB7577.eurprd04.prod.outlook.com (2603:10a6:10:206::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:37:07 +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.027; Tue, 29 Oct 2024 16:37:07 +0000 From: Frank Li Date: Tue, 29 Oct 2024 12:36:37 -0400 Subject: [PATCH v7 4/7] PCI: imx6: Remove cpu_addr_fixup() Message-Id: <20241029-pci_fixup_addr-v7-4-8310dc24fb7c@nxp.com> References: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> In-Reply-To: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@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=1730219803; l=2455; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=QOgfKyodPSXGdn059Wbm5lzn0V1+zBWDoUWmg/pDYgY=; b=9wvE6bON6I4IaU2EIMPtWUKxcAjgPgF13XjSP41Is/Klje1XPIpcpF4IMwvSOP/eKvEdLjWjl qf7zFOo8ip0DMKi3N0DXP4rAX6Y8vfhiP9wtXPBMET2lg38tXC+fXeU X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) 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_|DBBPR04MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e7d3cfd-5e2a-4d61-8be6-08dcf837ed57 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?i9bRm3NPgRrmbEnpZzz2IK+XFZw9rrv?= =?utf-8?q?OnQh3dTTA15YPJoTNgEFcAaX8qoDUcqMccVq1DXz8UNsfZgpUqtk5NNnker1s+hYq?= =?utf-8?q?AQvU8lbDJWIkGRfBtN6xGd2l3PaHND+Xf1OoFzTAI1MsfnSji5zfok2xGavDG0+a7?= =?utf-8?q?VnjP1vDapRPucxC2lYPSoN4nInU9ld/NN/oKS6MTTQBClbGrNDb8W3nnqF5cW8MMH?= =?utf-8?q?jmw3T0NAtvG2fwJjipuOu3GzjWY0SK9fV75ETAB1xi9NJBomg3I4nrkD4ysW2qhxi?= =?utf-8?q?rR/ZKgOA34hL1zKm4yBQ+Oznja9Z53NpUZ3MwhKiYTCBbc+kielXzLpSKxFH+nuzP?= =?utf-8?q?iEu9VrIhwC7unW48EspH3imaX0+iE5CmM+V0P6wml/hbDSqnyadLswsbnQHsP5whm?= =?utf-8?q?YHtluqzv1cu0BSV6H+Ta6YQ9p09SX25qvCC9AoqyDIKLzSdecgF6wzFvrqRfw680S?= =?utf-8?q?F1xLzDgzRO6DcPiOCOy596UzCtq5CT9FwgBwV5oxV8ZtuvbMzgXeH8zZUtN5xd3gL?= =?utf-8?q?Cb7yfbaGGzs2PZcI3fsvv+J17vZbqpoF4WhSTvlzP5pPYUZ8NyltLv0MEPDisXJYC?= =?utf-8?q?xqgTZf+GS+p5Vx9QpDXh0+U0OLw5Z8gqpw4/iM9uhiNVcPb/IbGX+kV8/IMapqrtk?= =?utf-8?q?4GvmJBW1UynNlsWCLGLn7MQgWgYF/g8X0EBRh4yzel7sNEe7g78+EAhQJbhMiIf7I?= =?utf-8?q?JbOO8ZMKSqNMQGZNDyqhRIi/YVSbRNjZggRUh7IscVMfwWAwDk3uCjry2e5/zo+qe?= =?utf-8?q?UnYc51WaQX0qUHyI0kDI3kVeBeIisejqdTKZz/weZvr2HSo+oy+s8Sjv88BZGsC/s?= =?utf-8?q?uFGw5g9pjsLguQNDbpUzPLjN4epn/pR9IIVgVGvtv0yrHSZyBIPPpixVNTKDKIMKh?= =?utf-8?q?+HBOgV/iZugdB2O56IdX8p1btyyvxDKeCovUMBRaTlA8XqbEZjzj4x09a8YsvFZvg?= =?utf-8?q?ageEwgVUf9zVcyN1PrigtdGO2jslJH/IF6DIhr38dK+hAOX8tW8fd6XImIBomegdm?= =?utf-8?q?/aYP9Q7hIrmAv4FhKa4PlYl8T2g1BWh1uyFJv99ENZs7l3YC1cPrzF+IqouYHF5Ho?= =?utf-8?q?qpH2Qcdeo3kRm8iOEMBIH4HnLUHY/h72z++iX07bOWY3sQ2tpdMem/2AdI5rgzpJe?= =?utf-8?q?cdzR7CcHmhN1eC8+7ZQ7oa1QxE+ajx+mGjNJRssozGuPjv+jenLZVdyq8PrrItEUv?= =?utf-8?q?PQOLDnS1+Gv0qQmoW+mVYNN04VeCZkjtaA7BuVuF5ZJCp+5ttJ0udNTNd+kF1ww+J?= =?utf-8?q?9COzHFX4jLuuF/5EBDiDT6yo/THvBNuvQ7ujlNP4HWqZ4KsZwF6eQQZcYm1vvXWyN?= =?utf-8?q?Hx2qNF72MzgN?= 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)(1800799024)(366016)(7416014)(52116014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?jvFbpmdlgajDnBiUVDWH3YfCc16g?= =?utf-8?q?VZsLPQ8GLYUYQxGui9mwctRh/mJPeK68ApeajWQ1QtwjOWHF0AwoY6/Rh1NIZa1bd?= =?utf-8?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yO4A0z9U0KO6KrRh+8CjzQgZT9H7gGB2NBmI4su84rxG49jYLsjDJ0gA+j49E?= =?utf-8?q?cmtjTZ9+CIJSpsqVGMZCdyR4mrz4VbS7ygjppJb3DdrvyRIlLTTikW6WkKpmth3Mq?= =?utf-8?q?hix6dWUdsFG78llKFkKCVGvLyGWaQi3UhqO52TRRvwMnEXZnvpNTQXg1CkwUA+3xP?= =?utf-8?q?OnGKTB0071jfjiv7DxnSLsfVdxRf9INc9BZ8puCci9lFGDSTX49Lc60ISDpFv2gJ+?= =?utf-8?q?ycV6kSJYMLfyJZw8DnjORIBHexUHniEn8nUfWbG1z7RI0jbN72/719pt/LRfDW4ny?= =?utf-8?q?d5RN940idset7QRPaXM3pk4r8Tclfp0UwRd7DEouzYvHpHGDiPYUr0Qg6bQbpQ9Lo?= =?utf-8?q?24eGZZkpY/YJnymysYwzr2EGCdXBU6Kupc3eZnaG/jySKX3rJ4laAL/ie8d7JYj72?= =?utf-8?q?IfXoykVqefvBC0LDk00ZvKVU0fGeW1LYdU4nFgK46WJqn6Oc3W71lreQ6S43XZPdk?= =?utf-8?q?LwK7HP8NEBB8YK7GZw29AvbIqTOrUAiJPlYsSWUssjDS4hZym23FrAY2u5N9lvuZb?= =?utf-8?q?OTZZ94k7gTPI?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e7d3cfd-5e2a-4d61-8be6-08dcf837ed57 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:37:07.2078 (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: qrYj5NA5uinB3/4fvDB1Rq3BogkWoXiBukYQ+G22MBnvEZLkmG4913KqEpHUIUW2fNvlfhxI4gbCe4jn85uymQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7577 Remove cpu_addr_fixup() because dwc common driver already handle address translate. Signed-off-by: Frank Li Acked-by: Richard Zhu --- Change from v2 to v7 - 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 Tue Oct 29 16:36:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2003820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=lxVMvKBb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-pci+bounces-15548-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XdGCg25Shz1xwK for ; Wed, 30 Oct 2024 03:38:23 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 238CA1C20BF6 for ; Tue, 29 Oct 2024 16:38:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 93E43205135; Tue, 29 Oct 2024 16:37:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="lxVMvKBb" X-Original-To: linux-pci@vger.kernel.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2058.outbound.protection.outlook.com [40.107.20.58]) (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 ECE1B1DB37A; Tue, 29 Oct 2024 16:37:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219837; cv=fail; b=HS5/ESKFPAuQz1ajmDid5BpsW7qx8RR/2xcSoY8gaW/DTrihmtCUlUJc8IFXDdVIuUmk+X4w7k/Wv5DmmJgaJk2IS3n8c4rX4r2zdUd+CPMOpMYo8ZPSTRg0voo5J2UA85HRPRfVVsuTFyEt0wZ5fXp4Ti9btqBeIuspo01FjOI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219837; c=relaxed/simple; bh=UZs/9ItHp52qTaKjFxZYB4V5+jvB1u6qYUMVnsusbtc=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Rg5ivO2+oMnYKtF2lHr6jzXCl4JfScenSuzZv+y/HNSIrlVEYvOa8+us2J5vVMiioEaefL99xWFAJlGYErC2DVQ4wTmEx9krfzIYVSmD0zu87wu7gaAR/ccnYxfIxJSSxXL9zsxUbx3RSJP2QG2QRo2F/vMrrkBUSBixU0UPJWU= 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=lxVMvKBb; arc=fail smtp.client-ip=40.107.20.58 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L7Jth3E+fJdus3LnAmz2khReek8JkSC0lOvN8RA8aBa784ChUbwlwR68KUK3Hr+KlEbpmgDFz/ua0y/Oo3IRKb64pZ9Jy5UhVlFJgIsBJ/R4s/+6yHrRtd6OIv/LEk0u46tPY7K+CifYFu4lVfwoPidNj+foXtQeYAU4uIFiQs3LhSrJTQPg+TTGGssU965/I1FX5tFpzq2c+LKYasrKrsFlZqblXVLrIi2NbKxhcs5DuzgpWN5DG6rJnvga1xPxuIgU+GcOtSSzJBHkKKSna5V4npS/yKSX7mrJWyV2Ev4GoHswQgdQrJn08iVIeOSc1EJciWKKypVMWzBjaittqw== 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=R8W/MN5dTLwVKfDTf/LqjNNpJdK6uYbSr2j3BbcfCR8=; b=nkxYPL0K27obdxLuuRiyDQ7Y9yapw6maGga0iIkNyVr4ogoggA0av4eo8HFAdU3J/PElOk6OHnZ+S2J77S6sKNAoFDSxtkW/IPfNMsMU9yS36f0tHWxoltXvDXmh8iQArVgaO5psStiYmaCvfqghN7ArRjLDqZI2YglCutNs+uNyYO+1IEYoGVnp7Ej/dRxf35UGJjxcCjnKN7RB4Ntzg2qeVtl3iGfx405m79TSK50rjckgO5OEre/QKPgmFobFBz8LFl3/sL04SYelFFRPprO4OibbDL7l9rTP72doEygutHqBvU9lF0aOa8SLBDBSEW4Sx8zse4Ra9/QsqZVB/w== 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=R8W/MN5dTLwVKfDTf/LqjNNpJdK6uYbSr2j3BbcfCR8=; b=lxVMvKBb4SP5DU7U+SPogvjJIz55a+eKqURcUXExzC4TfWGFNF+qqO21Ye2uvU+J0iR40Ro/ueyqfC0UGSjBMxI4nikOI3B2viEge/TBS7kFYc4I44rxnsz97Qxqvwnsd/dC4zqrlmGlyD7nv64F37CZuWzu3sWwtFUIyiFiE5FsVzjG/FSp1wqk0lzUXAzlY/jBRPLOfW65Qh/jBeA/4Rh6RTLq3lhAPvzPSafyX2+QLSkINrCjIrBrehASa3fregL2zA3G4JiZiTymtZGZJ7LHTDXAb0nQCiKL8vnGKY77DRDevzXnWQBDKA28Dl0y9bVS0fDF4J4IWIFiqbQeZQ== 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 DBBPR04MB7577.eurprd04.prod.outlook.com (2603:10a6:10:206::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:37:12 +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.027; Tue, 29 Oct 2024 16:37:12 +0000 From: Frank Li Date: Tue, 29 Oct 2024 12:36:38 -0400 Subject: [PATCH v7 5/7] dt-bindings: PCI: fsl,imx6q-pcie-ep: Add compatible string fsl,imx8q-pcie-ep Message-Id: <20241029-pci_fixup_addr-v7-5-8310dc24fb7c@nxp.com> References: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> In-Reply-To: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@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=1730219803; l=2245; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=UZs/9ItHp52qTaKjFxZYB4V5+jvB1u6qYUMVnsusbtc=; b=4epCvFW/6EZO1xZs7xlAeOR1Zr2YfkWMVGeyHsFEPIYCOd+4quY/T3i3rit7D82dIGNoJ+0dB 52tIcdI/Eh9Bio8LLIbzAzvLjpbpDzNd0e04kopNakSKKDav2T95wch X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) 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_|DBBPR04MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: a3c8e11b-850a-4637-b0b9-08dcf837f062 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?QC4T8ujGntK27kXV5rbsLgeb7jjRa2o?= =?utf-8?q?h9fwYjIq9AZjvIGq/mcZpFefzy5GhyU3VvIh6PKwqpdKWPz7EkJvi+E6/QavVYo9a?= =?utf-8?q?cUpflLNz6ocxZ0B7Jyrl/A9aUzMZPXDNMad6nHk3C1iZfHvIPDw7fW5RH2j7qBfX1?= =?utf-8?q?2srrGwaUQG264fnXCdkzXZo2LGSbo1umICofgcXOYznASz8QOqLX25maQLhRLytaA?= =?utf-8?q?3Iq+uuYjPanS2s1NKqHYy16XAWE3PMC4IqvWWqY2AiiG+5p0gEDLB0xzw3cMw9kaZ?= =?utf-8?q?J863eh5CNrwVA8s90yfAs/JY3G7/iOpelgxi1ZSgeP6G3vBGYXZ6Sh19jnuuWzSL3?= =?utf-8?q?abfTJ3EkvLhp+8XbJnDYd9rSRxRVc6UH57So/H+CMjeQL5v8PjCnziLxJYGRx0tRn?= =?utf-8?q?O2tV6SLzWSGS3OgpfnPUE31y3beavZTDk1GAwJUW38D9BGcAXu/YeVBgsBRwnr0dl?= =?utf-8?q?m5F+5yXvyOuYJIbyLJbcIoC1x9Koh/HOZAvMzNAF/2FftxkbRMB01dgFrgYSDYf7g?= =?utf-8?q?jTHD3/MUnjh3QqU8FRacuA//zInO2/GcS99f9lpthcmAnY+Ou2tpaTfdwEoFip28E?= =?utf-8?q?/zwKczgVqqJ2SxYzylA0ecTFZNza/sUtfF5h3MOEIMLkaDJp7EFnySDUhCAOWo1uu?= =?utf-8?q?3typ/wnpYYY3TDjz1kQ/AadN5o+w2KKaiOYg5VE+SnWcD15sgBpDcdKHl6X9aYK3v?= =?utf-8?q?T8Mj3OhnO3Ra1OlyZf6L6RFCzs1Lv9nHRLMlU0WikSL33zzo8R5n7kv1Qf9U8Swz+?= =?utf-8?q?iFJRjvIjZnV6xjJiWbLPLUEV5TrXi3/U4I5chv48BFy7S67o7sakO/xbF067w1ub6?= =?utf-8?q?7yxip0ka9RbUMRJK+PTFf6U0r356QnjXP8uk1Or1Yyxqezh41Q7DI+YowHJVSrluN?= =?utf-8?q?q14XjIBSP0d2L7DECVYwFwYRL2SpbTEgUR8EFa39idusNZO0wcETvmIzoCBcL3N50?= =?utf-8?q?FBkv1UGUW+WKVEfOM+a1mffIpuoML5Il5ALFdy3suahqAPdZ0T1bZNi2LOCxiVdIh?= =?utf-8?q?/PE4awP8g4d5Wb/UIBxZfdCiNX9nsKb5pCYOyxUSjsyo/jS4qxmlRj/3fKgVRHMLG?= =?utf-8?q?VgvCMZdt4Dpp1UaP4i4zjV4OmRqI//M7b3KbbscV7nqjXRitvyUsllzOk4oHmEgd3?= =?utf-8?q?QCTeF7q1U7Q2jhfXxMtXZgRFG1vpdPBiSSSLAUAROgw6Ptas+fZxnL33bZGCnp34S?= =?utf-8?q?eMaQjuNG1gFMB3vEqk11gXJX8TW8Pplbk+xHLLHxJ5VD7gwE7ejAJgYFFVTvj+GJM?= =?utf-8?q?ymozxu2OY05atTuUbUZ7HNFwwYRBQud+8JNVywRZcnSGf+iEqWfDXMojTMkTT2znB?= =?utf-8?q?gB8Ovp/Eez5t?= 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)(1800799024)(366016)(7416014)(52116014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exch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bAgbzymSAPkvE88AlCNDoALTiUs?= =?utf-8?q?NCQUEi/55Wvat1z21INKYCu66Mz4yZh5C+Vyae3qbzYZsdiOryKlqu46d608N0cJ0?= =?utf-8?q?TZZkT32hgfwejAiyh+UiLNG1lz5L/bDBvEgLwxDMYLCi3kE2EGq7JDx7XYfpvu07Q?= =?utf-8?q?ZFZDVzqyFsFkGCWU8F4Q8ekXX4iEfHo3lc2xxTvypxBwL50ArVDX3zd3DMzDbv/KS?= =?utf-8?q?2CpV0GnoEpKLKe4HSo8UiqwGZaqyMo5Pj0HtgZEZs1OxAEXAg+sDSnceABd4jm7d7?= =?utf-8?q?ptZcACvzxonNxFvYkogu/NMm2cqBQ1qjDjEAfa22yK1kkcp6wyipf21OP1kwnM3QG?= =?utf-8?q?T5R9FMcmbZcwwWcjzTXuw4dS3CkCbJPIeGrS1bxpbrmLSJ6vaaJcYLNn9wg4hNpBV?= =?utf-8?q?NWNtAs6Jy7bIGveSUAtc8P3qW8NeX+DJypHvFPzgMIi05NmHDuBtlmeRgsH+uJmG8?= =?utf-8?q?E3WXQfQ+uh+3oH9w1f3Q9s42mSup6aJQgjMhc8pof4gJpHQ45r8LS+PjJSaplizuB?= =?utf-8?q?P4eAI+z/ZLJKtiKXLoiZnSBz2k1IF8uoKL6rXNFbRitrYAduuWA0w72PlnqkLf4U/?= =?utf-8?q?s80wJkfqNTbNiQmbN6JXGDOInRwBNmQjKxtkgOquz6MVwFkL4V1s2nefMR59/+lUW?= =?utf-8?q?SaxTqyQ9VHBFYg0cV/ApFZ9an48V/9xuQ/Jj+RFymN4TEulg8sx/4tQroFwPl12X6?= =?utf-8?q?ASUobgWuI/EF?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3c8e11b-850a-4637-b0b9-08dcf837f062 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:37:12.3294 (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: ooMA0Hj/I63qBY0jcnHG5f9ucnmdZgGpGbkFEA+y9VbwVMOZNE+W4CNMBXIuWYSr0Vi0fcL7Uy8OaZSjeOkSzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7577 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 v7 - 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 Tue Oct 29 16:36:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2003822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=Vw8SfGzD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.199.223; helo=ny.mirrors.kernel.org; envelope-from=linux-pci+bounces-15549-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XdGCv40CRz1xwK for ; Wed, 30 Oct 2024 03:38:35 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AB9241C224C8 for ; Tue, 29 Oct 2024 16:38:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19F5F20604D; Tue, 29 Oct 2024 16:37:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Vw8SfGzD" X-Original-To: linux-pci@vger.kernel.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2074.outbound.protection.outlook.com [40.107.20.74]) (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 BAA3B205AD5; Tue, 29 Oct 2024 16:37:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219842; cv=fail; b=Qg15utxid0od7I6GT7k7nLKcOKjnc5WzwuHvBV2NjRIrYaCd3dR0woC4dz1GbWUYe7uB4SauhTufAKDcc5HTAU45BSNs4n29nZpQOxL1giZj+IApB5KJZ3NUm0z+k2M9kgnuHep97B3Dj8Y1kDW7Xv9da/ll2PkKWft5FUOLfAE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219842; c=relaxed/simple; bh=lrLx8Z8SxZT/oJjco5fJswD/ZWUdBilHEZbhlGAZNXk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=c7B7UHcMaB7zzwgxKOFUusjcSl2+8+72sGZFAx1JwyMNXMfFQwOuY8bbag9uwxd0iImQzsLCDvyo1aHRMePrgPcckdPuvVHFEi7rljuTZ6YnXrU+kVwkIlzW9iBSQ0qAj9srNUFRygutho0LJDclGBtzfpEzd1bX8fjcOWbLsck= 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=Vw8SfGzD; arc=fail smtp.client-ip=40.107.20.74 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dpindFmvBhlBe0ioOH4j4fJVGyJtmGuJNJCRs8+goRnLLIYvumA9Ffcg7z/MwA1A3HANZZN2oi9UCJWif9X9H1Y+ZnumLIditKhbfETycwtu9r/ZKeC/lgJbfI0WAa6NC5N0AC+mL/UMHo+QU5qAXlAUTHxRI+eg9CymeUXgTv2yqjaVym5VqIU0a8o4NO73YknU32lUOzkVXYJVSQT7Rsm/yn7I4twecjSntZEecGeG3z3u0Z/uD/KwkMSjZLYtZ/zKhx0hWRfP3GokGKrA9kiI32MPZnkeIrAv5+75kzbM3ejtkhZzq3mqxSKfEQU9Zp956YbOom/SLFdmaDHk2A== 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=rH+/ieqErUrPjrX69gEMyYnDDWNyEiJyuGTkw/pz68o=; b=jwml2pKyRZFNm1kpLvLVSueLkm3j76A420rq+kNfrqnXJkXDpyg+PX1FDilEGz//L3ABZxNSKMHp9ZsH8VrzBBoM2JiyFsdEEX8NDiZuIl1W1MbuCMqk8Lx58kXrXi5zWlbzcLy4CnXdz2xqKwlT9mQ7nmiT/JdcQr6+jwY1FHBds2RDiOYmbJCBRaMNGkRArI33E0Ioe/jv5vtRBOYm4G4fllSoxzHU0VW4jNvkviiiGpRjohR+WWbnIESW2L9OsXC8nRI1j/UIerxQ4gBmEmyfBHjyBro7yKMcLY4JX3HB9C4eY9S4uqfQ7oEj6OBU5SR6iq74g8FNfOcoLyFdbg== 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=rH+/ieqErUrPjrX69gEMyYnDDWNyEiJyuGTkw/pz68o=; b=Vw8SfGzDGnK1O9XUvG7rqCMaq3A/VnueWFnX5f8xZMSatTxziRo6xhB4PwI/iEDElEWeJIbKS9iQqterOiTVWbOtKCxSa9w9U0krr4ypYMmI2CkSowEiezq5E1aRqWKf+H8vTG7RE+XFfqN0y35bESBpUPJnkNEoc5EDCopwO4ihknA6kn6GNJGxtbxkRTcjPW/LSFSwHybDsQ9BuKTIZ1CeGjF0wr/zHLoWDeYZnl7MZGHB9Vvfy7J1+7M9SeavyTpdNDuDiQAtybG2KwcPZgFD8TrYIxzzPkFt8Qoe8YwwMtWU37RxNhkPySDo6cA+w1QY6QBtUd3NXelHGKJRZw== 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 DBBPR04MB7577.eurprd04.prod.outlook.com (2603:10a6:10:206::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:37: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.027; Tue, 29 Oct 2024 16:37:17 +0000 From: Frank Li Date: Tue, 29 Oct 2024 12:36:39 -0400 Subject: [PATCH v7 6/7] PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() Message-Id: <20241029-pci_fixup_addr-v7-6-8310dc24fb7c@nxp.com> References: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> In-Reply-To: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@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=1730219803; l=1266; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=lrLx8Z8SxZT/oJjco5fJswD/ZWUdBilHEZbhlGAZNXk=; b=c00KuuZdG71AFNsfjgrrDHH6bo9k8MvyBrdD4imApf+17/aizFO9WqyddXoQ2iQWZILpwQFCA SiNNMyuFH0YB0NOmr/OPdMziMPNgryYxb7vlJ+sTTaGZ1cmaPJbkZma X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) 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_|DBBPR04MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: 2147560c-08a7-4bc3-da26-08dcf837f329 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?4BK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GNQ+UnL6sc?= =?utf-8?q?SJLgmbmgfKZEuYhlaYqKmBPgYKi0JNgQj2Rd4iRqQ23Nfm9yCJiWxV0sxZzNvnYau?= =?utf-8?q?mu2KPR2CTMj3l+MUq2P/J+g630FVvhwLmrCEK+jpkMvglhAgmJYwWEBd2JrahlFO9?= =?utf-8?q?uM1XE7+4yTEk1jUpIV/hfOFCO77GmEJEyfFqf+sSgRCWCu19v6FW5ImSLiuDwClLi?= =?utf-8?q?siGFI0IhLEQsIYOx6qAUeICRCtqA+KE6eaBxxSrAvIhUh3l2I4Fa4xRgwTf1u4jrs?= =?utf-8?q?BVe87cWQQzO8miqQmJ9Ev99OSBQA9pD/bwj5LUC5avGWlT5POeF7mIvt3IDnn0yj1?= =?utf-8?q?gwcpihmlvN3fkzTDDnmRH0Y992tMY2QIGPmKmUk91Fftmy2zTt7ySVIIAAr+zYfMU?= =?utf-8?q?HS3sv5nnnogZK2zNlvKWC3XP6rHUixMxuyBUmaP0Zjc0QdeBipPTDyXMmj7fA3fWk?= =?utf-8?q?Uct+LP3Aur9B?= 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)(1800799024)(366016)(7416014)(52116014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?lC3Mr42UJQWxfrVuPfR3b531Ho/U?= =?utf-8?q?o2qsN+L8Ov5NjkCbbM8N9I5qYXPNE7HpQA2316keU+pwHy7uU8Wn46fQ/OULB/yKh?= =?utf-8?q?O36xvxkBCPiSIWJmRpVqY4UHkhgbwT2QiME661xxgM4gKu48lI8D2d63vh97XMuKH?= =?utf-8?q?BKtRbx2xLO05CUlE1aC7yDx2nrBz7d1YHv3Yuros59P8R7kYoT9NgFYbSyt6Pl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7hQft?= =?utf-8?q?ApB69VjjT0+bgYWg8hDF3Wd9T6SXSC++49K/O4zecoWGImwRvyG1hsxY1r16R+NfN?= =?utf-8?q?Vm8BW0NYDTJbFyIV38m+LBox2RWqSdgior0w33aAa6GIlDtIZRAe9WIAM09M9wYPk?= =?utf-8?q?RejAHbvoAxZH9ZJvJZ0Y5LgdWa9jn4d4HByYLKwAQdz65lcpiB9UfRNWYjbIJWIv7?= =?utf-8?q?WSiTdDvQD4dzTIDf/JtW38NrqKdjqWmZNGJ4tejRamAqElQOovV6eIwirZxvvwE/z?= =?utf-8?q?lLSdtOlSm/FH6peA1OXHfnE+U7uXAsDLpzvyKGTvtyQky6LKlDynBCrh6/Aj1LI2J?= =?utf-8?q?7IR1MfD4PbvpUbNqY28RJ7zz16qzNaD1KE3BVddUl5CeSev6Uy5/sNYDJJT8n7H/r?= =?utf-8?q?QfgVT15beHpyWJXTMbZfvTZ+s63WdY9jHnnjXSFt4DqRR7eKGpx31Iz/wgJJZWlXs?= =?utf-8?q?jye+LBmWCMHu?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2147560c-08a7-4bc3-da26-08dcf837f329 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:37:17.1292 (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: otaB2Zp4WQOoW+y9BqzNW3i79gnu3skGBNxiPKGXjh/zm0QS9B+aD1FitXE/6Im9l7ObNyFqL6jOH0toMYxrwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7577 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->v7 - 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 Tue Oct 29 16:36:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2003823 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=RogeAcJ1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-pci+bounces-15550-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XdGDB57NYz1xwK for ; Wed, 30 Oct 2024 03:38:50 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 81E571C2272E for ; Tue, 29 Oct 2024 16:38:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C62A206E8C; Tue, 29 Oct 2024 16:37:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="RogeAcJ1" X-Original-To: linux-pci@vger.kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2053.outbound.protection.outlook.com [40.107.249.53]) (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 CDC16206E67; Tue, 29 Oct 2024 16:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219847; cv=fail; b=TiVFNqsIlXBQm94Ulz1RK+wYxdguz/4V7y3VsSv045/6H5u2kA5oSd4JlgIgvy8raTM0Yps4b1uQKDF/KczPlRVWxBeqixjfWQ8RmtzNJaHeQm72tlBRqH5uakDjw4MbdjUzT49lDhx2fmLkN0P7m4nvWHpzvObtPpTqgfrlX2Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219847; c=relaxed/simple; bh=ixQDYJyXuHUmAmlzLRMBWxuvNvNweOl8KqjaI6bcV3U=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=c/XDYB2MqcHoiLRSIaacErwHqwshZVaPI51wOi6gdLuq146Rl1P9PMcQP52qkWxyga/PvcM7vY7e1XRrGSKAgLLzOek1+OxD42laNPEqODUyd7MLD0OKDxLS1ORUbSf7oSLNfFoNTIXncws6mbBUGk7bVwKKEUIifRsmAF3GZPc= 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=RogeAcJ1; arc=fail smtp.client-ip=40.107.249.53 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vjjUZEtdarYuod/5WDJaUVGKwdlkVZJCPcn/qHnHMzF6abaq0Db9F2EedvLD6xHzLPpdzkk2DtlLrLNjOd+ZjPfZTXwigHbNa3o08/9OcoHxZAoABOknJNQ+8RyU9GWpB/XeT/eB4d09gk4XH/nBTwPSeAR7L/rZ7IN4iZTfEgQ3/1jsj/TCm35FRc5/DkskbbVc9KRyVf2+aNkPD1xKpIvV1sHihxv6F9OzQIA6/dsp7uvYcoVnqWngn28wDP7d+08qxxqAqTbFKV3V52KiMfnCRkeF7vNNrICss5epnz7/IkmYUUSXUiA48NUrElJY9Cjfdf28PiWmGO2zeeN2EQ== 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=mAK1jmuAtg0H2cjB9iC8wvlwe8xRsTxVgM94PH4fUfU=; b=g4mzzs1wEUbIwKBzN+IfK95/zhyNQUCJzU0bK2JNyyOSw8plLUpy29E0WGE6G7NnLI7icPVgrPtTm8RyMBdQiw+ac20Id84q5hcBYaimwrRWEpMZCp1FRF3E8KwNhXA772OSwij5USJZHy6rEX34ZZyn/2d8B/DwvQe5YpA+szgLH6TOAutWnfiEYQbDBAImvSiLqSdlp8nhKgr35K2x5uDTUjdHydriKLSdcpTJN5ScHWwpCOMNAzIGE37T7vXdcOM6wdJqKyWfFU2xHPyVfpdp78kMR/Jp+lenJSdnHsr7W0fNGOHoeUZe2aFBkjaNzh99C4d35xDWXXnPSUeJCQ== 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=mAK1jmuAtg0H2cjB9iC8wvlwe8xRsTxVgM94PH4fUfU=; b=RogeAcJ1TjXit+FtFRWMnBe/E4AY302awcPm08U4wVDm+CppqQcbkSPHAlU6debBV1Y9zvPhKSQcbGg8wq3e7/gK+/Nc5lHEY08kKJOaw07ZDqhX1MRhQYHIEoOifhrYfe6LHGYT278JwLTHwVhBnN9hrnwt8wbKCHBSTIrfbrNCEV+iH4M4s4heNzo3lNInLQgyCcXBIZMPPAP+MnI1Xf+pllgTFOWlhJMKMJiYz4Y+ruO+mwTz4e0Zj9T7Gj6+ahM1Vabq1eElCbEiZN5rw/C+Cw5N6d58RX2gGSMQkbIg1LNfjSjuiG+9N5KHRSBZvKCjcQBhmMG2i/KrNDz1jA== 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 DBBPR04MB7577.eurprd04.prod.outlook.com (2603:10a6:10:206::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:37:22 +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.027; Tue, 29 Oct 2024 16:37:22 +0000 From: Frank Li Date: Tue, 29 Oct 2024 12:36:40 -0400 Subject: [PATCH v7 7/7] PCI: imx6: Add i.MX8Q PCIe Endpoint (EP) support Message-Id: <20241029-pci_fixup_addr-v7-7-8310dc24fb7c@nxp.com> References: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> In-Reply-To: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@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=1730219803; l=2548; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=ixQDYJyXuHUmAmlzLRMBWxuvNvNweOl8KqjaI6bcV3U=; b=ZR6A8qNeIAYIe8Ph71ciCpzXbLqQYWQXs8YoteOpdZhXLGpAGhyXH345js0CyOgwJBiejt6K0 d9zLkq/wclsDnlAUIFVLSq+dWJTJAnmwfeKWhZ76wQ8E2vJlQnGjfoK X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) 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_|DBBPR04MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: 1606a36f-a823-4388-7cbe-08dcf837f612 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?dgV72XZ9tA1jlDLkPDIqEYVUuwaZQhV?= =?utf-8?q?MAVXRiu+grdT/5gbFBg5s6K3GfYSKzHdffNU+YGQnehtmjcaD4cfZlyX5aBKbUIuz?= =?utf-8?q?wEWzW8WKX7KXdKkO90oYbOKF0m/lpl34YZ33dgCfCbOgIO/J0jZqBa/dYEv61uDCJ?= =?utf-8?q?/c7Aa/mWNQmmVyD2F5JLJg/4xLjpjy3gg7Wn9O8zx/ameuexKcytLdIS0RPmtWBte?= =?utf-8?q?tWtrfCsg/kFPhSdEJ/P2wggcYK4bjwLlEURYXF/9Dexso/GFXg8XxT66XNG3NyoqZ?= =?utf-8?q?g0dQLLf0C2PsVAdvW/IIjj5kNyxkE5GhyzhRyWF/VPSUUqFI6q3kXVQIo3MgkjtLe?= =?utf-8?q?wVcjcC+hbDhHq8zuRo23Tvi1atrvTYsz6NP225NoxqtbJFkatjtk3ZRktbZbLhE1Y?= =?utf-8?q?wdDnRiu6oIyM/RDCosP8A/yP/YccMlTsfhYp8Z4ZSVai31mksDrMv94Vli2zUBdir?= =?utf-8?q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EfflJ?= 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)(1800799024)(366016)(7416014)(52116014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?S5LhGJ53PAdHntbZHzHvlVMpL5Iv?= =?utf-8?q?GHezsBoLikUEkz8j/BsxV/XPUUJG915eQQs2avZWE++T67yA6AW3Q89EBShaRXLM9?= =?utf-8?q?qPsKpiwsRs33cfoYkgWmaMvlrMsVgS8vgYy3PWDIAqcxyXHMKiPAN6ub9jhv2W1fI?= =?utf-8?q?OJwXJbpovik8ootKap+1+i9ix30JaeN/7KGD/H4Gl8NGy1E1CzuaSN3aItUAWye79?= =?utf-8?q?KnGSmJ9Sx+gFeW9K0dh4GPWrpc0g4yvs5b438astaxMnlA/IJx35kfzo5CawAAz7k?= =?utf-8?q?sMSAXOZ8rkY8CL3sV/ce0/1HKbeOqyA5oPtl0t1G+6AhwTAhDVFhuAxAh/sZoeJkD?= =?utf-8?q?WUWp/dCpEkIxPMQvtXMNTgn0l2zro/RmpD0KD8a1LI/HuYEd+GBjF/usC1CNRZ+4A?= =?utf-8?q?1ct73vxdXtA3jEZaqXU2S+GCkxpZjFQeTtMzvvh71VKGJdD3aBC8s9sokveT6NAnc?= =?utf-8?q?6NFPJaicwsBAzFMIRyZpXi9pjAQFruj6r7g2XC00efy514A1DmwSFBz9Yn8DjXcP3?= =?utf-8?q?vnHNmSbUJr8FW9DRyLK3nfRC03/5nFvPcK6Bmtyt+V3P05nHEA6toKlv/QBNipjrH?= =?utf-8?q?2C9Yh0JgDm2D+3YGbxSlUfEMSAJN9yf0/kDEcX2pthPT1c2kq/uXQzuOkdr2o67aw?= =?utf-8?q?R878SXxis69X6edKXlmayMwruYr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nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1606a36f-a823-4388-7cbe-08dcf837f612 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:37:21.9389 (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: XNdJ3e5DblFkhIQSATpwjcg+vxhj00ZALCMQ18ngz3vWmZYEprdD6KbzSwuKAOYDSum6HewaVY9O20TtkmP+TQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7577 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 v7 - 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], }, {}, };