From patchwork Thu Oct 24 20:41:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13849682 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2058.outbound.protection.outlook.com [40.107.105.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 0259F217313 for ; Thu, 24 Oct 2024 20:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802543; cv=fail; b=JniQHdfTHHSNCJt2rJP/2kcSZOBMAQckbe5s2I6nfy1/ytaYroieZ7KS95ScVnoRJkJvdrX2jrpFgGSeX9QEiGJpmFENP+iPMW7KrGKfMq1/cZq4skkNt2rL79dM5egvifLY7Ad8lt0pBXz10qfG+ojq2AsBeO86wC3mDQrm4O0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802543; c=relaxed/simple; bh=GsBrY/rr2TGV9C/ufXVpAjG8EooxUe4YBDJ9aZkc+U8=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=SRgEH8IxKqH/3luKOCb36usYVWodFfUTok40JsZqwTIuRkjFwUYhe29rZ9AtI34w3gaoTawHfBq4JNsvisvgx0tY8lT4SS9dVkKBiMz6MVnnElJggJOwEO4+1OLu/eE7O31p7C573MRzb65jvxnUWEDzwOJrwFqf0cnNpIpE4H8= 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=Aw4USNMB; arc=fail smtp.client-ip=40.107.105.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Aw4USNMB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xExKwUHTn6oZsXwRvMdoP5g6tFY3lG3X7l0RcW/z1UD2lC7dG1lvPl28BEEKtau64lquy2Igx+hHPzkq7k3eUPiqGy2hp+Z0RornioV5Rufcu6FVyBRFhkE31MbpbNFTtxahvUX7eLWb8TBgZi+v2s1+datJ5VdlxXvD4u/YBHVt3/rAWRETR6u4HYqwktaLNXsEFRc97bkwUoGE+boLbhy0QNZ4lB2JEZRP2sx5R+wzaMD6oRdxSFF5Hv8HJO8J47HjJxciz2tLiV9VUx8i5kNKyEhB0zapMwCYoPWd5u2g7TEBBHkqVMP1nUjr07LDw1X+drqmaudPMV+xDr4RkQ== 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=2ZEqB5SgGYv/wLtHKqtrS28/MuvXtIH7arWnGnAkSxQ=; b=TMpLZgd4wqcziKR01Gnb01GGQHPnCkDE2eYon8t2+9/C//29d7UEjLtEpmvGb80Jm+XsbCTDb0drI4A27g5AMMIT9aEsfv/OphxEKhm+g3ocrBRn8ghVPNNG+68ECWogiAOR2sxI467qi2D8/nbdtcqTAJm61K1Ap5b9vEPCGs2OIfzzMWcm1jYGhymmz1Esuas6dJX4nh8LLwoV1na+WFSR5Gzgx76eD7LzbZnF/5ehXyOLDNLcOm2jZcBYcQzLERWGoIdLNOOso5YH+t/yDXMPZMqK7PvyyWEf5tL+IbQfoJXe4cF8FsVglIKLeGh9c+RsNkLhSBlMjpqgxGZITQ== 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=2ZEqB5SgGYv/wLtHKqtrS28/MuvXtIH7arWnGnAkSxQ=; b=Aw4USNMB7TKUDptBJ8By0tAsio2H54K6A2agLXSKMjAjnLezJpjfJ9VAScAZtoyayt7c0K7n/LqonB8RFHmbEdftHUbDTJ7QIHiPxnepuOPXmM+qlQXKnzIEa5yc6wDuieu+QMF24ACtbNAoXy5bdZvUN4eQXqHgQzZHzuyGNj8Heh5q5cSIalIPUq0XC9N9lgw0gMsw9ZwDiD7/DX3wg++z7onJKQ63dVoMKdpiXwar1B14gHAYwn1pLjGiPxmkSbGMDhOyUd5QLn3tpI6yLdCNiWwMd5qEhCs9fJGKFn55whcAImSGM/hsZ1Sv/tbzqr3ln+bB7zMCI2Mk+2wBdA== 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 PA4PR04MB7517.eurprd04.prod.outlook.com (2603:10a6:102:e0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.21; Thu, 24 Oct 2024 20:42: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.8069.024; Thu, 24 Oct 2024 20:42:17 +0000 From: Frank Li Date: Thu, 24 Oct 2024 16:41:43 -0400 Subject: [PATCH v4 1/4] PCI: dwc: ep: Add bus_addr_base for outbound window Message-Id: <20241024-pcie_ep_range-v4-1-08f8dcd4e481@nxp.com> References: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@nxp.com> In-Reply-To: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@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=1729802524; l=6280; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=GsBrY/rr2TGV9C/ufXVpAjG8EooxUe4YBDJ9aZkc+U8=; b=ovwh5BoEazxQSkess/heM2mtUzNAlTzZAc/9uH+fSvCv/SPD5JyAPhMC9HLfFwlBinBisJRMO x1V7/EzLQxnDDtthTziKY2Fyl95BKt58z/edAtVscRq+yEPYD8VG2Th X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0112.namprd13.prod.outlook.com (2603:10b6:a03:2c5::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB7517:EE_ X-MS-Office365-Filtering-Correlation-Id: 5808ea38-83a8-4067-8006-08dcf46c5926 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?kNXGlpbypasjCpruFX/Dk4RNvfcGtYY?= =?utf-8?q?FvJ1K3qjre/Ees56AoAuD4mdg8dTERGtMBt7HtjP3fi95+vLpHEG0p0KnRoCXHsIn?= =?utf-8?q?xrwAQGmXUnbJcfvz9Di7J+Jq7HrjqYM4tMVwCon4XGwKGXfFPzSC6yZ9hKLwwVzRL?= =?utf-8?q?rc5EDeao9ABH+qQd0XxFsHvDq8VdYmj04OXyZwCfs5KTQiwP/blWHVB5iBeCEijS2?= =?utf-8?q?96w7NjdDNiPYCUKaHUp8S/s+2p7BlkWDd/FtEyrsLSjCgZNBBb29iNQ+xFwW7JsE5?= =?utf-8?q?Q9Q5nvofqpYJpV81pmAjtkjggm/kJRLMtvbwHATIWA9SdfmO0SGKQf3qeJ8/iZC14?= =?utf-8?q?xra/9GsvJUmZ7rfuWupSgX13EyUwDi0wUrqwUQSJwfawnrZ1er3qV/yg+Eq1jD5RN?= =?utf-8?q?Dk+1+f74c95z+so6WPrR017Vq1m2oXawX/wuuDzmmIFIQI3HJs92U4koxWBB5vsdH?= =?utf-8?q?B5VJ03s7AFGbfChX9LocwJ4UpyJ6Nz4C1O+Qa44/lrVyQ1jjwODaAtbWPJ23nWM1C?= =?utf-8?q?RxqhX8qKMKbWuZsT3iHOwCxXCCFUp8jiAWzOjPjqUHGeXc3lr02tz7EKnQSq+00qB?= =?utf-8?q?YXxTkFRflae/LrXpWjOfCUo8WpY+hXaQwB+UH112e7Vp50EJprd+m/Ht4+L/A7wQo?= =?utf-8?q?lgDuE6u5QN4a4/LcsG6l2XGyo5Rq/tKyohrAVEb8ctorlOoVuNRQenUcZi521LTIV?= =?utf-8?q?Y/z1SNqoCzBLKjaVZDieZA9fOHMhScfYdBhV1NunBoZZGwESh8cWcau2D2qBVwAiG?= =?utf-8?q?LctMQ+kCChNRcaXj78ftmQ2A98KYGZR1xELHBcFtP9RKKRBI3mVOUXvHo9leYFvin?= =?utf-8?q?3NRZc4h6zcQAJQaDbva+dUDlc54M5ufpV+xcUu1N+CHlPTJ+FSWzfYCei3y7uL5IG?= =?utf-8?q?5nXaGtoNp5P+3RbK5rk2PwYp527dkgofz/LdyPFTpnHzolhns6RH7pd8EOE1mDlsK?= =?utf-8?q?oOzHWBR53V2TY2pmtLjar1TGqf+ElFD3KgqIlw7pVMbCGTXdrZXc3ZmHq7i5OGIkE?= =?utf-8?q?pLFOJ8FGBlykl7L0obCQgVFQMSg6BiI3a5rbc8lisHAtSj5Z8ivqxmFIVNdGuL+rR?= =?utf-8?q?reH6Yey39rNaGyiqMal3FFBaQHKo/l37Hxnwe4zeWdrSawEIKn+dpk3IjQq62zMTD?= =?utf-8?q?m3dUQD0QHUkt33kdlpD++JUWkb7ihzcoZTc+y0oO9QVApidFc2EKKT703fIVI1S6Z?= =?utf-8?q?seRpIZ9kxplkUQaGjgc8wQ2ue6AMciKtX929W27TqinRvB6kXbwiHwTFjLXz+XjMc?= =?utf-8?q?1nSlzZCLNurT25ltzY3SqkhUZi4beV/RMDw4cFWM3B1wZAiVkDTZKk+UKbUKB1cx/?= =?utf-8?q?Rc2r42GZKaJwRaBST4SH/CSb+5NOiZI8Xg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(7416014)(376014)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?jM6OoKrWqTmpi1xA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EHFHj?= =?utf-8?q?DhKrTeY5PiwseDjNv/hr700pqqnTl4E9sKOYUTs7mpZyuDEVjxEOUyblDeEJQEm86?= =?utf-8?q?iUAHmxzKA8OD+aF+w5GaS1a+RCJvWX+BPZs1h4ItcFMWUBV0/XRxEwOfAdZangzPn?= =?utf-8?q?3FtUvFS+M4uPq4Qd9/6sXYVbmuh4QDY6u6/atDIp8QS5ldaSi+0P4den8d3D6O2Qx?= =?utf-8?q?y9lCb9jvG+5Zksxxf/eZKOfnXsVcWd7DjKLNjY9N7+cjUa5cga+Z5PmVKiPuv7qkx?= =?utf-8?q?ibNA+SlzU7BCeUSGKAHgHS9I2monczHeaUBeEFDKSKL+xd/vShPBe1K/8GxHuc1Je?= =?utf-8?q?152cbA4+uRwWybGRVWQFMBQOfhqsoBTrtb/mJPoWYj+CTjaMM82vCC84g14t/LqlN?= =?utf-8?q?El+BJqyy2d+UhPnckNEwrpe1rlnFV1lF7BFMzPODhq2XyC26l1XoGUpyof0H1a0wy?= =?utf-8?q?ULDg7JmwtXyKBEYOxycPXlnxaBvN5TWddpQIP+IwL+IG5rauRj4KUdYKaBFT6iVB5?= =?utf-8?q?qbYU8PDZBKa3LCgFUD4sdRF5Z3zqeE56W6xQiy0upmDjn+ILRZ7XHshnAP3BKXK2U?= =?utf-8?q?dsIHRghO0ZQTfB6AcIt7N/fuIdvAYOvQdpvySYPEP4zTTVG7ElsZalb4qUMy+NEN5?= =?utf-8?q?mnv9f7aZJ3uu?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5808ea38-83a8-4067-8006-08dcf46c5926 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 20:42:16.9954 (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: y4CFhmwQgPjtm6HpIfBMFVCgSlvykrxv4LHTMEEAdLn8tfbUbWos+eB9Ke+vFrYo9qW1fu7CmdWbZE7O9NJlAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7517 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 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 | 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..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]; @@ -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 Thu Oct 24 20:41:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13849683 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2048.outbound.protection.outlook.com [40.107.105.48]) (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 85C422178EB for ; Thu, 24 Oct 2024 20:42:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802550; cv=fail; b=eECxo4DOjKSKmTpvswTy1wFZR4rzQD3MM1K10xsc+G/cU0E0nMg61tG7Cl2PvVZwvd5mgZaXrxflh1Kyj72wNWcNT9EhgAC1hCiUZLTjHDHpq2R2QMjyVbg87+Yxg2Uxujbrhy3d8Lhc94A7W1lQMOlEu1xETNVO8brNYmFytEE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802550; c=relaxed/simple; bh=m/FwtlHiYrAps1mkcMK3XbQDbcLOYoRH/NBYh7k2Qns=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ZfVnvo3PAVKKIU5mo1Bp6FoAdIsd4xMEyAvfjKYFDbTcP3nAD0pEdj1BvSemR3a4xjtPQjTpARwl3VVxqpBehuOopK1G1UF1OKm3KIAEjJqoXX7D5wWdvBGIqzIv2YOfvUsyzoln//NmKnf/KBlt1jyeDUzgumcGM8D08MilPxA= 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=l7BNFItf; arc=fail smtp.client-ip=40.107.105.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="l7BNFItf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bljI9Mf6hGH42DHGdy0NuYDtWrOqv63+s7H0pLmUuQa3QZ4uNl0EZuoM7+ljQjREpa+EupfVgjqvh0En9MbcZEZymVSSx/LxNZiTu+pmX2kB2SpSACUNcmsx/4pLnPfSoIsio6AJEIwJrPtQ7kBdoibYfl5qaTPXvgP3E1pSnJ8nEAjrpDsHpCZ7qeAuLHohWISC9qKmr0TEDZDg05pZF/SHVzPf+RF1MdD1rNK82xkIn5bl2vjHVwWTL8r9bYUMrAU0uQ7PUJ7GGDHNytubGwPmqVcY33qusHXyVjrnXXD8aYfexxquE1OKLgw2FFo/xJM2gzWamKuNdGQajn8FhQ== 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=eXSC/+4XeFnAaeLe8Zg33weCJ32yXdCxNoRWfCy7Uys=; b=jPJ250TGut8KfzTBpR2h6a65fSoKqNWkG1JDVqv0A/Bz3HkPj60M5kV6oApWgQMiloPBylZBEkvsbTVUhmXy9rAW81k6B56oew/DpWyL4IJkM0jTtI9pRx0zLR3oAWzEwdWfhJf992k726v5DBPqkiVy8yq12rjKNrxQxvdLfhLuknmBmjHw4p5j23kddJ+t6KFHn0XOmn8+Uhhu3cqbQvyHhC0WriX7jR+jj1aVhAO0Qz3tW+whRxXR3VV02rzwrU+omW0UwZXZ6UsEXSmGVG1/2PL4e6gPnRHpTFZEEgVHea9TKpOPmHUPtxj36OePial7YqVHUHpCNkmbHTkJ1w== 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=eXSC/+4XeFnAaeLe8Zg33weCJ32yXdCxNoRWfCy7Uys=; b=l7BNFItf6g8Gu2bhdZ/eQ5e1eArF8GiC8T5MY+8zKfOldSZ1UkoCEvya2i9ZWWMDIBRK7PDg/fL6BIwvP7zPPRFK75+8o97mOPTzVTqdsXpLkyp2xNaE49ZkeiR8pmUVLutu6uJyQxvimsOSnObgUxPefzMja/8zigfWBxhhSwzlXbtLTvzVk4nM3ls6H8fKdiOVxEyLnKzhK/1kp+bpiNN5CNYdjTpr4DW1bWgrBvLEl0YFGRCWb/yz37FOLdk3ep2hfauwh0vM5J+K7XtQee/nah8P8QccrzueVe4uKWCmwjycjwhwjStuw4gaIdcVWCXqFLHwMqYkdAXwURNE9A== 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 PA4PR04MB7517.eurprd04.prod.outlook.com (2603:10a6:102:e0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.21; Thu, 24 Oct 2024 20:42:23 +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; Thu, 24 Oct 2024 20:42:23 +0000 From: Frank Li Date: Thu, 24 Oct 2024 16:41:44 -0400 Subject: [PATCH v4 2/4] dt-bindings: PCI: fsl,imx6q-pcie-ep: Add compatible string fsl,imx8q-pcie-ep Message-Id: <20241024-pcie_ep_range-v4-2-08f8dcd4e481@nxp.com> References: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@nxp.com> In-Reply-To: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@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=1729802524; l=2245; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=m/FwtlHiYrAps1mkcMK3XbQDbcLOYoRH/NBYh7k2Qns=; b=m5Z77eCpz0KfGVrSQ8G0m9mY4FDQI+h8dn+co13soG8oDM99wh1tkact20JO8Dq97bxVTwmXl 8Rg0Ag/aq+fBFEC6ofPqGM7cpioVoj1k5bTDGa47/3tj1SYOq4FrMP+ X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0112.namprd13.prod.outlook.com (2603:10b6:a03:2c5::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB7517:EE_ X-MS-Office365-Filtering-Correlation-Id: 6cea029f-f71f-4246-b4ea-08dcf46c5d04 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yX37Vk5tIBfixdLRFCjJnFlgEuHcW4v?= =?utf-8?q?weBeGdVmpznY/SX4JmHu866RSOlCDBMD9bRogmrga8X4dEZ1klMeockhvvOq1wXrt?= =?utf-8?q?ALDASBAnIoPjbuFU19T9HWf/lwH0ACBS1AR+L6QA/s18yFQ//+peGQartHdAuF3+M?= =?utf-8?q?ggixzl0t0XCGEpKGEFhXMgUzF/BV2ij+2XZbYpkb7PMxMSF0U18qYZFAOZgDcHki9?= =?utf-8?q?nTIx6wd/u++yuDgWqgsVec/2dQqqpIx+WZpNRcW+DoHrw/1U4SmeRVtAC6Nqx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8?q?/GCu1AJtLto4yf8ZkjzSytQN+adwJoqEBCS5IYoGRGCTnLeKStLYwl8q9C1tjQLgH?= =?utf-8?q?3tiQ2Ly2mb0MnlKNm9GqY/HLQhO3x2QMh+KSJzTdH1MjmNmu6buHh7P6oacY/fKRu?= =?utf-8?q?R2cJ6bjbSgRJuC6ZaPD+dOP9T8SPPfJhMHRYEwU5C/e445yNy3zz86Pr5FzoxGY6T?= =?utf-8?q?hFXcw/zFNPOK?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(7416014)(376014)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZwnxC0w3yJ/ppq2SikeYLDR6KGY8?= =?utf-8?q?W+1nfqZYMY2rDEttS2ohGb5Gksn09N8Xe6tiz0kxO+VIQsArSbVsytBpgoZrWtWkJ?= =?utf-8?q?6O+QyigG3c0zdV2o7c4BplBrFjQf7K2Z1uH4TOuCAqdkxlqwAVVKSzah7l1Sonx6K?= =?utf-8?q?VrIqK1qwN27nZiMG2Txgrph36M3dEm9IbeRTGSj2MmLxOxayKIh+AsrqRtNDLveE6?= =?utf-8?q?Vwy51CorkM6ywzPReTv8dyEFzBMtynIQMOh9t7HWKPPvjWkOKVWgucEIfqUGxEWFa?= =?utf-8?q?4OBr6hms8FDod7cKZOnB0RMoWUU2572rxzs0YEO2nWdgTPDwKLWL3V2BWzgitdAgo?= =?utf-8?q?qLvsvgjdd2jKp3PJAJNoMNyjwghTuxG4NXwY2TdKmOqHn6OLd+kiPjB8yZcPv65gG?= =?utf-8?q?P3WrgcxM1l5PBrOEis3rn2ZUFPaIaxvKxou+UffnzEqsNCrSxG0W8CNviilnx6v+V?= =?utf-8?q?pX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-8?q?sEI2VA7Clqm+zf6YfG210D9fOPpS4F+Yd+h09z+gCgnMcThQ7qGd5iki2FbwTgRlv?= =?utf-8?q?DEy7UorYoTSEZegxMfAfpySW4iTrGn6aEv/5rdbVZeC7fAu75+FfvSXXH5/mqyG7T?= =?utf-8?q?gfd/WT9cLTolbf7lVUppYdF9LFM6MwaGpkWkgut+zjT0fBn5yJ/z4wl11rt7PJ/Ms?= =?utf-8?q?8ZL/ngy4w4iH?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cea029f-f71f-4246-b4ea-08dcf46c5d04 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 20:42:23.4826 (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: JCRUNEVf3E1iSwfEJU5Ca1FimR5vrLD08ghUMvRIvHkEx9LtYOo6I9WzNTNEQQMA4A5yE0xklOi6ph9rrvNqrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7517 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 v4 - 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 Thu Oct 24 20:41:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13849684 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2048.outbound.protection.outlook.com [40.107.105.48]) (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 35B1B2178FE for ; Thu, 24 Oct 2024 20:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802553; cv=fail; b=nI34GwKycKQhLvy7tzNO6sLIVejWqdTsHCKVI0+6GB72MrPMCHPcHTqmveN5BoqFOc3hI6D/H0vvwJTkWAYafSR8IA0YQwwoXPwlO1XIealZgUleYFi3Kuk20lfZPN17MUsJZAKia8/L5Ygbrvd6m+mxq/lE8apd52X9LLAj2hI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802553; c=relaxed/simple; bh=pa21YroKN1Hep2b0+6lkuwO0n6eajEDfXOfgCIbz374=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=mBbZ7bijRuvuYNXFzqKElacB4pm87ZRr4ZthAwaN2rMWfYM3Dl0KmM87WlxoYPQeZoMjLIiT7GDyqsZAb0VibrMEgnzu9vaNspVDQZBWiYzJsYootzCtiTg/ui4Uw8WalNHHv4LogulFI/aDDKXWUHQqfQAuD7S/RecoPOZssrM= 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=m28Z4gIq; arc=fail smtp.client-ip=40.107.105.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="m28Z4gIq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yRAf66y8yVdTkJ5VLjm2JfKLA5t+koxWWYubaBi5k976xZMJv1VJbhaS5rRHyXO3AR/VIitYrXHRNScMa6GHeepORchyLY+MOPypP8w11HNKRiCFJJwXp40oDukx8r5HtdGxRjIP3Xs1nL1XuS7flPb4Jd6Uhx2THKMLr0rWDIYjtJqtX+bnCxOpTsoNz6Juoe3RqAJJoQ+aavdcHgqpFtbcAXWha5JCm+fjpLX9qvq5cZAQfY4Igf5eqyaArhmoau9RVB1mvaSN/e5vLAsEbf4mWCg4gJI4IxKSAZzETbfWhY+93jfM7eBZlhTSQM6MUGGUtzPVRAlumktFge/gKA== 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=xag/w1g9a9ktecMSESDiXVwOlvIRngpJp5VTemD6Bv8=; b=ZkNPmeNNvO13x/CQXqPMmz19S92m9cxX6Zsamu+fRZ8SMLbCG9c0GqzFqmrVB6wVjJm3QMX6CzBrth4pMAlaG3AHE4JS0ZSJTO3EcyV1kFoNoxJmnWw0+SlqTlg9A34uF9r+5Wrg6vmRtzmF1wCqgKwTmi3JOseaGWjo3aHvjRBYqf7vf0NUa1bSHx0A+qwjvNQLer5CPRJMMRffGXAdIWkP+TrSHbnaz0AfYU7VNsAwM9YOQWgBApjE9XO8reGgt1oBzZYRnVHjehJSNDX6mAyBAwddbTw5F794ViCYFw84Or5YMr9wP6mRLWI82tTtyfox3meJq0X7iQX8N3hfDQ== 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=xag/w1g9a9ktecMSESDiXVwOlvIRngpJp5VTemD6Bv8=; b=m28Z4gIqjPsSD0KRqb/snBgSPaZLxtqKDjSJuDi8HD8NEUsU5pQ2ErqK9bASy1vHggI5b7uQDsfGHqXojGh/gf54svbNqfOY8uSQG13JPKp+Xye9FbVZ0pC/1/cK9K+24z4DJC2UFRBmu5XD4JEeaWqM/9WJKM9OxX8Uq45xu1WuZfEiVWagqsymWmDVrm0qTWgkDL9N3Ul/Qo1CatdHbQerfsAd6TEm0R/yBFzwhXaDRgeVGKeV9dofBOv5MWbfZsFQc+9BR/0G+6UeJkCkB1B3uP4fcdPczHaoNGxkPdExESXgTeguZQj8UaDhkyvX4lqTwnLSU6wnIUsqOwl9bw== 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 PA4PR04MB7517.eurprd04.prod.outlook.com (2603:10a6:102:e0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.21; Thu, 24 Oct 2024 20:42:29 +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; Thu, 24 Oct 2024 20:42:29 +0000 From: Frank Li Date: Thu, 24 Oct 2024 16:41:45 -0400 Subject: [PATCH v4 3/4] PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() Message-Id: <20241024-pcie_ep_range-v4-3-08f8dcd4e481@nxp.com> References: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@nxp.com> In-Reply-To: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@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=1729802524; l=1266; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=pa21YroKN1Hep2b0+6lkuwO0n6eajEDfXOfgCIbz374=; b=TMYO6I8IT2cnF3WLAyfp8t7Qbi6JBVX4CUPFyIdQzCC2HU8mvJe9M7EXVYFTaoWf2LbgRWml0 E+bz7aEhthvA16GvXOruBnW/aVQSmhPgW0tfMcmOWuDsDm+dnDfbaKP X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0112.namprd13.prod.outlook.com (2603:10b6:a03:2c5::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB7517:EE_ X-MS-Office365-Filtering-Correlation-Id: b392c4a5-34e8-4c59-282e-08dcf46c60a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?OCCYA6s7R5Ya2hvvdiSBySdxfkDfab5?= =?utf-8?q?1EdWeQ8tRbioKBOH7hhsnwWuadI3Ob1q82MrhyZtlzNgxZhT4gcHmVoF0qaIm56A2?= =?utf-8?q?EplQKod/8N16xz+TVYMCHOH0MoXSMRKjjTJyuyxkyjtd3+2Ouh1K4NT0zbzt0Nn4o?= =?utf-8?q?1thkZTnAcHIV3tQmuLE+Acu8GFTnyLKLKnN3vLjspETkwypOE81vguXicYYX+tKRA?= =?utf-8?q?uYTxa1+SmkPqJZWLm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21ck4qWL1nsUc6wOcLs2z2wuYXAiblgsjkbaWDHXIvlMixWU?= =?utf-8?q?3rzMByT8L52U9hgjfAoxdr/T4/QxyKFN0vMufFuCBMOXxbEw9+4vG5hRqfdU8e4oZ?= =?utf-8?q?z9GvX6552KXP+AcDCr0Ae+zh0EIcSBG2IHD9F5KPsQKCKjCaqT0Wp5vvJlJOx+U4V?= =?utf-8?q?gnkmIw/jces4TCB+wygFQX3UFmPPhtAkMohM9qcPhjWHONOdZrnhEnZ0DBbNW74m6?= =?utf-8?q?twDKvc75nAyZ?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(7416014)(376014)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?GSSgMDZulAFya77lMFM8EpnyL/Gt?= =?utf-8?q?sc6QBSZumHC3TL7EUo7288l+A/ONiVnPm+zfhXjoWpz26fj50UVrKzldTr3bRh/fg?= =?utf-8?q?IDS++giD0VwGSWPhR7iiewuqN0GzFrE5xQrNiOepZ0II/KmgzK8X9Xj2KThz9Ejs7?= =?utf-8?q?rB1IMe0UjvpYegWIRKII1DSczjueYoCYe9uWG4gwslS1d1DdQptlss6y6OPY0ufW0?= =?utf-8?q?hXOUUEaBd/vxFv/EzZV6WjgvSLaEzLGrP1s33JijPG3QxqUubC0wfmpRQ8YVSkiLj?= =?utf-8?q?UuMc03/Z+k4LIywnRXNLMHcZ9rCCGUxOUsSyMO2y0V8WEkB2W/zpEnHsPK/RNl3NR?= =?utf-8?q?SwdRlo5rEVM5NbqjoQfy4J+uSUXiBPHd1M3QzwIOIAkSnDCxluy/sfgXXa9+E5bA1?= =?utf-8?q?KEHI0UjlYIjo7L30LK70S5ZZuGbOkh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TtTAMNoi5RiDvVY8jxHPFBqbJRFy?= =?utf-8?q?/1VqbI9yBaseQpXPfh4ARda9KqCQzvCDIo4sK7v43OHMOHoffcfc2ZjoDOYpggmDj?= =?utf-8?q?ZN526U9CkeUG5ZuW337+xKKyRQOT9Y80vYigESl/WZ7W9vv451w8+3MLzD51oL7s3?= =?utf-8?q?5HOsgqHVig+MH/kIMAqIxSt4O84TBMp1n8xPJXxuFLOr20jJjN7QyoiTM7A0YVjZa?= =?utf-8?q?20lF02L7QNs4?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b392c4a5-34e8-4c59-282e-08dcf46c60a7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 20:42:29.5899 (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: xntXs1Fo3VE3UTHzQy7Qd0MKaF2Z9lBYv7Qql4YIfneCQavcuFcOsRCYcKaoGC6P+3BeloqRUjR2d4LMhNYSkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7517 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->v4 - 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 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 Thu Oct 24 20:41:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13849685 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2051.outbound.protection.outlook.com [40.107.241.51]) (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 C33B42185A1 for ; Thu, 24 Oct 2024 20:42:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802562; cv=fail; b=m32NWKrveRJ1A0UOlt9bzdMz9dtqG7maLFmGfT/abH9sM//qfoNzxXKezRoUqWMdWAo6OvTL+hwWM7FCRdC1blVPDF1GWSHdEkE279f0sel4erdqhULLnUjWjBTgohWP0ooPF2zMBftB46oMV3/axOVXTvNOmpJgb4vaOlyI8rA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802562; c=relaxed/simple; bh=i4d7sd3yQU/0Cg6+DkY2bKY+7qcWwb5wLX8OMJ1co/w=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=aABoXAM9zR6ryyXFTYzwr2ZAaYBVdAq52bVfzUiQ+REkDElMovFLljGvPtB+b1srmoHzV5rDTRySfJpjRxCx4kGak9VmoRKRdDMhp1FKTjIVpvUsHMTEA1dDx3AbeofUR5INe59MsQM7gAznGPBhq9+e5REsU4gNVfmp/so434s= 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=OTmoVbSS; arc=fail smtp.client-ip=40.107.241.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="OTmoVbSS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Gifn+qoJuVMTh8ayl2p8U9HO9/sgBTlQbOHDco33+GrLkSSXZ2DkkE0fUVuZxqjiav+I9/MEpBiJ8rui2CgebUyX++VR1fo13AJcnOyJdjMBQilN2JfqC6cRdr8XA55d4MBtSpEHm8ArWHNbP6QEEGcIxc2HuZsNdxCLb8BHUTjqOPeBAbN4RXeqY9h4+AEDiUzflTQdovtknAz2JiH9mus0QsMOvMKBgaMBm77lLzCOMbiVy2Ng7TjMEBD+a2cpteDD/dpwr8dGmDzuGSzgeoUEZ/l/oNTwOvHte8wlw51BXBZQF9QXXS6h4T+OnyxNBD5yv/D2Y5jpdubyceTfDQ== 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=6Aii/uNy6ZXcLmek1tL8aJJUKXUMsseRVTsqG7jcHas=; b=ZOeoSSMPQ5Sot6qOL8kJ6EJCJ+koRkhXI/gwjy3KAGsEwJGg7BPDxAq2U3IsE6o5d+TNztsFGRMSW65DUHKERTENRJm6mI5Pk4DrC9WDufe0OHNbCuwv9BFbkSVqVJgNyTKRNCMoqdhOIAc3d4h3MyXEV+g7JrqGgI8Vm+MotLvCBmtoL8Gr9RmPrawipsJkd3u6LoJgyCuE5TXCsA1YOWUPvP0WKw3qYHrs74mAl7ORYqtrbdRw9Z0rekO9pgZ5VNyZ8RWf+T8xnSKoNds+lDyunU4QvLIt6U5ySoIdB7MGazEp/N/cqiNV0+haf2eCYYaY18jPF4jA/5dvuMv5NQ== 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=6Aii/uNy6ZXcLmek1tL8aJJUKXUMsseRVTsqG7jcHas=; b=OTmoVbSSQH09c/0KQycUIjriY/RkD2LpQlhKUElrI80UenfQkamrMbtuFD3DyAD4TyiojImkmgCLOVMYYr3ulA5Yn2Fs00vZwex8o0K4786GuRtdi+l7tfT3kJbRi5rKApnf/MgfQM9qrLwosET3aYkXbZfkgVbl79QF+6kzq8LanAl4Olk6G5uFro4xB8kWXMITGh0w/2oVwWouMP2T4Yg9DyXK27lIuDcw5VuUKm7aoGgj2PUJjzFVTwmIBLWZb6b1vEGrBruF2HF/iNbStHYjVFBhZtUjQTqHzLx+wswArOFm2u5A+rxs0NT3IdNFur1/NT4NXDcdxsoWKkWCQA== 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 PAXPR04MB8223.eurprd04.prod.outlook.com (2603:10a6:102:1c9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20; Thu, 24 Oct 2024 20:42:36 +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; Thu, 24 Oct 2024 20:42:35 +0000 From: Frank Li Date: Thu, 24 Oct 2024 16:41:46 -0400 Subject: [PATCH v4 4/4] PCI: imx6: Add i.MX8Q PCIe Endpoint (EP) support Message-Id: <20241024-pcie_ep_range-v4-4-08f8dcd4e481@nxp.com> References: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@nxp.com> In-Reply-To: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@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=1729802524; l=2809; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=i4d7sd3yQU/0Cg6+DkY2bKY+7qcWwb5wLX8OMJ1co/w=; b=n/QBCb8gXv8fK+/RmW+tOA/Iv/5x6pK3TBnUbHuZgoyU3+BeQJf9sj7HTQfn8cvvfG4OSPbKX zPGv/lkpaGqCBe1sMS9bPhdGGVVCWnubxf1Z1Fmui94v4KieIR/ZlRL X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0112.namprd13.prod.outlook.com (2603:10b6:a03:2c5::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8223:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a75c20d-9326-4e58-30d1-08dcf46c645d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?2Awmjf/d5JR3jDCgH0wpnJMaY0Rxr2f?= =?utf-8?q?rdOj9fZCgYAG4h5OzkwUIL/k9ksQjLgYY6HUr2wXNpmyaJpYj801FG5bdBP90KE5q?= =?utf-8?q?OuNpkzHcXIznF5Q0Ir1+ycrUOKWqOyGQqi1ssilE9ojw2hYN2XWOFO1ug1jhL9YqT?= =?utf-8?q?/X6Zek4KEmJAuH1eJlOTHJZRZ5CXf5c+AWChGAhelvxUgDfAj7piqhOVWIxpB3uF4?= =?utf-8?q?+JCXvgql9I1Sypx5ppcllmRYevWLn/RSKOhxHETuW761ysz8Vl3sJy9x5YYqXErXq?= =?utf-8?q?VrWdJkROCjQJCyJjqCApju2smq5ph3VYUNNqB4/bMJMgaqqgoKsC/dVJojaa0uF65?= =?utf-8?q?ufPBbTBV9KTfeAuY4nXidM7Ln05wWCXJasDW+91peI6nlqqPC+ZXiB3vinVDor39B?= =?utf-8?q?hg+DyeQib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/m8goyqBIxBkAiovYkJ22pIhqg6PPFXSKdWJOetB/gdPfC+LVwQJyjcs+qT?= =?utf-8?q?j1sDirOs6YVt?= 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)(376014)(7416014)(52116014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?SvXYqFGxhZUrMruJW7+sUbRnD398?= =?utf-8?q?vjL/YN5Pchk/8UodyKaAezDwP0tgnpVcO39c6IA49XsG1hg8QD35jOqlcNyqhB51w?= =?utf-8?q?pSLya31B2bAjD4m7Nwo3QlBrg6664q626DeFJudEP2Z1EyHU8woFP8ZIsstpKwLfj?= =?utf-8?q?UEVhPIOGdpWVxXfqrO/uW2CmbUhyzbMwSD6PisT8SMds0iH9mDrcsE3FijM7R2yvm?= =?utf-8?q?rKE5ukqP5dFWNZerKrSeHZNFxvni1ut6fIPuNdsRzXyDl8bZLL8j8cmgva/eBLul6?= =?utf-8?q?6JfP6hIYSdIfboEHZ3z3oNwKY6x2BOdEcuWIDhoGlswPG0Hi2FQo7AgN62TpMFzoY?= =?utf-8?q?u63ra1fjOek+gtb9NtoKSIhwbQLC6M8PASBynbqOzf/ezeD8pYUekPCfTSYkIIoJN?= =?utf-8?q?oPzpNdzv7jZwHTNoHrkVHb2SsxKOalSgG8HF82P1G6fDl0uaKy/r5WU5tQ120cxZM?= =?utf-8?q?5ZPadD9KvlfZIcRm9FmuYAPy/yAkUCf4QK8/Kk9aNvFt0RZ2EX5wp67gCdSsQ//SN?= =?utf-8?q?z4snNRIQAJZJaB0XghESL5pSIa1gf9XgvugwxBupBZOCKIamp1hcz3i0hA6ysbfW4?= =?utf-8?q?sJJLrnTl1GkiLOV0hsclTK4ppBp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XMRAdPzf2ABVuN79RCGnZl3oLKF2?= =?utf-8?q?ebp4EyB27va1?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a75c20d-9326-4e58-30d1-08dcf46c645d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 20:42:35.8805 (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: suGZ4zzq1NFUkGXoBoOx8sBQM8VckFKgsFmhawgacTE0GXfatWzmDmkLXQuHAjBlwXU3MGqCTdoj4GKbe/cqPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8223 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 v4 - none 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], }, {}, };