From patchwork Mon Oct 21 20:07: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: 13844613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8CFD5D1712F for ; Mon, 21 Oct 2024 20:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3Bk7q8jaB5ypFH4kg7DtQLBpo4spagjA9PptU/sPGm0=; b=RuMCJ2UdbW+M9XIWGVz7GQGMgb ypjjMOXFyCjMenXFLKVjzyjzTA9RogugjH0W4ogUYYg+LVdDOv+L1vfCZVAcipO7ux+KaHaE/nG6h VS3yXuNb9dzuCd+NQMbYCBp6qaKgB0FCWdx0iswYAT3YmzdENLOZmfSwke5H6uDpSw+K8sWCMeBWS +sJZQlc2PAUfGi7P54Qi96ExXeR3rHV8CZf4bwXcm+orvVjQlVw9hpFZ7USXPnMd/FoXlf8z+3/7m aZeSsvuBFs7zo6U+xIgARS2dZyictPeCd55LhdOW0EDAkHg/kQDYjzhUt4m/0pmhyzZ1xwvz5Grtu w9QQh0Ag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2yk1-00000008Y42-1zFH; Mon, 21 Oct 2024 20:11:01 +0000 Received: from mail-dbaeur03on2060b.outbound.protection.outlook.com ([2a01:111:f403:260d::60b] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2yh2-00000008XSY-24MM for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 20:07:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KfWAs6+M+oErTg3vqx92HCqpnf2hhuk0qF13zMI7UEdQV/e8t9zK5K46jLOVgu/GPM/fxu9B1tRFOThq2Sww/2xsbnXUErPeK71ksV2xy7SOtw+7rcHhb1Butlj1hEITIojy1b/d0sAXcaNZZo3tPXHG3As0LtGjp5hN74PUq4fQI200wRgoHu2BzfL1u73/HQeS6+XopbPxScaL7FGSiavZ899eMls+Eio3zM7dsSdTmF5HwmIDnf59JMmX/e6C+vtbwVA7rWZX4JcV5GcVSzxp0893oHalnepM015gZfDJJNO8A5Qc2EvJR6O78IT1lOrMgeXAH/tpKIWwbAw1YA== 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=3Bk7q8jaB5ypFH4kg7DtQLBpo4spagjA9PptU/sPGm0=; b=TvEfiZwoLCMPaAE8WpUc2VZK2NHiM7eOW+p2SZf1kTbW/hVN6zJQVPW4/KtEJjU7iu1S6B2QPQhsudY/NYcQ98WKBqo2xuwjQKeXPQtFDAbcLpq6PnOdmuqGzDGGDyrJtrahZrrtWazBE3NVuzynFSFHSdo9cTmLTcZ6efOsI7Mtts55KhM9WYBKCt0vw5K0WPlqJAdJJLFdtzbDGXfDgINQU/CJKSPTitDyWK11iJx/hup/sNSa4TRjM37oZAHIWkCdbso5YDEZjFoRZQ9TS4Z6ckhdpO6D2lFqp/RS5A7g7VzLqtQs6pxQBs0MOsV3NofkqsUt3IkMEv0c6fQcow== 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=3Bk7q8jaB5ypFH4kg7DtQLBpo4spagjA9PptU/sPGm0=; b=M8IB0YX8v1nQuoBFCe1mAPduB5iEXeRIq60fESldaO9hLUmyBKIFcqHyY6FNtMUHzX7rCh+J5R3ZQJoyyH62p5RUlAe16Jru1noGJrizpPNGHFlZfYRi151iKnf5dz8QXasmNJUsx6hNF4YsNhRtOsr5PpyetMDas+0QC3zh0G4qyDwzMXV6cSnNWZzMRR+qUEmB+JvL/vmQvYqEO5SGUBfA4/ccmVS1tOvbS3Ji3vIRkVTAT1TpCk+qPs3N60U/3CfLNUSuwoH5OGHelmv30u8BVjpQB2EasGSaihh2r+1sGkkQu95RjbDaKuVSXbbNl8QhECBa1USX8Any1BuQtg== 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 AM0PR04MB6882.eurprd04.prod.outlook.com (2603:10a6:208:184::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 20:07:52 +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.8069.024; Mon, 21 Oct 2024 20:07:52 +0000 From: Frank Li Date: Mon, 21 Oct 2024 16:07:36 -0400 Subject: [PATCH v3 1/4] PCI: dwc: ep: Add bus_addr_base for outbound window Message-Id: <20241021-pcie_ep_range-v3-1-b13526eb0089@nxp.com> References: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> In-Reply-To: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Abraham I , Saravana Kannan , Jingoo Han , Gustavo Pimentel , Jesper Nilsson , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@axis.com, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, =?utf-8?q?Krzys?= =?utf-8?q?ztof_Wilczy=C5=84ski?= , Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729541264; l=6071; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=z/qjOkp5hDUbKkPREBnGFcyAmTYIDRDWM3qKhQ4IVc8=; b=NB9QyP5FD+su171LzohM4TyXh/YDwW3sB1H/1vi82nQ6RRL5v8bUUFioIfVQ1pFn4ddhsOtSz uWCtPSYEejgDd/4ZJ7AQc0V9raeQ+4gaBmkL5dSA5Xd1GmrWNQJLxdy X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR13CA0071.namprd13.prod.outlook.com (2603:10b6:806:23::16) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB6882:EE_ X-MS-Office365-Filtering-Correlation-Id: b262bce4-4927-4c3d-2e68-08dcf20c0b19 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?BYHQx90oJFhzNvGjvvU7G0mMX3YDFhr?= =?utf-8?q?BjteVFkcLbjXOwSbM25wVbGamCMHlkzD6fZZw83nRdY/LGDwURWzJCMYfYvxarvBm?= =?utf-8?q?pWdi/bbAwWOhC6F9W506TAW4ZzBTf8gIjPRkbiFeEXtJaCnYf2HkVcEzt0M6FniDn?= =?utf-8?q?JMYRr5c6oM3MkQGmCzkLuhtOGFB2V7eFG7thR5LNROVLBsZycxlfAhHVx3tugJWD5?= =?utf-8?q?nVDHgA79xOrcL3gKxn29i6PRZgFRl5XC+u8Dj1nXnEviUvKXv+VKpStvuA2PG3khA?= =?utf-8?q?D8z3LJHwYU/ZClQpw3/NmC5AGGIqxLq+cpCKfaTtk64T7alTRpWzyAyVNtC9bV0Rr?= =?utf-8?q?tj/lC92nHaCrur2/QyAIq3Cdt/rTBCf0Xvd/scjIyWW8F4uWyN8r2N3kfDRvtdHLg?= =?utf-8?q?vIS8NOlIyOYELJBfup+TtkuZtp5XKQdSK0kYeuYioxHgXcQjIBgxTX/aodBQDKK5J?= =?utf-8?q?0aL0hptt/59gl/IcveR/1iOpNq1w+PzuWWiU/ewwuoadVKhRngeoQiekWOfQuR+W2?= =?utf-8?q?7YbG2VZ5YnMqIVmoGzd/X+75pEQce4tagvd0aMCQ8JzyKA+RpPgZJKMX2qeKdF1nj?= =?utf-8?q?XSG2RtIsjhWAthDmm608MLcabSS6GjAsZxEEiW8ukkDNlgc8gN/Yg5gMdNMMrzKga?= =?utf-8?q?cvB08Jn2AZutQ2iQNCnXXR/xSOcnDrwuHczoZQFSXmv5Ink4zC/A8n6Bx5wcgikWl?= =?utf-8?q?Nkue4CX3p7u10ZsD24Sm25I+/w2YZo3tKxCanWHQJSocCaOQjgpzCbiaSvPQ6+ZAz?= =?utf-8?q?WY+NGDRgEh+uYtA0Qwgusi9TzM2sdjay6ewWFQPoarYgM7UpWvt2s5tgRtf9DOsvd?= =?utf-8?q?luEr9ZQ/ugE0bFZgEU9PFip8M5ixxJFrjZbixqlbLhH/aVd1hSAsc0eqv0WbOJ+ei?= =?utf-8?q?b/xvY0v5eRBXpXz9UJ/BpLlds/ps9o75IWwjRplsAYT0JKH3q5yxpJpn/CCZOwye+?= =?utf-8?q?ffv+5OGmPAFoWQbWEFiwC9dN8ZVZr4CzJyWgctRMfjhaNqW0e5MyrSNYoIqgMKa7u?= =?utf-8?q?TGTDnB9GWaO4vkP4p4iKPm8/Odqno2Z6QgVVnUmox+dHrFTiAYksPpbi+qvrMdwOM?= =?utf-8?q?/lvHuSv+4OEoaTF06n6E9NuzKuVA5tT4oaBi15mpB67vlpxzJ5GLKAZCZGJ3yhqQa?= =?utf-8?q?17o34zGV8MmBjTaha9QAEuUuchoGkDCTRbscafV1Jv7pNTggOuUzm9we7BmFZjC5w?= =?utf-8?q?ui6EtsDAhhJfjSF0aiovdi1E0Yj0SJUVCBj+iUQAS0qbo/F+R6qVjsd2rgAofBC+/?= =?utf-8?q?bHhd1xCuEaOEPsi5MSpppsCfu7Ykugb/pfDKZV4hE1Voar60CeT6zMXIGpC1McAl4?= =?utf-8?q?Dkz+xlcD2rYq?= 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)(366016)(7416014)(52116014)(376014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?OrWMeWHKilbOvi1DUd7G50t7O6Ax?= =?utf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=?utf-8?q?N5XUyN6egj/I3GUhwioBsLngI3jWeLaQUmMs1OIAAm51sS0zET4da219Y6yvpxjvh?= =?utf-8?q?JcWKw1sPosuLyNZiGEwj8y31E2kJ1PdzwNJqWxTAsDnr9uygIJFHySjSfD6RHA8U6?= =?utf-8?q?F9boVOgbIplDe++Zyja4UNlSeVi2E2HbxfMROS1tZnrwFO2IyU8dOnvZjdzcfp/Px?= =?utf-8?q?VnHsdJhNIiSKe9ZU9OpBz3WRxIdwWCqq1oOgoRpLA5uv//EgH3Xb2wHCToEcw4msI?= =?utf-8?q?N8O2vA32eOChBFhnmAlcV6fwP4ok4Jmtnb1aHI+1rue9Lb+9hN9uwKeQlH8yZB9ez?= =?utf-8?q?z79PCQ5PmrPiV5q3DfcxcWrYrg6Qj7LsfS/bbsGHywOAiPu3p4xDY+pj6i3q/cQwf?= =?utf-8?q?WVeRZCBpBQQrs/OP2OPzoRmS9xGQJvwEGh80GuQThSDDsWWl4vMT+fPAQF1lsJgrW?= =?utf-8?q?i7FhfTY3PktFD2Feai5IHLFNlEXBj/x5GW/Oq374CJMrAf9UMhtx8Gi7TA8Gmh+Vo?= =?utf-8?q?NtyWFpj/2lxUU5mCTrGz1a3IsDVhDIA6J0pNC/MGCBXK1uASu5zNndWBxGVLnUfsd?= =?utf-8?q?bhA1b3vcp7ePKz36RPz1YBOKYGhFCaM2GXI+Z82Z2f5AKwtMSUr2jEn4KbtN0FfHb?= =?utf-8?q?2mACO/gRkJ23?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b262bce4-4927-4c3d-2e68-08dcf20c0b19 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 20:07:52.0156 (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: cnibLKj8M7lRn/IX/PC/LWtI0rA07Zzpj/XcP5AnQDxHvmhsCtZ9R/HY/wbHn0P52hToJb+DhEV5+LoHHpjRBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6882 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_130756_709487_7D955E2D X-CRM114-Status: GOOD ( 16.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Endpoint Root complex ┌───────┐ ┌─────────┐ ┌─────┐ │ EP │ │ │ ┌─────┐ │ │ │ Ctrl │ │ │ │ CPU │ │ DDR │ │ │ │ ┌────┐ │ └──┬──┘ │ │◄──────┼─ATU ◄─┼────────┼─┤BarN│◄─┼─────────┘ │ │ │ │ │ └────┘ │ Outbound Transfer └─────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ Inbound Transfer │ │ │ │ ┌──▼──┐ ┌───────┐ │ │ │ ┌───────┼─────►│DDR │ │ │ 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 = <0x5f010000 0x00010000>, <0x80000000 0x10000000>; reg-names = "dbi", "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 v2 to v3 - Add using_dtbus_info to control if use device tree bus ranges information. --- drivers/pci/controller/dwc/pcie-designware-ep.c | 14 +++++++++++++- drivers/pci/controller/dwc/pcie-designware.h | 9 +++++++++ 2 files changed, 22 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..81b4057befa62 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,16 @@ 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; + + 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 347ab74ac35aa..e22d32b5a5f19 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; + phys_addr_t bus_addr_base; size_t addr_size; size_t page_size; u8 bar_to_atu[PCI_STD_NUM_BARS]; @@ -463,6 +464,14 @@ struct dw_pcie { struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS]; struct gpio_desc *pe_rst; bool suspended; + /* + * Use device tree 'ranges' property of bus node instead using + * cpu_addr_fixup(). Some old platform dts 'ranges' in bus node may not + * reflect real hardware's behavior. In case break these platform back + * compatibility, add below flags. Set it true if dts already correct + * indicate bus fabric address convert. + */ + bool using_dtbus_info; }; #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp) From patchwork Mon Oct 21 20:07: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: 13844634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF6F2D1712F for ; Mon, 21 Oct 2024 20:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EySDpmn2t3TBrfXQwsbftUWGKwgsxNSHHulyrBuHokE=; b=pDpYHcchZb8wgu38OosBuLPVcn GsLy3EeKUIHTI+ugD1w1POu1vkwuVdWvv4zVdbVPnefdl99m7lJ1+Gi2kDU1pvD4v7gOuajta/mMU hWBr6hfveHV+4/X8jCoQz5QdlbLTn9OEHdj4jtb1yRqlDac89onex6hxtCx1HjDxfMcGFbKzJFZxr UywcqcF0xLvdRFO5zRktkd+heRJ9+daPaTdXvQhLLvTd3rF1aU0lZmNLdFYKBmQ+tYHMdbinhkrXN w0dEa7dcyfRlDOCSMY3cuywR3bFyhgoZberCzFJnSAWlzJcKRq9QrtKEOgK+BIjdgAcW8Asb1nvCC GWT4eIrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2ylZ-00000008YWp-0yYB; Mon, 21 Oct 2024 20:12:37 +0000 Received: from mail-dbaeur03on2060b.outbound.protection.outlook.com ([2a01:111:f403:260d::60b] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2yh4-00000008XSY-1cVV for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 20:07:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=htzpOipjuoybDnmdpjyJ5WqTwZP8wNA6DjctnBcwHXItQLH7RzovUrnraTqzpCbixAQKLD3zzp5OBr6o1xhG16OpvikottXZOANnSL8iRbTWaPEfUEKjoh0eWDSbNVjfe+dr/AWIevyjW/t4PkgZESAL3oUp2wFaES1QZiubjy8qiDIZ9cJqinMFuyg/XXO7mYyt0gQJ+bu3PbiyHZrjcGWsR8DaerTXNRQ1unEBTsinC8L6Gomsg2eivzuEWJFChggxTHmlJd96XgHTNtyvXKe+k6kTERequNO4FlRolQ+uUA8817hAT4bTJPyNG/ZuZnslJDW0btg6Z9nJCfHJjw== 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=EySDpmn2t3TBrfXQwsbftUWGKwgsxNSHHulyrBuHokE=; b=d6CgXM6wCCmmpsPluvCbk7ZdKTygSH2qRaxtA3NzsBALfG64tzqb9RLi+2mTZcW1hwOA7tw+EudOxzSk5DZlnikgM7ZD2b1W/Lunt1wHYqdQY5j5byyUqZfLd94TYnMdJ2z3YRJVXWnw5rtc11Lhs3UQpvVTQjwXZdQQeLyLc2N3gMnX7dcgtTzZp8GRHfBwDHEnZ4vxze2WhcgS4JF7ZsvXlYAdKkUW8WD+E2EItX2AfHX27GZpRHmPgGP+ndlHtbd4gWGPoAe6Y3eROR+b4B/7LPCwV9B9lWMcLR9cdWvsRCiDZ+DzSBkvjWmnIu1sJF9YMk+e3HjpwYlCUQROoA== 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=EySDpmn2t3TBrfXQwsbftUWGKwgsxNSHHulyrBuHokE=; b=fmDkrPlo95SDBnZ/YvSW8mFSpr/aQ0jkCbhXCU79iHz/kYptPBmg72DEsulGXFzRsLQ+2rVWzBxUn0GQXjAPdM30kVD05/OV3Ox1QI2gMoHAQnACfougoah4hN4OHgTAOXvnJQPx3Pbn/0bCU0QtJz6968Bnj9ItdZ2y1RHPJKl+ryoVc4BnRueMG2fsbyIxj5ano+P7x49V7viRmog9mr3OO7BhCXyBZDzTN2IIGbR8GsBpDA4ndJmrTrjnnv6tpVg78qtGZK6w8TQRTXeKevh76d+fDFiB2kWAl9ky1BpG/YI4xjLRrIAUHT6o7ktZkhVaqJuoa6qhOSUbtp0xOA== 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 AM0PR04MB6882.eurprd04.prod.outlook.com (2603:10a6:208:184::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 20:07:56 +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.8069.024; Mon, 21 Oct 2024 20:07:56 +0000 From: Frank Li Date: Mon, 21 Oct 2024 16:07:37 -0400 Subject: [PATCH v3 2/4] dt-bindings: PCI: fsl,imx6q-pcie-ep: Add compatible string fsl,imx8q-pcie-ep Message-Id: <20241021-pcie_ep_range-v3-2-b13526eb0089@nxp.com> References: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> In-Reply-To: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Abraham I , Saravana Kannan , Jingoo Han , Gustavo Pimentel , Jesper Nilsson , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@axis.com, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, =?utf-8?q?Krzys?= =?utf-8?q?ztof_Wilczy=C5=84ski?= , Frank Li , Conor Dooley X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729541264; l=2164; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=xOwP7kvEkIrcZ/CeDAklFFYJhRHhXZJV3LaiInaRPbU=; b=a1F5rE324OXu6nIVpdYsQC3wLw9VVPumrDbJJDApNRRNYYO7OkvDqaBE5k3q5BRt9UBEph2eG zmU6UvskXRNA2f6u51O2SwloFlCNOcO1zj6M1kDIF2g6w1gcW+yYsxI X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR13CA0071.namprd13.prod.outlook.com (2603:10b6:806:23::16) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB6882:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e69eb12-e2ea-4c73-4655-08dcf20c0d7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8DlvC56fdpARtK43GvY0Jsk3ZlCGHt5?= =?utf-8?q?EIhgnTlF2yqJtals1FuTJ0FI6EXat5C/26PuaMz4a1Z8zAiotTQodk9opI3l/xoDr?= =?utf-8?q?v04Dt6U+biOxF63k53PPYyosnIwFsGyV+ItIACdjrSI8uckteK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jNZUTtVbD7FzJT?= =?utf-8?q?/Mx5z+zz94l3Gay9yiQr1CCeQRgHhKpaRAt3syxh//oPL3fy9q/JSSZD+jAi6nH9X?= =?utf-8?q?87ixis55IizZqmaVyhncn5WISYyRvlKNS2zN4JTOg/DWZaxga28UiaB0tcqwKFWGa?= =?utf-8?q?l0Sgg2iQ/3ejx1x+Bf6rszNonGNEOo+ac/o2vtqgqU88+MKFoZH/h3lJPk/c4n3Tv?= =?utf-8?q?AGCyVtDw1C75QuoS+j9NbrRUxFOPgKFkDSB58neisnSxT5g3lHRIo2AElFoJmjyXj?= =?utf-8?q?Tl1i+hoQYXQQ2j+jgkUUThWCWbcwv/TEgZxlM45q9bh2kYgm633xFQsIIjd+bolDE?= =?utf-8?q?FOHmnKtuGwbh?= 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)(366016)(7416014)(52116014)(376014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?XlDytFyJ0K3ZH78+TOrFLtyBAlII?= =?utf-8?q?UgAeY2fZ+s98KSsHusKtzr6gvYAzQKvyMnG/uWOTyItH9/PFmMBqrNuakbO0qVeTR?= =?utf-8?q?RX6yPJiXyr0ne4DqlnOm1FuAGjHRmV+MQ1i2pwQ/EXE6sux9MkR/9PxNBgkV9P7BW?= =?utf-8?q?zC6EtCO6u8ROrPs5opA/BEuncPOc1C5vpHjb/nodsJEbpbIc8vLOsjR/OE9bdAhzS?= =?utf-8?q?wzPBz6Tjo8BHBSZAuof3TqUhCmhyaSrEpKdpU66ZddoM8jhgpZF8oSydG6onOQi36?= =?utf-8?q?HU7g4Pp0NL31cSjR1e57o3xjF66yElead5VbD04iLWh3pX9W6WwfL6vwA16ntYMHs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f-8?q?7nr9WM3Ef4gBGJUGtxve8745vVSPIjtbG2cmXY9TZHARmB5JZFLpjbqLu6GWtkLBT?= =?utf-8?q?lj2cwuR8wIJSn+zK0HR8l9jKvkKbMdF1aNzsp2MfuR8repjUpb1gLJm1Z59s1P7tX?= =?utf-8?q?WaDdoKkoz/c8Y3qFkKIoMSW1cM8g7NlbfCwkTD1f0RjjY84pNhjWI/Rko52DlTFX/?= =?utf-8?q?+thV4sH4Sdv/z9A4OOhc3uEvV7ePMfWhqyZvhyPJhZH65I9POiuoab42rphRDR/IQ?= =?utf-8?q?Af8vl9bnqTuBhGf99x7/MQ2Jsh/Yahl+MURY7rtMkM/xnoMTw7IGj2iaVJmDf8KzJ?= =?utf-8?q?GXiSWP1hl8By?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e69eb12-e2ea-4c73-4655-08dcf20c0d7c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 20:07:56.0226 (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: lGWx2+F0FVMQQTDOTwh+HGlD8OemZDvY9sO363MvPEKmg60iVdqIv6WVrniKOeHw1Wl4coENR60Hc+WdvFqrlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6882 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_130758_468572_0DD486DB X-CRM114-Status: UNSURE ( 9.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- .../devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml index 84ca12e8b25be..7bd00faa1f2c3 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml @@ -22,6 +22,7 @@ properties: - fsl,imx8mm-pcie-ep - fsl,imx8mq-pcie-ep - fsl,imx8mp-pcie-ep + - fsl,imx8q-pcie-ep - fsl,imx95-pcie-ep clocks: @@ -74,6 +75,20 @@ allOf: - const: dbi2 - const: atu + - if: + properties: + compatible: + enum: + - fsl,imx8q-pcie-ep + then: + properties: + reg: + maxItems: 2 + reg-names: + items: + - const: dbi + - const: addr_space + - if: properties: compatible: @@ -109,7 +124,14 @@ allOf: - const: pcie_bus - const: pcie_phy - const: pcie_aux - else: + + - if: + properties: + compatible: + enum: + - fsl,imx8mm-pcie-ep + - fsl,imx8mp-pcie-ep + then: properties: clocks: maxItems: 3 @@ -119,6 +141,20 @@ allOf: - const: pcie_bus - const: pcie_aux + - if: + properties: + compatible: + enum: + - fsl,imxq-pcie-ep + then: + properties: + clocks: + maxItems: 3 + clock-names: + items: + - const: dbi + - const: mstr + - const: slv unevaluatedProperties: false From patchwork Mon Oct 21 20:07: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: 13844635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35394D17130 for ; Mon, 21 Oct 2024 20:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=84RI+077QT0IyR3qvihpandZLg8yhI+5Vnaa39qgDFs=; b=o6wOgTjWqXtCpYl35QvaX1FMMf Hnzx/J8legbgbtXblJ1rLU3ZyCjvC2qJaElCnUyWnIQAfX9KwXf9wFoYH3dhSm88KRyeHzAUhv6k8 Z/kUNYX3uRoPIZsQNKGRxrJ/orGM4+hH9XT40NfBrTazt0MOLYvWwr8I52YxrXaA4gq7UmFQ7PGns VODVtMt45cK6kwX0nhZKsBStvE1HphsqHpMVLBSxUkfFz/IpM0MFmyx3BiyRZQ1ULx3rBLdLpTJZn gmgjjPChaG042cbEjpO6wn9imP0IGaGVPHUaoo+kCko33gck0Npgv5Eo/4Tbw6flyaYKArpmRFZUD QcTrMSfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2yn2-00000008YpP-3MiY; Mon, 21 Oct 2024 20:14:08 +0000 Received: from mail-am6eur05on20614.outbound.protection.outlook.com ([2a01:111:f403:2612::614] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2yh9-00000008XUP-1Qvb for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 20:08:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mWgbOVLkoy/f/kgr0RKQdmQsJ2p+vJqraVRPP9bySc67bhLqQv154lXZhrQUSFS0YLMzdAC1iVnaqRPJcBHeQ/40dWZGWXT/+Y2pCWSI3v3hhGycL/LraZU1BpYWbrhIfhU61l1mQ1yR+L/DkKDsvIjTB007avrt/Bs+F6mg4cB9WtyqVAr3dfNCrpP0RlNNOrkatXkpoA+qKYQjACpwfe806jOOwFMbCxmCkN7/+oLzWWvx2tiCRZhQN1lMCwxsG6lMCDuiDVsKRfonuBwj7qaHuQQ0n6N6kI/dLF4XRN1VSR7xGOxPAz8yF2SwzrQNtHz/f2dkQREO6nIHFEBKIw== 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=84RI+077QT0IyR3qvihpandZLg8yhI+5Vnaa39qgDFs=; b=sdbjTRUkPYmfpJIhZQX4RB7W+cSVYjDvcbTUOD4AAJpsNjEmvGUnKeP3fr6gmXeOfI95asOOGrq83fuvshLjaPa0ezJuQeCLzfPIJ83a3qlnR8idvQn84kLVo00J4LZq/ZVNzbYHqtDwmZIb3Yw9mFTLkTfcvZGZCj2OQ46T966gaDjJ9n0eeiYJ7esZsPltQQMGF1lPBp9+u6GxK24UrisxCObLm7adChQx3bkgywOdXtlJiOaioa1LfQ7MUkGVhr2hkCguMgTtgkyBFqutZR71Y2aCba0dF1kKBivhsi0c0OJMZhqKMWXKzqd4YUVYoKox+r594hzgTx0MeioY2A== 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=84RI+077QT0IyR3qvihpandZLg8yhI+5Vnaa39qgDFs=; b=ZwmyqVqefz3bZ8qe9DeHzcm0bmaakQDx9s8G32hIkyB7WR/YxLVedea7+e1eiKuk1PeODkpztBGpgN9Bat55BCgdtAO/Y3/+BwX8fkKUdVkDInxoKX9TZBaRcRZJ4Mg/PdhqqwoW7e/l9o3XIYDCxIlEzcSuoq3aOkkjo69LPWjE5ec07z172i92/tWmEg73FZMGxGtsMBSq5zfYlaphpRyWBeo5r0/5MmemdCmhyxh083vJXkUgT6PbaLcRXuGCWXLjbRbMvf4lSnIgWyImg6Gp0j7l5vxsKqKi0KiFIQk1vrGAkCM+7AT0ln/gxnJHt12GyYLP/duNjRfXJurGaQ== 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 AM0PR04MB6882.eurprd04.prod.outlook.com (2603:10a6:208:184::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 20:08:00 +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.8069.024; Mon, 21 Oct 2024 20:08:00 +0000 From: Frank Li Date: Mon, 21 Oct 2024 16:07:38 -0400 Subject: [PATCH v3 3/4] PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() Message-Id: <20241021-pcie_ep_range-v3-3-b13526eb0089@nxp.com> References: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> In-Reply-To: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Abraham I , Saravana Kannan , Jingoo Han , Gustavo Pimentel , Jesper Nilsson , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@axis.com, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, =?utf-8?q?Krzys?= =?utf-8?q?ztof_Wilczy=C5=84ski?= , Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729541264; l=1188; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=GExlPE6INqJBVe829R4B7L+Abmx+hOxi51phEI8z7Gw=; b=crDAQDQKZ6D3k6ZY8OmJpO6GsDeZURRgb44H6Y+TiYfG5JjD1HlvPlMq4EtNrY0vyWr2XuS61 UIBDmoTEAEnAiJtBuLMQYUZ67vF/1JGUdEf17KLb+AW11lQiUi12n+u X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR13CA0071.namprd13.prod.outlook.com (2603:10b6:806:23::16) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB6882:EE_ X-MS-Office365-Filtering-Correlation-Id: 180c6b20-4386-4c34-0650-08dcf20c0ff5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?laxBgzPmHUZFmEyv2Wa0zT8T2sSByYx?= =?utf-8?q?laZDjc/6kCkMvCdJBbVpfs0toVUmDwWPCrnKzN/59fCMiSe3LdpJXYyMHlIOkaZ+Z?= =?utf-8?q?z1Yt3bosWEkAVpt4LMLBzdcaXe+wzEy2qKu60ALQq5So3brO4kf9w4umaOl4DW0o4?= =?utf-8?q?WL9WNn+wROCMyk3mZkrSTG8Kn5ChQksgBfaIGV6XczcmT4b3IJeHnZzJZPU0MIzfL?= =?utf-8?q?hTzYYlTRkBQzypPWHGit+IW0i3FywVW792t7URUsM531pe5kbXZmkOY5JQYzoCCMr?= =?utf-8?q?DswCuiWGGTaL2ENidZ9GT5bNl8yhnewpgGpB564fs6bjmlslPJSkw0d6W00iIOcUJ?= =?utf-8?q?9Ip/g1LSKPowtq1TAeKdejv00uzn55A49CmlO/9J4EiaD/fq841CeUtyBov1sQC5Q?= =?utf-8?q?1bz+/h4HKewxW826aKB3UgQLyUFWgjrBQ4v2nskMI/sTPeHe+34CSdRKbH5Z8qxM8?= =?utf-8?q?J2WArncMKJNWT9iURRa7AZrst7e2UeM1YGNaHViklXUSeZBmDagi+VzcGK6lN5+Tr?= =?utf-8?q?0+GnTNnwpTnvOhqBcwYD7Rur7UIKQPnoliRUMh3uGCveY7FUq3NDP0+fzG05p8FSZ?= =?utf-8?q?FWl/YrrU8BZ7mxa9UKTA1PLjd40udFD9d4wK4QU7joPsQWMshW11Nbyv6AmRDWojq?= =?utf-8?q?dg15/5+SSBqAYe4Dh4/h/DW1xPhAH8/yBm/jh5eS7xS2bZ8IRwE6Rz56qwjZFSrTm?= =?utf-8?q?ozOrF7xnRM/Nb49aBcKvP45CUemjoXycSf2kIFvwbrRW/MSO9UkxgoaFqf5//trOi?= =?utf-8?q?GIrHjkEfQ6iF/shxEQnunGFgulJqjIclY0JR2IpV7VSiZpCEEnW8uDTOjVlY/VXVK?= =?utf-8?q?CqoSM6u0Es14Cx1+l7jT3HXcPN79RMC/2xOHMQyCrCUM3ICluDV+TWE4npzKhef3V?= =?utf-8?q?qvf1hpSISJyjDGWJ6XAVXf6divWkrYSLN9zllLBTkiojVVzsULqUfFd1WQIB1Ztok?= =?utf-8?q?CzUCQ84Jx5EvYjQLYTylzcG0zPS2rOLRIOYVW9szaG6JTrL9SjUXn5tu8ovnLskR3?= =?utf-8?q?DxjYYbvOP4EW6jk0SP3/GB5Bl21+ngWJLoPo4P+DlC0KWhsxK/ymLyPfEUeRY6BNe?= =?utf-8?q?ttkSMYW8sH0/lH/zpiICxjNAWCWjkeWPTFkNlbBX4y4DnWtsX17V2VDehOcmHPiWd?= =?utf-8?q?V1ogNqWYcEqlMB36JrDu4FmnleTVSHVNU1mAK1ls2K4la/J7VRAHR00vaIXLUcjQb?= =?utf-8?q?8vf1DlKCJTJ/GlwN0Jc1aDEHQA8xqMr/rqKSXBAjVsce8uSCjpmY9kyRaEj1EBr6n?= =?utf-8?q?0gAuDUfWds3N3CED5BPKvuo5YAxb8P/xlsYi+16QM6575rmTqxA0ktj1NhCBT2cEQ?= =?utf-8?q?gG1qVsnkG9Xn?= 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)(366016)(7416014)(52116014)(376014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?f5025aomZRjvFNsO70RkzC9Vg0mG?= =?utf-8?q?zncthjS/GOmwncePmh1NZbniil0fg6ReAjmC8iabr4Hbb3bkIODu/9JUFU3LsxNu6?= =?utf-8?q?7tGZ0k6bbFVDZ1ayWQH3CHnb6RmDB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bljpbeJPuKB0rOSKMBcaDSDlKXIhtGbfVeXvrcxv0q?= =?utf-8?q?1Y9wfA36eckjc+CJeyewRCQ6U/JDSxcSFkaefheQfyJlobevQRv36LQYn6/wb2+QN?= =?utf-8?q?BXgc2UrnAHNATlF+y6kpUkCPwJL3Twv8HUhRn29eENN1b7FHg97zZkU0InrY9oBI0?= =?utf-8?q?wnSc9iojws2zXOUHevvu/mAO4qcr6dXiLb0Z7aftpOmtz6m+x9qyOGOMDf7Zp7yCk?= =?utf-8?q?Nt44e9FNOjODilan/U72DTBNK1DBx0dKa0p5fNyCjXG3T+jcwlMRE5LBHRUmm87nU?= =?utf-8?q?iEm3X5o3AloEniSfr0cFmegwENb9Tql8DWqn2WGQS3NdfmuNwKd08c+Ey/bIiLRJT?= =?utf-8?q?26dCirfVvKv3mzFwFpp99TvSrXIigkoQcdMAM01DTztkdGmCbiep7SfoK+RBVrPsT?= =?utf-8?q?Fjls3fR2MqjLbIkRD6iMxLseRcXpTIPFpMqwoIbyycRBwkG2ySEaIc6jpM0s9KFck?= =?utf-8?q?dTtnvEnTxTgH7Ya1lYKE6O0qK4mwH99GLRr4PgzhbitkmbDvtYtCXa8d4YEAdFPb3?= =?utf-8?q?VqbTNQzCW4HW?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 180c6b20-4386-4c34-0650-08dcf20c0ff5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 20:08:00.1852 (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: rO2KiRTjn5iEQitW6B8fNzTMpVvUs9Mx2lC2WKhhhWLEjYlGJXBmJMEkdjhw7k6ZKlhzrie8ImqCPEGdkCm+Qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6882 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_130803_420953_7E11E35C X-CRM114-Status: GOOD ( 10.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 808d1f1054173..bdc2b372e6c13 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -961,7 +961,9 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) goto err_clk_disable; } - ret = phy_set_mode_ext(imx_pcie->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC); + ret = phy_set_mode_ext(imx_pcie->phy, PHY_MODE_PCIE, + imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE ? + PHY_MODE_PCIE_EP : PHY_MODE_PCIE_RC); if (ret) { dev_err(dev, "unable to set PCIe PHY mode\n"); goto err_phy_exit; From patchwork Mon Oct 21 20:07: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: 13844636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98C9DD17130 for ; Mon, 21 Oct 2024 20:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9PyAIWaOdZO0FeU9DlPkmrVDHjIO1344fxwDNX/2GJo=; b=S/8hajOM4KsFbogYFDQEAw3kk4 4VY41fYBPs4AQBRoEc/59uyEy8OHtGUUhLCf7QUCD3dpAwMPyTzeUJWjHA0Ixny45yEW3Y5TKAs8S GGm8Yaaoy3sPlHOdUn40RxSfVdIj+cUY175yFrfV5UTyo9WA9u+v4n8lpB1+rfxqXibnxDmnbBCr4 U5T2SjUcY2S2AlBHD6PYU+J+AnU/TkhW8dY3ytTcBg/KpahFCXIfDt/114Ag0VNWftrJgfGKTra4c dFvgLSdVxNuFy9TBRzCt40W56vdc7vDgEPziPcXjTea1mG8xxI6Q6OVdDz117lD/9Yoy/7vpKHAWy z/lpSLOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2yoc-00000008ZNF-3QgG; Mon, 21 Oct 2024 20:15:46 +0000 Received: from mail-am6eur05on20623.outbound.protection.outlook.com ([2a01:111:f403:2612::623] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2yhC-00000008XV4-3D4f for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 20:08:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nBtgyFeEcG5A7soUlVllARJCh6L6WawVfy9SEnQDckXPSjjRXs2R+39QEh9cCjVLdsYoZD2tWaQCQMg5w+UNbw51MJr1t+jskgF/qrcLaE0I14AHEEyB30gJGxi3X65NNYrZI0kbNg9O2WJfZWlrtLMUBgEdNh+ZUe6G/QRP/HHff70Gyj+PfxlLSkXfAZcmx3m3zqMUdwyKGjBecrLwbJccnjtXpx7vc24LDzIMZ9gxXE1nCe/iU6Cu/EUhJBJcGZ8yNJET1j1hofxkDs88ETCrCmtQfOS/dYvBGXfVafTP8XdNgnEDXVKhnvCcQQiZcqhWWNQb3kre/bzdS3V+iA== 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=9PyAIWaOdZO0FeU9DlPkmrVDHjIO1344fxwDNX/2GJo=; b=fMGhLNsfW4xdNvO6I9i6ROTpkSmTp2Gdkx9SHuFnyYvYyxj1Spy5yHFU9QVdatu0QTLDcYOMuh7M3yCl0wz4QQEhzqiE6aUn241T9N+Ap/pvnaqVEbybAOBcelhYM42ZtSCXUlD4nKdftVuE1iU5NYoIJrQY9sDy//SGlOvAlH0IOvXwkKcmVmiS3LIOo92O7YOAW7lqb5j/RPeE8bbYDxrRgmIgIE1FkCFKEzXSpMedGKC2fp89yyR6bOeUFjHG5CTwG+fnyYCattLM+BexrOrQ8S9OS1hd/FSzv2OMD8lK5UhOM+UuWUBILfczkzRwvbTA81e+X9CFna25o1JANw== 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=9PyAIWaOdZO0FeU9DlPkmrVDHjIO1344fxwDNX/2GJo=; b=lYmXJDMrq8LdN7l4XN4lNpgvjNshB+E2q3xohRA+rlSz4nd5geB2jhaXIbkEEHFBubn+d1mXlHUTqJuUdATy9NbLUHt2vVzeS83t3jl7VeTZQ5GNcTfzkYWo10YI9R+UywhnutPiaHG9wtG4SiBV8VyOZPb8EoviOW2Xp40WZLPKXVUcEZJtjSOKYuKPPpC0DUHNm2nwPElTR5UHf08L30gDWSWcjhYNm/E0zxp1fIIvYgfLSMTjI4JzeWWXGQ8J2kSfK4HRqSgL5gwnajyMBothHI+OLZzRTDLfJf00hnHLMoN1sX9ckPaldjbf1sM65HPC6XygNxQCC7V6FBFySg== 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 AM0PR04MB6882.eurprd04.prod.outlook.com (2603:10a6:208:184::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 20:08:04 +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.8069.024; Mon, 21 Oct 2024 20:08:04 +0000 From: Frank Li Date: Mon, 21 Oct 2024 16:07:39 -0400 Subject: [PATCH v3 4/4] PCI: imx6: Add i.MX8Q PCIe Endpoint (EP) support Message-Id: <20241021-pcie_ep_range-v3-4-b13526eb0089@nxp.com> References: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> In-Reply-To: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Abraham I , Saravana Kannan , Jingoo Han , Gustavo Pimentel , Jesper Nilsson , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@axis.com, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, =?utf-8?q?Krzys?= =?utf-8?q?ztof_Wilczy=C5=84ski?= , Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729541264; l=2779; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=BLCZ2PxedJ8sdH0+OO2S4L0OwBVlKQm8vFUPblDgBs8=; b=I0Y6HBxi83M21mJruo/UF9A9/P79iglng8Vq/leSNmuBTVJgb5/hHk6IspsBWf8mdE1ifzvX7 fFArpwcY8/IDx/GMhaF07h1l3DIiltAhF6NJflP2H0zWRZ1ryhgZnmi X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR13CA0071.namprd13.prod.outlook.com (2603:10b6:806:23::16) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB6882:EE_ X-MS-Office365-Filtering-Correlation-Id: fc65adfc-fdc1-4f44-2792-08dcf20c1248 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/YbLuPTXjRd91bQWOz3oK7vZItGA3cX?= =?utf-8?q?gbbPydaCSu6lw4N1UbPWNujw6jvyqH7yDUxbFMMAe78B05u/S9MUW0Juq1obJ6uPZ?= =?utf-8?q?VSEBTJDtm3axOrRkP8Y0zrljQMpDJ6mIBRs7Y9lbiVaGvX7MgAaxQhvgOtL4/Eq/d?= =?utf-8?q?cUhJZ8Imaw7OH4lve1290x6lQoAtRRrZKprcKrJ6hlLccWlKa9PNFyZJEzfTtkF6f?= =?utf-8?q?nZrtVM9k3NPJhwCBcDS2bq/RhFAu5a2I1SJFR8kcIC7j8cl0naVz/B52HH6wx13Ue?= =?utf-8?q?DCahBJ6haVXq/YOwd7X0SxKcxd2uKn0U05rqettGiigbY+kS4wlg9SfIXiR/IZtZd?= =?utf-8?q?1lVMMr1kftzg10SM0XvkuijwyRT19yQNZk+5pAfj7vBWvHprgZgSy+V6ZoZDct3/M?= =?utf-8?q?8tRxAo/9bApP85xCoId8jl8FU2alN522Z7XYcf/ap8Z6DPbzi3dP1p+WkHLvO9PGv?= =?utf-8?q?4fM7WhRzgsvZmYFU8OlajToG898+QOtRnuXAsQRsmn4e9jAMbZTBqLm6H7ktcSJAh?= =?utf-8?q?3UXbunuiRCwUzAZCg3FUNOfy1VB41nxBxWgXohhxJcXdrO16p1Md9B7FYLp9M2AJP?= =?utf-8?q?TKydDyzLO1Ww1qE/JchEKJTTwQ5CaPaVsvcA5l5jzkhiHsHmgVyj/kEly4LaHL5Xv?= =?utf-8?q?W7wW3+MitMHUQUi2A9Yo0exSo+IMJC4fwVfk+CQyuX5AysEHAGmfINwqTNn4PHtec?= =?utf-8?q?l8JNdm/y/dLH8Njmvc+cGq3mwxfEMUU86Bg22Q76sA9RmTiCMpmkort6RiPiOv8O+?= =?utf-8?q?1eRzUcKVaHeGXBKI7NvSsB1wMiIc3T26SluTQJQBliAPk3GYoEIXX2R1+flHVe5oc?= =?utf-8?q?3gjGz7QpiI/ik7L2Ae9tq3c+Xz4bQF0rEvrLqBgdd5vSranW2y1M232lNjWXJ9n9o?= =?utf-8?q?df7gRIPauQOEmJ8luu+BU1QIn7amU2HPqL9ohXtoNV6ZBvQIQPIDyEmwWe4wrn1Ui?= =?utf-8?q?hAx9PEGEp2QMpS950iLDG5uAm36LyGoT/747ahfMhDFrJp2WrEQ09o2VI33I3GvKk?= =?utf-8?q?MQ2PaciqeNVsrrKnEWI7h7pVLAcLfqdzDGJ92/WPeuOE58hadG38xavT7/12GJzkW?= =?utf-8?q?InpKI+8eRN7XeozEX7toBBTmYEj2bMWyMxOls4dx7oRNfUpPg3MRUHeQdiXleVit+?= =?utf-8?q?MNTldXPbTkrLeFiXgSZRD3dQGNFEpVQReibFWOCaFhWwb+1ZAbOdJEHRaSUpZfld1?= =?utf-8?q?xb7O6c1hjnA0sxl+4WMrpg15FkbG0s9CmC30lwEYYjCt6vSbzcyufnpkM/PyUVwMg?= =?utf-8?q?EgawULFgtNiokTjT24YojEvyBjuJs1EKQzKJ334Mw6NEvlUzXF/SrHJKeA288Y5BO?= =?utf-8?q?0OTmaweptoih?= 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)(366016)(7416014)(52116014)(376014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?QR9CwwbhtTM+mumPszmk9Vn9fXXK?= =?utf-8?q?3sKxk9Zs8nsCBQRhpX+JmKFAKOCCu8yaBO5q0dUmPCZuh2+q580FiUTw0ROC0heWy?= =?utf-8?q?dLzqrxkILv98CGEyAdidGx/KE80Zk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+G2yK1W2K8nC7fzZrb?= =?utf-8?q?zPBm31RzSw+0rk7Nwqeu0tcxnSXg1CipXd8lscNgoiHDeb46Uoub4jHYCqbLrJ5Pq?= =?utf-8?q?2xHWzxnEpDM/ICQYb1sQn7eiDXSyymfUVokxcc2BZjGB80cSX5UV/Mu6+2+M/6IF5?= =?utf-8?q?CrGZTjre/eTPezAym6AB4gLSnLJmBkN62ug7C/xQ7n7/66HLMtrOwV5NNueFw7dSV?= =?utf-8?q?qHC2Uq7nHv5JoiInSWW4NzBVj8TVJDDP1at6kgA4zUvgl/dvub7htZI2ztHi3VbVo?= =?utf-8?q?LcXU3BUYfrDyy5Rc1cHProHLRzmVFu7GCbpbdvNvUwi2HTR6jo8niFns4ZbmwMZAA?= =?utf-8?q?kGZ11AkSEebPzVB/lM3K9jf/HZfZ95btyawLyYa4U4kMa/hN9PK7JLypngX7jldxZ?= =?utf-8?q?h69hzOAu/Hr1M6+MLhfLAo1dqsGAyyBII25vRZlKWM6vOLhAjVW0VYPayukPJYWBw?= =?utf-8?q?tuxeuK8XiwxyA7mOPYJgoseniRIv/1Bj/vLCYFexd8NCxr180f+FwgqLe3uYc3oW6?= =?utf-8?q?GRIDphULIkjh?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc65adfc-fdc1-4f44-2792-08dcf20c1248 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 20:08:04.0771 (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: qUlC8cRfjyuzpJ0t5YnrrrN1Hu4s6s9NcJJMS5gHbwrpYctWUYLTdaIi2LGQj8Kwi/lAtSdRMU8QBp7yVdCnGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6882 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_130807_033774_53AD66CF X-CRM114-Status: GOOD ( 15.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- change from v2 to v3 - add Mani's review tag - Add pci->using_dtbus_info = true; --- drivers/pci/controller/dwc/pci-imx6.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index bdc2b372e6c13..5be9bac6206a7 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, }; @@ -1079,6 +1080,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 * ================================================================================================ @@ -1448,6 +1459,8 @@ 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) @@ -1645,6 +1658,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 | @@ -1674,6 +1695,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], }, {}, };