From patchwork Tue Apr 2 14:33: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: 13614222 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2112.outbound.protection.outlook.com [40.107.7.112]) (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 3929612BEB8 for ; Tue, 2 Apr 2024 14:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.7.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068446; cv=fail; b=iEbgUHfI4fzoYmuDQIku9MsxbZ6q2QPkckZYBIld+5d85X7pb+6VK1x/TzuSl4SOtft2YeyFxhbJi60SPW/7Qs2JXqHT7GtdFrri6C4VTzEj+b1KcYOsHDfE9fxDAz2HzaI7JmZm+NHuDSBifOUYMYYxY4RJRQeSxPHmPh3r2YA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068446; c=relaxed/simple; bh=oFrhAvDkPiH6FbfwAFFAWfQ0yeoJKFHcVP/7+dgzo9c=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Eyr4qSM9RjdxXKGUSrtP4DpXERmXe2tYG+jGofvkA6mgPhDj723uj9yFp9zcidUxCnvPa03IEk+XH0V6XKZTx+BRc9D5vbRYQkR7bl985TbsnkKIBTLRwCKb+IaXanmzYHFe67hAQ2Z0fu69l41byAN2bNyIp5/bou/IIyusYdY= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=hEpXEfhQ; arc=fail smtp.client-ip=40.107.7.112 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="hEpXEfhQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y+vMPWW6BQfCD1Lrqwbr9k8JwNkgzkuaSQXWxOr0CtRKLU2ksMAlTQVcPsz3Go7N96fBLUqG3SMnglq55Y9dJt6G8j09rvE/anQaxevPajhB48JIMYUJS8DiNhD5xwurKipLx7CoQChYS1NMy+UBqccF4KMlvxDwSoCSUWN1lL22bstPM6djgs98Zm06z3xRsNjcBnOC9pWgfETgQwqCL7qfDfyevxu5PeaP8PvO6HNMTqd18JQYQcrlEI5ks+FKxFSFCRqZxE+JoZgpx/kP4Tr3aKQifv2DeEPh7F+ryJntgEMUj6CmphxhnYimOS7nQhUdaUcEO2tfYj4DFTP50Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=4vLlHnnd8Qn9a+QeAE6o98MddlwPO0KdwdJnOc0DDO4=; b=X5XvygU9ZB6OQm8jjrBSAhvmVGOOjTiL/LF/0Yf4ipkMT5EH8Jkj+T41514QWvHXQHr5CoLVwfdahB2gZEJUl8BiJdEubQKN8VYiCp7clwyf6iHTh+gNrkjRtXJaCvN9OM77IS5EhrCC/POMKh9bOqvhgUriR+l+6gtI4haJIcvhQ+yxznAFwxPipa5ihLzpDctinYci2e5bfxwAOyMxztg51yoPF5G2hzl0AgDASXP9bWg7B8OUC1BrIBfpDK7fdP0zSAUiOMDpmxC6sJpiOyH38TbZdp+JCpULCzIBLJelOUwGVvfyPVKeK1OsIlNs5ImResCBvnkH4S7Hg3SS9w== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4vLlHnnd8Qn9a+QeAE6o98MddlwPO0KdwdJnOc0DDO4=; b=hEpXEfhQwr4j6owQP/tTxgISp64JoLyhdDp21t2XDkog5btB9rXBuPJJvKcnzM+k3YehJAZxtB6EUNHZbZXuYhphVbn4hsr3EDCYmvmMFfKb2wM3oq7m0PKKVMTNLg6xJr7fVAJjmxm/WBHJ4ggZ1tdej13xYYczpt4C0bTF5Bc= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DB9PR04MB10036.eurprd04.prod.outlook.com (2603:10a6:10:4c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:02 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:02 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:37 -0400 Subject: [PATCH v3 01/11] PCI: imx6: Fix PCIe link down when i.MX8MM and i.MX8MP PCIe is EP mode Message-Id: <20240402-pci2_upstream-v3-1-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=1447; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=fwfTwuHirPmN80ucIsnsea1YVqO/3pyYDwX/hpNsE20=; b=cpf7wDfc70epJ405TgW9w1xF69ts6WwKiBCrhfK6qmo9vv6iY8JdfL2ONvarN7FGHxNWS9VUb jiOAQ9oa2LyCqRrsidXc1mVL87qSv+r6u0/7HCKRH2f/71LQ+4m4mRS X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|DB9PR04MB10036:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kMJLPmZ6SUQnonnygLA3TvOSk9Mqw2DpxMizJxNjYqSGcsR0bpQNhXhCG0DG9uHhEXARtgGC3JUwoUner5ygsuLtB6kj0mu3D3otoH11wqbdDCXcwwK3PS+d9Hp/bTh8sRI8TVV/+0JHNXqevmCZCjbM5nnacrXIWyyncEl8bfu5WY1Cp0E8fQP+SoibVDH4/jBm1o2hnRegdeJIv5cxJM/DkeMJ7D5KSKO3CYexriP2PJ59rLCgSHJs46HN8TiQxe8MXEzLhVYW2CxV52WSJpfYllqQ80OTY5Ws8DrQTJSpaT+SthmZrt/NsCbw5R7L3AD4dI1GOW8paOOPhOiX0c82qd2bkyHozWcDUV/nI3+D0tdBDZBDt5Ydg0zMms7qhLTD1FMXs1f3eSaGuzTsMwANXBYU6tWDwJcG6O9xJYA6cMirEQYwFPvZRPYQZ0xyHA4yNW92tRdx/Z2KxZE1TYHXVY9+dYQ1HZ0C9uNWZjXFRvP0LWdxtq9QnDYpwUWHQmB9QuHoqp8J8+NzMm+GXjQg+4NooCnzZDCtPykXGFDHTY0EH1m9Kk1iSbFFoYJ3KuzJ/J/TwUwrKBAO51FLY5sixn/B0E5YfxSCEOe1DlSv5Cew355/ouwWFWOFj2NH0pPfHPtqyBSp2RSC3UkU8GiWYddpetHYaYKPrj4bLSJf740akY+mkZLYbDheieEtJzpSFqpi6+xhtPxdPNrpO6Cg36o0pThwqAQFVDFwvvg= 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:(13230031)(366007)(7416005)(376005)(52116005)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2zZs/WpSeN8czwhNRo8cRAP3CdGp?= =?utf-8?q?ATmHZYvyYYAA2gP01yDZuvahBpOKG33qdGnNB4kPiP2F8CcsSqN5SIVKYpDaftq/y?= =?utf-8?q?jblczonxHcCl9VpS8opRKoq/34k0dn0aRBGkYLxT9QrbJQpka3NXifXMBH5j7W7ow?= =?utf-8?q?6R4w6UiZ/A6GLz5TIdI2GRMVMULbdRwMrkA70KqUcCVh1We3lXxyu6bnE0Idxbl6Q?= =?utf-8?q?3xdvZwb3wFUcOCqa8MftSlCHhsrPtc4BfaXk2jx2APhCTIy0KdOFkhXyzaB1whH51?= =?utf-8?q?l9EL5q/zeAtjKLzFWPdivA7vbhZ0fA+Lq5RtdEvLKLash3xQYMvdQeEOzVetkeaV+?= =?utf-8?q?gJVTkAJNGdP4d95QjzOjiCACeLXccb44NkUPm9cr7vhPQGcKeFWh3vtqvjJQ8/JWW?= =?utf-8?q?bhL8HPKoDGU+mbjWYIDex98yFsI8b1OLDl/d2p2yA6J5AJoKadQAqCMlWn4WQUdYL?= =?utf-8?q?PK3mGdQ5oKBySWYJsbyBR0ko5vlijoQpBhtQTTm/ExHKAIdS1iQsMzV7Z5mgo6xRA?= =?utf-8?q?4BOk4HrPRz3jkAHrczSA7YYIypfAGl80HHVUSfF6cl1cUlnn1TIteLh320jJKV3AI?= =?utf-8?q?escSg/5mm86VfOry8GHBwsBfxvx3WFlWXZJnswUW1fxqWkXRP4NDSg/A1DbwQrJka?= =?utf-8?q?SpHDXNVKZG/mmUbW/PbLkROfpCVmT7o0HbIseBzuLfEnijUe8S4sHIpeF3sjziEiB?= =?utf-8?q?ND4Xrx+jTVM5lQZZR7SF4Gh/F2abknAPwHdPuW/D7GaZgwAf2aMAcMRnffOHE1UNb?= =?utf-8?q?FFgKFE8uvYNR+0tj/4u73xo1wuycZCXzXepWfkEqsP7bmuflTWs234p9523PeD9F4?= =?utf-8?q?cvu1VELUicCEZyBoFbji7bIbuNjVehZsLyl4YDpXrH8gdGcrqxZanWPZ/iJgY88/d?= =?utf-8?q?GxW3SLWEZjDufheMZ/4uR9ejHtYMxNMqWl8NheAphYVSshHxWcjerMxStxZDrmCWQ?= =?utf-8?q?rKvUAjgtfQw2z1e/4tS8gnjEZP5mShWcALL+txqINashLwtVdWcz1tPCrTPzrFXN7?= =?utf-8?q?hMdrCW4vKw5koU8qg/xhVVk+uvQXWFBgjLqTNBDrn98zUkK3TZb5AsY1QwiteUD6u?= =?utf-8?q?lM8cY3FOwo0x8+iFu3MqJN8l51Lwjs2ECDjOvACf6xFzrOQocGaPesB4s7FpPNVHs?= =?utf-8?q?u/7Gsx1Bv7f+9u7umRKSgQeBcr9Um3kxwrPE3fJTLId9F3w0CJr1TMc06poRtBS88?= =?utf-8?q?30js6xma29FTCz/HAeWid9YZ5cvSO94KbgmY4kenvhK22ic8hLTJnvO0t3Tp6BQOp?= =?utf-8?q?FaphlyXQ0+RsTyF3pbWf0vo98fD7Yx/xP3UiFZL1h9J9+KgxfpYptbf7zk7S5LIuf?= =?utf-8?q?mGnh//2gLbUElpkcf1r2JQu790uE6DZNnTxzzbVau8P6SRv/QL5q5vJLxuyTrVi6f?= =?utf-8?q?gTUgu+4JmhYcCAo3d3MULGqB+Fc7mbKaNVv9ZAXDbpDctHdG2sN18qZMSOh+5+CFz?= =?utf-8?q?e1gSoNQxyTRb3nM3L8YImJeTd5+q/2tQP+mb2cqay0I7oTnORUy6conV/ow4SJPcc?= =?utf-8?q?r5Z591rZP5Nw?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2006daf0-3c94-4a70-f873-08dc5321f0f6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:02.2358 (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: F8HfaRU52B3LBcW/m6t1CbuWa8UQlRw9gEg41cHByAVsZ1QPKPrhLAo/Djj0Ua4QXxqGwFSD8JZdGhQu3aLZEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB10036 From: Richard Zhu Both IMX8MM_EP and IMX8MP_EP have the "IMX6_PCIE_FLAG_HAS_APP_RESET" set indeed. Otherwise, the LTSSM_EN bit wouldn't be asserted anymore. That's the root cause that PCIe link is down when i.MX8MM and i.MX8MP PCIe are in the EP mode. Fixes: 0c9651c21f2a ("PCI: imx6: Simplify reset handling by using *_FLAG_HAS_*_RESET") Signed-off-by: Richard Zhu Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 99a60270b26cd..e43eda6b33ca7 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1568,7 +1568,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM_EP] = { .variant = IMX8MM_EP, - .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, @@ -1579,7 +1580,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP_EP] = { .variant = IMX8MP_EP, - .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, From patchwork Tue Apr 2 14:33: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: 13614223 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2090.outbound.protection.outlook.com [40.107.7.90]) (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 EDE5812C814 for ; Tue, 2 Apr 2024 14:34:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.7.90 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068452; cv=fail; b=My7i4lpwUx//uVnSjny1TLnIBCzVxiH+w+PMhBpiSRX0B4Psyz9dcn8XYbxFn4y33+zigObhfDjRy+bn+QZkxJejLW6SOsbwRm+hPMyWYoA0+GoNua1gB8+Z3+6532x0omfZzPYd+QIV0pgIVSe+AiZH8IRanaQPM3B6pjQkTKo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068452; c=relaxed/simple; bh=DVWGt16ZkDjrpGlf7ZmoFMuh0WPhyhcGXUgdS2u0B7Q=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=mjvWZIjf3YFYvuVWOioUKWSBTIeL1MiHuiCH8pmFGIsI2unSySz9tsJHt1dSy4jPft3tkW/yXdtI2EWijWyVW6bbsNqrd/vDT/6AdR6abctdrLd2xUXz22w+phF93gFR6qnnoGgazm+fyJ271VI90whZWozkQ9lt0PHEjqOlCOw= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=EmOZSVHR; arc=fail smtp.client-ip=40.107.7.90 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="EmOZSVHR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=URjfrZwQVheVP3napiZ/OeF8YE3vAAhMik3f7uha97hgXCcT7ExgM4yef1/aKAOEUWwfOBgmnyUsT9hXN2b9ztro/IbmwLFyNubj1ZEoLnjM9a7YXouxIbWWnyD8zMaj3f3IOpw4dk1uJZcDNzKNCzKASlLv5a4597ygS2gtRESzZzeu2AOQINMZ6riZ7MaNaLaG1TVe2BUgRLeUmPv7eTMQ4f0jQMq7sFZ/4XTJysCznNx8L/qwXipiOPjXTvEOPK0I4OfKajWdcRvWO0TFON/6MIT2fiCqvppzRWq2XcddbaTHIXE2tAsETbvG8ePcPvBXXuCIq90KbzlENJbpcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=OvmYICRW60IA3i7sGyBZdqkWQTTksPH37Wf0u9XLh8U=; b=bSKMwsZKk/1P12mmrlOWe/1/veR/8wYz0gCy1X9kp1d+dlij+nBm8KCuPU8ZplXNKexFoS3hKycmz0n/L3eIBCaKtSO+2/znMzajoqVjxilBNCOmNAv3ckRwQGwD2gPVUJ3jDK9liwikOdprU6uABlDZ0WQRTqIsaZopuBV8Uw+sG6apXkE3+YhlDaLfc13TsP9nMdv8jJQgJlFA3ZM5n86wOCz5y0PFyYYf/NWj8UFx702rGJEZK5Idx0YdU5tBBADY0wCbUMqebDF82S+xj5BqyUKkIto0ZN6ZZRBwP9VtOINeG4p1rc796dDlWjV012+oFqRp0roQw9tvDADODQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OvmYICRW60IA3i7sGyBZdqkWQTTksPH37Wf0u9XLh8U=; b=EmOZSVHRC/MoIDUguwZ54ixxikOuoId340ur0S3Z8KLnRHf6nLGHcgtVV17mkVEcFTFv0bOQJaDfOiluK5MVBoWbp/TFZF3XCFNyz9E7gmcdbv5j2oJSbmssUcvIFctfr+JWhk3+zj7hCXO00jFkkLf3SnP+30MdWxZACtPJEtM= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DB9PR04MB10036.eurprd04.prod.outlook.com (2603:10a6:10:4c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:07 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:07 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:38 -0400 Subject: [PATCH v3 02/11] PCI: imx6: Fix i.MX8MP PCIe EP can not trigger MSI Message-Id: <20240402-pci2_upstream-v3-2-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li , Jason Liu X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=1224; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=wkqaOQNbAPl8jcfm4U/1iKLk2FvgNgK2azcC4lLlLiU=; b=RnYRF2rkC2glE0yYsLaNUFVJ7jqpnzBN2j/X75UrRaWnYZJUXk4coQmSx5xkhbS7BFFwB9V7T dxkNZsUe3lxC22IRSG8z3Ri+Mmua9dKUSEvA5LqdFvg+HSqoXgwudlb X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|DB9PR04MB10036:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: un8Qd0pNSCCUu8qwK1sKXEI72oz8fmaWNqVoADBDXLKrxXsjX60yYJbULTBy/IEZkd00m21ASRZHC4bBDVOi6yoYkbtJNNsUJH9LF+vsV78rY7MEN6Tt1MUDRS/ZlsIyB6sgsAqEcEJ709hS35kC4brphPTZcdMo7a/p0YCLal8qbMkGx6osk3UMT/uPYpQjyjyA8bvFwQ5Lm4Wb3DsYObNOwlCMJVJFxD/FvVZORSuDz6oc++sfIqOcV82/VV76IXBTeSVHGDOLsM4sYqbt/2F3thD2+i4CiQkAuRApV7q8VF0MguUHlTUBDMyN3PI5Ew+2F10cHUbxeJ+jMhbSCMQ5irVJcmghg5PP92WX7zc0m+lzxizrA6+LMporkF3g3cFBU9S0UDUfHSypOs1AKL6FRIPcGaAWwyEnskKE7JaCf5/bySiGy1tQv3oq+C2kl0fDqXoytKWnykPbE4kSOFbquKhpEJ3rMsmS46n9R4KAojsR0hKFpBvaD8qQl5x1BAJ8GdH+IGGfXyxQvbQPIersRwF4qjG4YesIi9cayQQ2CeD//4isdgWKVdg+SHfiMF1wqSZLKDc+CClE6mClFp/7TPq01AlY5ufwYme/tKWQBhHgt+BLd/VsLEn4GE5JIaCQcoJcI0JoQtJToOM63N2FT27gRYH8nyJQ7rhZW+s7HtaBw2XdX/2j7pNC7O2j6wlj5kVAoYKPxzpl9GUD5hT1ThrfHnFfVShnOQsTIC4= 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:(13230031)(366007)(7416005)(376005)(52116005)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?hQfufLRgs2r8IOqeKBz46qWT53B8?= =?utf-8?q?RSc3rUt8sxav5dfT9bZbpy/wn+Xvl1WSU2a3v9rE9AEMHBCuvPpYtB5K+oZrsRIrU?= =?utf-8?q?W43zXfP4AD7kIInwBTVt9XzZKN+n336S49QFdDrAavZ4vsIYOuobc+VW9zRBL9L7l?= =?utf-8?q?GI7O/YW0dBzMeVge2g1oJw4UaWm72fqgG8fL3xGjUhCMx8ZVLI3PJOQVqtbzN+C8G?= =?utf-8?q?POSs6LzT7JTiHnk/VI4hxm+b3i6Tuh0otikWSRn6ngQee+DOraOMpPVoxgGTHf4J5?= =?utf-8?q?QSsQ7gWAONE7JWE1DhHV14UZXcrcgaE1yo+KGR4WfWc9QCJ4RubSSP4e1p2HS1XzH?= =?utf-8?q?/n7+e0MPJmi5gVfSk1xBBM+QcLBfFMseliK8A6XeyZXR0nIR+lhc2ZsNP15yNO6XP?= =?utf-8?q?30r/9tPz/UXflhI38otO0ZWe3YpQ8CeuvRq8r1nyKgODa/w7lps1uTBBLgXoSE04o?= =?utf-8?q?smGhpx+nyC6jdH6Te3DXXEwgXRfEfXY0DVvpn/9iwyNUybb29K+KeRZ9uI6C1Hv1l?= =?utf-8?q?y0uKEc7/2+AcNHaaBijXt9cKmi2VdY91QL9VfuL2B1X6GlbC4lAW7YnW/Swm5vnob?= =?utf-8?q?nxwB9mKd2rlnjM48qflPd96gghBrN9z7CXtoqPY/8EzuC7KGdh3PvDvDKLK0iz3Me?= =?utf-8?q?jEtW7BH2ggT0CjTL0jZPmuCrhenIjythOFjewPG+t6ZzIwo/XhsowsiWsphfMweb1?= =?utf-8?q?16JzVrHor1xTHsVaawrcVOOkxctl6hQqoXZ+RdLbXr7TTDjEqDDBP6P+SR8sMMzNR?= =?utf-8?q?YtolzF/p0tTXjE3CAM9MxMWHy8TeoZqTiAkqo8l4AlZY5SRQqpcV6BNzoG9WH9HhL?= =?utf-8?q?OgCm/S4QGv/24IbaoiEJvK9sI1X38thsiFXkFQuzHh8yWZW9wvWLq8HJFEG3m3HBP?= =?utf-8?q?J0mHoexqcp/rlztCj4NE9ZeYLC5DmbB4FTC/Jaf8snuLHR0tAQyX4OP3E2tOl6Qar?= =?utf-8?q?08tbOLO2JHZbbjaDBbbVMbV8CqejQhHMF6IrS4wFEN4K5pHvboAS8xvRYNo6udqOD?= =?utf-8?q?3Q/UBDizUF3B/0zQ3QGliH9Zcc3TYjQMdWd2niVCOnjS2UlurN8RuPKT9af4MJOo2?= =?utf-8?q?J24nYo3jxcYSZojhYVJh7KzJXS1s+9K0XaMcCxS/zp3CyZUbDK/nSrN8WZ/THTshl?= =?utf-8?q?KWqanq2ZZmgURxSF6Bskn4x66fd4aSVCap54wvdcy9QKYgD9/h5wVpShLamvQZK74?= =?utf-8?q?8WDo//RtYOAocrsvgP2xDCYEO6YYtr0MOcUKlGk2BXjbqwEmcv4E1nNzZa/aveYJD?= =?utf-8?q?YKwRJvo6XveSdiV4mkAw3Aj49VimTphMBhIhcEKdq/SVHCo9v1RBauc1Vjm+/fl4O?= =?utf-8?q?rC4BDM6hgTIHcuTP/AMjyn23t4L2EA84e8AQdok+GZyshWlu7KhrQJjycBmZs+Ky7?= =?utf-8?q?qghCBitfe/kgFIwhS1oBKCKvrjIsXx/ikWysgTg06NWrQQsKQtAek+sr4T3zn1yo0?= =?utf-8?q?yyGtStYlAYnFmkR/FBKERSOT0w+JlIsXIegldQTwjJ5POq0ub3MIlgCRW6N9POAQu?= =?utf-8?q?o6FMUeroF5mc?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2e5d60f-08d6-4790-6341-08dc5321f3fc X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:07.3435 (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: VGC2SLRAZ4fES+DOF6BtFygjzVBjlptlAs2HYNK8+TAzO6+qcNnWYQUt9PWWTmsmYRyxRSVKqQu0lInv77WwvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB10036 From: Richard Zhu Fix i.MX8MP PCIe EP can't trigger MSI issue. There is one 64Kbytes minimal requirement on i.MX8M PCIe outbound region configuration. EP uses Bar0 to set the outboud region to configure the MSI setting. Set the page_size to "epc_features->align" to meet the requirement, let the MSI can be triggered successfully. Fixes: 1bd0d43dcf3b ("PCI: imx6: Clean up addr_space retrieval code") Signed-off-by: Richard Zhu Acked-by: Jason Liu Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index e43eda6b33ca7..6c4d25b92225e 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1118,6 +1118,8 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_SUPPORT_64BIT)) dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); + ep->page_size = imx6_pcie->drvdata->epc_features->align; + ret = dw_pcie_ep_init(ep); if (ret) { dev_err(dev, "failed to initialize endpoint\n"); From patchwork Tue Apr 2 14:33: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: 13614224 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2131.outbound.protection.outlook.com [40.107.7.131]) (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 2243212BE89 for ; Tue, 2 Apr 2024 14:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.7.131 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068460; cv=fail; b=ihLo6l2s7dYKGKvD72rZpe3/UOlubY5EGYdnlVK90NqrvCjmDwx/l5wj0qrjFT0Jt7bTXXQERkXerdXv937Jm3bzSgGSn0SzrEdruwZETdwsWyJyjthXFIS7C/NZGGx50//P0EzsYFmiKo8QN9w/Oh90NrXQBHIPsRAgYmp0kiY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068460; c=relaxed/simple; bh=PW4KrL6KdmxPbtldRpq0HaR/m9eNLVFiDAsRCNy9+Fk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=W+z2le9pIw8hvkwBacgBOSapED96xMsQOMWYDmUCSKS4Jecdf63kDskome10pED74iTzYMGVHomu97cJg69SstxkhlMDXS+bzJEeoUhf0PhwWlfHESp9kmF0wwx19hrJXl7Pn5gS6Q1b5OYJOREbr3MuLmvwcZnI//81k7qwo8M= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=qSLgGpef; arc=fail smtp.client-ip=40.107.7.131 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="qSLgGpef" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CFzdO9ji2tzXq8aJNJRLf43ulAiKcMAIsW7ySlPEJwYAK0AcMvT0DYGoS/gdub4WHtC07W4zygBnZFfF/80z9iwdvgr3CnPQK+X+I4Bug8Wd4aDzGvcgjU3q/VKo/uf4gUoqaEMhzSFaq/pR91FYwKuxk/NxNLiOQMqBuSYaZpK4wYpjLwpjW5o4VzI8PJ9aenuzMFO1isp5biReUZAHTpaylIcYQmZzWYytTOcnKPMeXJpPY2QosV/ria1f7eygXskbgKZo0uswbRY9nmSVItEUNymuAHkRCXM3mzv9I4RNV4+nJXhmVjRUjHVvWf5xT5oaUOIv4JpwCAEXFcUhmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=wSOOTnuiiMNDwqeUxfJ8mIS7zXxA2z5DpboYN94dWhI=; b=aApD6eH7nSVJcSZoSkE3IG+R69kDRKEE0WHZTBkm70KjOTk5fVDX64OGEIqWRS97mFnsb335ZXgJpZgb5kD9XfN2dhdIlR6+2r0ChyzMJ7moxBG2gsVVOvREXrsx/DRMahb0twNZu/N9nCSryaqubdEbVAR7TokS67K7x+ZLAzCyFQr1KxGztKZioYzJ3siMj8zSZFG7Cv6psxZXxSSZoLyOfymkdyvDrXZtsSo3BewbtCUli3NXVamF6u80F6TW65vxnmSVNS3mDB6T0temjci1v0wjI0VQhTL7U/VBBfwrr2wEhHvlyoqVhn7mhh2BwywktgdgHRke1KVZ8xutxA== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wSOOTnuiiMNDwqeUxfJ8mIS7zXxA2z5DpboYN94dWhI=; b=qSLgGpefVXsupv99Yyd5cCAskBHki6FkdYfyWjJahmbpm0zJI2Vw2h0c5vJr619owqBnsgL05Ofy0grgH3gCu81zZUIBUpWNgAjYBSmD+GTRXLWtIUffdibapXCUrktDl4s37Jl5WnRAZWuL2UXzx2yxp9BBa5ZKWnG5rkMs2vM= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DB9PR04MB10036.eurprd04.prod.outlook.com (2603:10a6:10:4c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:12 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:12 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:39 -0400 Subject: [PATCH v3 03/11] PCI: imx6: Rename imx6_* with imx_* Message-Id: <20240402-pci2_upstream-v3-3-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=59766; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=PW4KrL6KdmxPbtldRpq0HaR/m9eNLVFiDAsRCNy9+Fk=; b=hw5al6jKlYDU5PCmqcyl8s15DMUgLD1vr7Nd8/z7aV8Qj/9Ou9vzvsr46nHoSfrSrGAGLmUU0 dZcu2pdrH8ADwRUupLtpxNdweWkZjKqJtbeQUmORZZy/J/E+L2IvdLD X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|DB9PR04MB10036:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fuqOczzkO7rGMTYWPAICpz1JclmdNwAAHvPLO9cREhiP3zFtxEv17sOhOaj6uIUXfSuKCuIVztYJzcZlazB4R6RpTVIfXkhP4mUASvAOvlBpNlOT2ynnF2qvjwj3l+0j5UnPIma3gR0znOrouywcYZ3Yich0BZtLWzMrgAR9QqRykrt7hUzc/82c6esA627FFo7Ttdrbwvih6m+h5qwlStUry7CT+fvZZISHUh04hGXytsWPaUPOcETmYXtalQP9gMivoESj4CzcXABNkpbUdbwJuM2kFxcR6ok6qnaVLMeAJsFr5VJLgeUkQbhKzQmBspne4c7jbLW3/Pjgibt960HZvssp/6Dwjz2peBwTtZOdFXOSpb8JhgS1p4IUocJGPKUQN5TpX8ONgkvxms3KkemLJEn85JL8He4vuD5wFcampP2IX6senEdJ/dhXzKtJMjzS2Wg0zzykYsKVR7rIkI6dSEDrD//JB7gAIxRiiBgkpExKrhUmgPmzLumi20IirayJkOQ0wanJ1siUrT0T29Fi3/TFxyJ3MrHNPLvseQdWzvB71R8IvhybkUvg68c8waSzOUgS6v12Wv2mBIwTlhoI7Qg8+oSlQAn9sEKEaaSZ0tGXdecENoSTJjUziv8mx6W7QNc8Lg+nuEOVVyWoo0bZELKK98WPP8VrqRubxnjdUd1zV5ER3nxSZeEQQ2wX75ql9uQoYZiA6PZP2Y20gcie1TlDCsXNdLUSFYTBiLY= 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:(13230031)(366007)(7416005)(376005)(52116005)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?hVu/jZpFteG7mQpeEBNM39gbaGk+?= =?utf-8?q?fcIBzNVJvAfOb+BMZTbF+e1fo6pyQZdcf583vnmJuBM+OWffGNQXkM2PJhaEHKs//?= =?utf-8?q?ur3vSTVeTVHCIPUFPWZN6tr9kETfmCnNkx2WPATXl4IXOiPXUTHKskXCMAAeYflX1?= =?utf-8?q?PhWwk5RbIqtwbyMayAZ6tcbWtIekz72//WNlgOy2b+FpPs1KmNNAKtifv2u3rj0ug?= =?utf-8?q?Z3727JtEw0QlKm/CObSN72rJMnmQQISCAaiGIYFu9mczw8kQ/irOSfGOIuQ2DcC1X?= =?utf-8?q?ojS4kwD+S66T4zm2ql7Mwj5Kjb9wuuNkRRquCthDpoMRL7PqJvzB5wBDnhOhzJwCF?= =?utf-8?q?GHTbcQhwl2Qv3M/bGKbA+R8W/4ne6206tOMQOCD0WlHvTDRKze7cJr1ZaUEoAKu15?= =?utf-8?q?yC8JJYceIwYDrV+WA1AeWN9hrEun497OBuhQTnhheGL5RWxUJZGyQuzfm4HLYxroR?= =?utf-8?q?ftKiB0xPIPwwiacl6AGPfDusKP5H+YLrE7xAc2ELj382rDkvIGGZ/45WYrZ0AZ4A6?= =?utf-8?q?v4h/g6izDSDEmIKe6WYdCC8gB29MA4P2aiy8nN5cTurpKoGYnp1jghfFdqfbi8tGi?= =?utf-8?q?q7TIxEoDT7w6A7T24XZt4Bh2JhzoPU3b8p6gpmQYn8AfgEQkqVMgjbrBSKS8+mUPY?= =?utf-8?q?wZnyS5D8d+Y0Jn83MH3+dOD4plq2EsCNJSdVOXOxCEFvQ6f3s/A17AdWFw5rRiTBG?= =?utf-8?q?h4HpRvip/X85goSj5YmYDPdUMU/ZJZAVDKTd1CdEfxRtkxyLSzEDKV462mrQ3flpq?= =?utf-8?q?CLL2Bm/UGqK3MVfyD2HzeUgO4OiUMMr20DXoPQ50/Ou6Q2a+SIsqG4+V6P7+LYHxm?= =?utf-8?q?k3NQZ7XLfBAnzTen8Pqfkeu4HdTkMAAJKp0kHfb/o7VhD69v7wc8fsePzcDv2t4ep?= =?utf-8?q?Y7nWEuan7RXHdsdii3LOFoqzWsYlnBSTCJg1D5RPg3LGRaqnZm5UrDgax9jv0zzhw?= =?utf-8?q?nlbyATdkWL/lgHOYdjCs0rTjf0R3MPP0r70bO+Eu2yiY57AzmHgPCLrpMNwDapw0q?= =?utf-8?q?2AIf8wSArUqn/TPRcm1DgnhX8/Ll60JPOfVhI12VaJVE6SFBfSCihoLuJyEv9MnTv?= =?utf-8?q?7Ifi0iWWzepFsxW/3ikthr27CPbbepvsYhEgDOMAfFa2/E9S0tK4cAHz9iGuy0WEx?= =?utf-8?q?ntG6emeH/kiEM1rETFPC/fwH8uyacpvFvlNExwQdyzjW7B/ARO/H4ltKZZk9tp5hu?= =?utf-8?q?6kJYz2FSiaaEFLbMpEwEYYzweDqKKCoVzDaoi3hQwG4TpHqjbsSAZyP6Kx++curg8?= =?utf-8?q?/9xmGrpxvzIsg5LsuGR0mZZ1FBhocT+6GD8yA9R58AWx/9P03WSZMBUQNfmR4BJXu?= =?utf-8?q?fES0C+zhDMTtZ7/nzQFLuCRMOb9QIdARnrR2zI76cFXNKitiKvOkEZSUr7fUVgmLz?= =?utf-8?q?9MWiG4SK1Za5Yj3JxH4xfZk8SaXAzs0CuWRbTeUKtQae+Mkorx3tAGQGRuInho4l/?= =?utf-8?q?Zee7N4Y5Omu/qTLbC+LD3G21q4tIJzolREz92yq7LlFgAd9B6Pwp32ZTQT+Xqo5a3?= =?utf-8?q?jaDd9EPxsXqQ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce10aa77-ebf2-4433-08a6-08dc5321f6fe X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:12.5507 (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: 6t9wF1KAYxauFR8Iqsv4kS1ZyxQ2bpoSwx4idUvMO30dxLUYkd1SO9bL8se5XpjSTdDbv1Q+i3DFGMQ1/Ro8Mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB10036 imx6_* actually mean for all imx chips (imx6x, imx7x, imx8x and imx9x). Rename imx6_* with imx_* to avoid confuse. Signed-off-by: Frank Li Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pci-imx6.c | 760 +++++++++++++++++----------------- 1 file changed, 380 insertions(+), 380 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 6c4d25b92225e..e93070d60df52 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -55,9 +55,9 @@ #define IMX95_PE0_GEN_CTRL_3 0x1058 #define IMX95_PCIE_LTSSM_EN BIT(0) -#define to_imx6_pcie(x) dev_get_drvdata((x)->dev) +#define to_imx_pcie(x) dev_get_drvdata((x)->dev) -enum imx6_pcie_variants { +enum imx_pcie_variants { IMX6Q, IMX6SX, IMX6QP, @@ -72,25 +72,25 @@ enum imx6_pcie_variants { IMX95_EP, }; -#define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) -#define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) -#define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) -#define IMX6_PCIE_FLAG_HAS_PHYDRV BIT(3) -#define IMX6_PCIE_FLAG_HAS_APP_RESET BIT(4) -#define IMX6_PCIE_FLAG_HAS_PHY_RESET BIT(5) -#define IMX6_PCIE_FLAG_HAS_SERDES BIT(6) -#define IMX6_PCIE_FLAG_SUPPORT_64BIT BIT(7) +#define IMX_PCIE_FLAG_IMX_PHY BIT(0) +#define IMX_PCIE_FLAG_IMX_SPEED_CHANGE BIT(1) +#define IMX_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) +#define IMX_PCIE_FLAG_HAS_PHYDRV BIT(3) +#define IMX_PCIE_FLAG_HAS_APP_RESET BIT(4) +#define IMX_PCIE_FLAG_HAS_PHY_RESET BIT(5) +#define IMX_PCIE_FLAG_HAS_SERDES BIT(6) +#define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7) -#define imx6_check_flag(pci, val) (pci->drvdata->flags & val) +#define imx_check_flag(pci, val) (pci->drvdata->flags & val) -#define IMX6_PCIE_MAX_CLKS 6 +#define IMX_PCIE_MAX_CLKS 6 -#define IMX6_PCIE_MAX_INSTANCES 2 +#define IMX_PCIE_MAX_INSTANCES 2 -struct imx6_pcie; +struct imx_pcie; -struct imx6_pcie_drvdata { - enum imx6_pcie_variants variant; +struct imx_pcie_drvdata { + enum imx_pcie_variants variant; enum dw_pcie_device_mode mode; u32 flags; int dbi_length; @@ -99,18 +99,18 @@ struct imx6_pcie_drvdata { const u32 clks_cnt; const u32 ltssm_off; const u32 ltssm_mask; - const u32 mode_off[IMX6_PCIE_MAX_INSTANCES]; - const u32 mode_mask[IMX6_PCIE_MAX_INSTANCES]; + const u32 mode_off[IMX_PCIE_MAX_INSTANCES]; + const u32 mode_mask[IMX_PCIE_MAX_INSTANCES]; const struct pci_epc_features *epc_features; - int (*init_phy)(struct imx6_pcie *pcie); + int (*init_phy)(struct imx_pcie *pcie); }; -struct imx6_pcie { +struct imx_pcie { struct dw_pcie *pci; int reset_gpio; bool gpio_active_high; bool link_is_up; - struct clk_bulk_data clks[IMX6_PCIE_MAX_CLKS]; + struct clk_bulk_data clks[IMX_PCIE_MAX_CLKS]; struct regmap *iomuxc_gpr; u16 msi_ctrl; u32 controller_id; @@ -131,7 +131,7 @@ struct imx6_pcie { /* power domain for pcie phy */ struct device *pd_pcie_phy; struct phy *phy; - const struct imx6_pcie_drvdata *drvdata; + const struct imx_pcie_drvdata *drvdata; }; /* Parameters for the waiting for PCIe PHY PLL to lock on i.MX7 */ @@ -186,28 +186,28 @@ struct imx6_pcie { #define PHY_RX_OVRD_IN_LO_RX_DATA_EN BIT(5) #define PHY_RX_OVRD_IN_LO_RX_PLL_EN BIT(3) -static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie) +static unsigned int imx_pcie_grp_offset(const struct imx_pcie *imx_pcie) { - WARN_ON(imx6_pcie->drvdata->variant != IMX8MQ && - imx6_pcie->drvdata->variant != IMX8MQ_EP && - imx6_pcie->drvdata->variant != IMX8MM && - imx6_pcie->drvdata->variant != IMX8MM_EP && - imx6_pcie->drvdata->variant != IMX8MP && - imx6_pcie->drvdata->variant != IMX8MP_EP); - return imx6_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14; + WARN_ON(imx_pcie->drvdata->variant != IMX8MQ && + imx_pcie->drvdata->variant != IMX8MQ_EP && + imx_pcie->drvdata->variant != IMX8MM && + imx_pcie->drvdata->variant != IMX8MM_EP && + imx_pcie->drvdata->variant != IMX8MP && + imx_pcie->drvdata->variant != IMX8MP_EP); + return imx_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14; } -static int imx95_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx95_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_0, IMX95_PCIE_PHY_CR_PARA_SEL, IMX95_PCIE_PHY_CR_PARA_SEL); - regmap_update_bits(imx6_pcie->iomuxc_gpr, + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_PHY_GEN_CTRL, IMX95_PCIE_REF_USE_PAD, 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_0, IMX95_PCIE_REF_CLKEN, IMX95_PCIE_REF_CLKEN); @@ -215,9 +215,9 @@ static int imx95_pcie_init_phy(struct imx6_pcie *imx6_pcie) return 0; } -static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) +static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) { - const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; unsigned int mask, val, mode, id; if (drvdata->mode == DW_PCIE_EP_TYPE) @@ -225,7 +225,7 @@ static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) else mode = PCI_EXP_TYPE_ROOT_PORT; - id = imx6_pcie->controller_id; + id = imx_pcie->controller_id; /* If mode_mask[id] is zero, means each controller have its individual gpr */ if (!drvdata->mode_mask[id]) @@ -234,12 +234,12 @@ static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) mask = drvdata->mode_mask[id]; val = mode << (ffs(mask) - 1); - regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->mode_off[id], mask, val); + regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->mode_off[id], mask, val); } -static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) +static int pcie_phy_poll_ack(struct imx_pcie *imx_pcie, bool exp_val) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; bool val; u32 max_iterations = 10; u32 wait_counter = 0; @@ -258,9 +258,9 @@ static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) return -ETIMEDOUT; } -static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) +static int pcie_phy_wait_ack(struct imx_pcie *imx_pcie, int addr) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; u32 val; int ret; @@ -270,24 +270,24 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) val |= PCIE_PHY_CTRL_CAP_ADR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - return pcie_phy_poll_ack(imx6_pcie, false); + return pcie_phy_poll_ack(imx_pcie, false); } /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ -static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) +static int pcie_phy_read(struct imx_pcie *imx_pcie, int addr, u16 *data) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; u32 phy_ctl; int ret; - ret = pcie_phy_wait_ack(imx6_pcie, addr); + ret = pcie_phy_wait_ack(imx_pcie, addr); if (ret) return ret; @@ -295,7 +295,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) phy_ctl = PCIE_PHY_CTRL_RD; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl); - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; @@ -304,18 +304,18 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) /* deassert Read signal */ dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00); - return pcie_phy_poll_ack(imx6_pcie, false); + return pcie_phy_poll_ack(imx_pcie, false); } -static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) +static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; u32 var; int ret; /* write addr */ /* cap addr */ - ret = pcie_phy_wait_ack(imx6_pcie, addr); + ret = pcie_phy_wait_ack(imx_pcie, addr); if (ret) return ret; @@ -326,7 +326,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) var |= PCIE_PHY_CTRL_CAP_DAT; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; @@ -335,7 +335,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ - ret = pcie_phy_poll_ack(imx6_pcie, false); + ret = pcie_phy_poll_ack(imx_pcie, false); if (ret) return ret; @@ -344,7 +344,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack */ - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; @@ -353,7 +353,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ - ret = pcie_phy_poll_ack(imx6_pcie, false); + ret = pcie_phy_poll_ack(imx_pcie, false); if (ret) return ret; @@ -362,74 +362,74 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return 0; } -static int imx8mq_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx8mq_pcie_init_phy(struct imx_pcie *imx_pcie) { /* TODO: Currently this code assumes external oscillator is being used */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, - imx6_pcie_grp_offset(imx6_pcie), + regmap_update_bits(imx_pcie->iomuxc_gpr, + imx_pcie_grp_offset(imx_pcie), IMX8MQ_GPR_PCIE_REF_USE_PAD, IMX8MQ_GPR_PCIE_REF_USE_PAD); /* * Regarding the datasheet, the PCIE_VPH is suggested to be 1.8V. If the PCIE_VPH is * supplied by 3.3V, the VREG_BYPASS should be cleared to zero. */ - if (imx6_pcie->vph && regulator_get_voltage(imx6_pcie->vph) > 3000000) - regmap_update_bits(imx6_pcie->iomuxc_gpr, - imx6_pcie_grp_offset(imx6_pcie), + if (imx_pcie->vph && regulator_get_voltage(imx_pcie->vph) > 3000000) + regmap_update_bits(imx_pcie->iomuxc_gpr, + imx_pcie_grp_offset(imx_pcie), IMX8MQ_GPR_PCIE_VREG_BYPASS, 0); return 0; } -static int imx7d_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx7d_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); return 0; } -static int imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6Q_GPR12_PCIE_CTL_2, 0 << 10); /* configure constant input signal to the pcie ctrl and phy */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6Q_GPR12_LOS_LEVEL, 9 << 4); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_DEEMPH_GEN1, - imx6_pcie->tx_deemph_gen1 << 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_deemph_gen1 << 0); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB, - imx6_pcie->tx_deemph_gen2_3p5db << 6); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_deemph_gen2_3p5db << 6); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB, - imx6_pcie->tx_deemph_gen2_6db << 12); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_deemph_gen2_6db << 12); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_SWING_FULL, - imx6_pcie->tx_swing_full << 18); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_swing_full << 18); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_SWING_LOW, - imx6_pcie->tx_swing_low << 25); + imx_pcie->tx_swing_low << 25); return 0; } -static int imx6sx_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx6sx_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_RX_EQ_MASK, IMX6SX_GPR12_PCIE_RX_EQ_2); - return imx6_pcie_init_phy(imx6_pcie); + return imx_pcie_init_phy(imx_pcie); } -static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) +static void imx7d_pcie_wait_for_phy_pll_lock(struct imx_pcie *imx_pcie) { u32 val; - struct device *dev = imx6_pcie->pci->dev; + struct device *dev = imx_pcie->pci->dev; - if (regmap_read_poll_timeout(imx6_pcie->iomuxc_gpr, + if (regmap_read_poll_timeout(imx_pcie->iomuxc_gpr, IOMUXC_GPR22, val, val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED, PHY_PLL_LOCK_WAIT_USLEEP_MAX, @@ -437,19 +437,19 @@ static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) dev_err(dev, "PCIe PLL lock timeout\n"); } -static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) +static int imx_setup_phy_mpll(struct imx_pcie *imx_pcie) { unsigned long phy_rate = 0; int mult, div; u16 val; int i; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_IMX_PHY)) return 0; - for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) - if (strncmp(imx6_pcie->clks[i].id, "pcie_phy", 8) == 0) - phy_rate = clk_get_rate(imx6_pcie->clks[i].clk); + for (i = 0; i < imx_pcie->drvdata->clks_cnt; i++) + if (strncmp(imx_pcie->clks[i].id, "pcie_phy", 8) == 0) + phy_rate = clk_get_rate(imx_pcie->clks[i].clk); switch (phy_rate) { case 125000000: @@ -467,46 +467,46 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) div = 1; break; default: - dev_err(imx6_pcie->pci->dev, + dev_err(imx_pcie->pci->dev, "Unsupported PHY reference clock rate %lu\n", phy_rate); return -EINVAL; } - pcie_phy_read(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, &val); + pcie_phy_read(imx_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, &val); val &= ~(PCIE_PHY_MPLL_MULTIPLIER_MASK << PCIE_PHY_MPLL_MULTIPLIER_SHIFT); val |= mult << PCIE_PHY_MPLL_MULTIPLIER_SHIFT; val |= PCIE_PHY_MPLL_MULTIPLIER_OVRD; - pcie_phy_write(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, val); + pcie_phy_write(imx_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, val); - pcie_phy_read(imx6_pcie, PCIE_PHY_ATEOVRD, &val); + pcie_phy_read(imx_pcie, PCIE_PHY_ATEOVRD, &val); val &= ~(PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK << PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT); val |= div << PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT; val |= PCIE_PHY_ATEOVRD_EN; - pcie_phy_write(imx6_pcie, PCIE_PHY_ATEOVRD, val); + pcie_phy_write(imx_pcie, PCIE_PHY_ATEOVRD, val); return 0; } -static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) +static void imx_pcie_reset_phy(struct imx_pcie *imx_pcie) { u16 tmp; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_IMX_PHY)) return; - pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); + pcie_phy_read(imx_pcie, PHY_RX_OVRD_IN_LO, &tmp); tmp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN); - pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); + pcie_phy_write(imx_pcie, PHY_RX_OVRD_IN_LO, tmp); usleep_range(2000, 3000); - pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); + pcie_phy_read(imx_pcie, PHY_RX_OVRD_IN_LO, &tmp); tmp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN); - pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); + pcie_phy_write(imx_pcie, PHY_RX_OVRD_IN_LO, tmp); } #ifdef CONFIG_ARM @@ -545,22 +545,22 @@ static int imx6q_pcie_abort_handler(unsigned long addr, } #endif -static int imx6_pcie_attach_pd(struct device *dev) +static int imx_pcie_attach_pd(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); struct device_link *link; /* Do nothing when in a single power domain */ if (dev->pm_domain) return 0; - imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); - if (IS_ERR(imx6_pcie->pd_pcie)) - return PTR_ERR(imx6_pcie->pd_pcie); + imx_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); + if (IS_ERR(imx_pcie->pd_pcie)) + return PTR_ERR(imx_pcie->pd_pcie); /* Do nothing when power domain missing */ - if (!imx6_pcie->pd_pcie) + if (!imx_pcie->pd_pcie) return 0; - link = device_link_add(dev, imx6_pcie->pd_pcie, + link = device_link_add(dev, imx_pcie->pd_pcie, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); @@ -569,11 +569,11 @@ static int imx6_pcie_attach_pd(struct device *dev) return -EINVAL; } - imx6_pcie->pd_pcie_phy = dev_pm_domain_attach_by_name(dev, "pcie_phy"); - if (IS_ERR(imx6_pcie->pd_pcie_phy)) - return PTR_ERR(imx6_pcie->pd_pcie_phy); + imx_pcie->pd_pcie_phy = dev_pm_domain_attach_by_name(dev, "pcie_phy"); + if (IS_ERR(imx_pcie->pd_pcie_phy)) + return PTR_ERR(imx_pcie->pd_pcie_phy); - link = device_link_add(dev, imx6_pcie->pd_pcie_phy, + link = device_link_add(dev, imx_pcie->pd_pcie_phy, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); @@ -585,20 +585,20 @@ static int imx6_pcie_attach_pd(struct device *dev) return 0; } -static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) +static int imx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie) { unsigned int offset; int ret = 0; - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0); break; case IMX6QP: case IMX6Q: /* power up core phy and enable ref clock */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); /* * the async reset input need ref clock to sync internally, @@ -607,7 +607,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) * add one ~10us delay here. */ usleep_range(10, 100); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); break; case IMX7D: @@ -620,15 +620,15 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) case IMX8MQ_EP: case IMX8MP: case IMX8MP_EP: - offset = imx6_pcie_grp_offset(imx6_pcie); + offset = imx_pcie_grp_offset(imx_pcie); /* * Set the over ride low and enabled * make sure that REF_CLK is turned on. */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, offset, + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, offset, + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN); break; @@ -637,19 +637,19 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) return ret; } -static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) +static void imx_pcie_disable_ref_clk(struct imx_pcie *imx_pcie) { - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6QP: case IMX6Q: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, IMX6Q_GPR1_PCIE_TEST_PD); break; case IMX7D: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); break; @@ -658,17 +658,17 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) } } -static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) +static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct device *dev = pci->dev; int ret; - ret = clk_bulk_prepare_enable(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + ret = clk_bulk_prepare_enable(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); if (ret) return ret; - ret = imx6_pcie_enable_ref_clk(imx6_pcie); + ret = imx_pcie_enable_ref_clk(imx_pcie); if (ret) { dev_err(dev, "unable to enable pcie ref clock\n"); goto err_ref_clk; @@ -679,41 +679,41 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) return 0; err_ref_clk: - clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); return ret; } -static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) +static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) { - imx6_pcie_disable_ref_clk(imx6_pcie); - clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + imx_pcie_disable_ref_clk(imx_pcie); + clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } -static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) +static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) { - reset_control_assert(imx6_pcie->pciephy_reset); - reset_control_assert(imx6_pcie->apps_reset); + reset_control_assert(imx_pcie->pciephy_reset); + reset_control_assert(imx_pcie->apps_reset); - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, IMX6SX_GPR12_PCIE_TEST_POWERDOWN); /* Force PCIe PHY reset */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR5, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, IMX6SX_GPR5_PCIE_BTNRST_RESET); break; case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, IMX6Q_GPR1_PCIE_SW_RST); break; case IMX6Q: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); break; default: @@ -721,47 +721,47 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - if (gpio_is_valid(imx6_pcie->reset_gpio)) - gpio_set_value_cansleep(imx6_pcie->reset_gpio, - imx6_pcie->gpio_active_high); + if (gpio_is_valid(imx_pcie->reset_gpio)) + gpio_set_value_cansleep(imx_pcie->reset_gpio, + imx_pcie->gpio_active_high); } -static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) +static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct device *dev = pci->dev; - reset_control_deassert(imx6_pcie->pciephy_reset); + reset_control_deassert(imx_pcie->pciephy_reset); - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX7D: /* Workaround for ERR010728, failure of PCI-e PLL VCO to * oscillate, especially when cold. This turns off "Duty-cycle * Corrector" and other mysterious undocumented things. */ - if (likely(imx6_pcie->phy_base)) { + if (likely(imx_pcie->phy_base)) { /* De-assert DCC_FB_EN */ writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, - imx6_pcie->phy_base + PCIE_PHY_CMN_REG4); + imx_pcie->phy_base + PCIE_PHY_CMN_REG4); /* Assert RX_EQS and RX_EQS_SEL */ writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL | PCIE_PHY_CMN_REG24_RX_EQ, - imx6_pcie->phy_base + PCIE_PHY_CMN_REG24); + imx_pcie->phy_base + PCIE_PHY_CMN_REG24); /* Assert ATT_MODE */ writel(PCIE_PHY_CMN_REG26_ATT_MODE, - imx6_pcie->phy_base + PCIE_PHY_CMN_REG26); + imx_pcie->phy_base + PCIE_PHY_CMN_REG26); } else { dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); } - imx7d_pcie_wait_for_phy_pll_lock(imx6_pcie); + imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); break; case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR5, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, 0); break; case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, 0); usleep_range(200, 500); @@ -771,10 +771,10 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - if (gpio_is_valid(imx6_pcie->reset_gpio)) { + if (gpio_is_valid(imx_pcie->reset_gpio)) { msleep(100); - gpio_set_value_cansleep(imx6_pcie->reset_gpio, - !imx6_pcie->gpio_active_high); + gpio_set_value_cansleep(imx_pcie->reset_gpio, + !imx_pcie->gpio_active_high); /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ msleep(100); } @@ -782,9 +782,9 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) return 0; } -static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) +static int imx_pcie_wait_for_speed_change(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct device *dev = pci->dev; u32 tmp; unsigned int retries; @@ -801,33 +801,33 @@ static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) return -ETIMEDOUT; } -static void imx6_pcie_ltssm_enable(struct device *dev) +static void imx_pcie_ltssm_enable(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; if (drvdata->ltssm_mask) - regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, + regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, drvdata->ltssm_mask); - reset_control_deassert(imx6_pcie->apps_reset); + reset_control_deassert(imx_pcie->apps_reset); } -static void imx6_pcie_ltssm_disable(struct device *dev) +static void imx_pcie_ltssm_disable(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; if (drvdata->ltssm_mask) - regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, + regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, 0); - reset_control_assert(imx6_pcie->apps_reset); + reset_control_assert(imx_pcie->apps_reset); } -static int imx6_pcie_start_link(struct dw_pcie *pci) +static int imx_pcie_start_link(struct dw_pcie *pci) { - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); struct device *dev = pci->dev; u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); u32 tmp; @@ -846,7 +846,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dw_pcie_dbi_ro_wr_dis(pci); /* Start LTSSM. */ - imx6_pcie_ltssm_enable(dev); + imx_pcie_ltssm_enable(dev); ret = dw_pcie_wait_for_link(pci); if (ret) @@ -869,8 +869,8 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp); dw_pcie_dbi_ro_wr_dis(pci); - if (imx6_pcie->drvdata->flags & - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE) { + if (imx_pcie->drvdata->flags & + IMX_PCIE_FLAG_IMX_SPEED_CHANGE) { /* * On i.MX7, DIRECT_SPEED_CHANGE behaves differently * from i.MX6 family when no link speed transition @@ -880,7 +880,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) * failure. */ - ret = imx6_pcie_wait_for_speed_change(imx6_pcie); + ret = imx_pcie_wait_for_speed_change(imx_pcie); if (ret) { dev_err(dev, "Failed to bring link up!\n"); goto err_reset_phy; @@ -895,37 +895,37 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dev_info(dev, "Link: Only Gen1 is enabled\n"); } - imx6_pcie->link_is_up = true; + imx_pcie->link_is_up = true; tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA); dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS); return 0; err_reset_phy: - imx6_pcie->link_is_up = false; + imx_pcie->link_is_up = false; dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n", dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0), dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); - imx6_pcie_reset_phy(imx6_pcie); + imx_pcie_reset_phy(imx_pcie); return 0; } -static void imx6_pcie_stop_link(struct dw_pcie *pci) +static void imx_pcie_stop_link(struct dw_pcie *pci) { struct device *dev = pci->dev; /* Turn off PCIe LTSSM */ - imx6_pcie_ltssm_disable(dev); + imx_pcie_ltssm_disable(dev); } -static int imx6_pcie_host_init(struct dw_pcie_rp *pp) +static int imx_pcie_host_init(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct device *dev = pci->dev; - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); int ret; - if (imx6_pcie->vpcie) { - ret = regulator_enable(imx6_pcie->vpcie); + if (imx_pcie->vpcie) { + ret = regulator_enable(imx_pcie->vpcie); if (ret) { dev_err(dev, "failed to enable vpcie regulator: %d\n", ret); @@ -933,83 +933,83 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) } } - imx6_pcie_assert_core_reset(imx6_pcie); + imx_pcie_assert_core_reset(imx_pcie); - if (imx6_pcie->drvdata->init_phy) - imx6_pcie->drvdata->init_phy(imx6_pcie); + if (imx_pcie->drvdata->init_phy) + imx_pcie->drvdata->init_phy(imx_pcie); - imx6_pcie_configure_type(imx6_pcie); + imx_pcie_configure_type(imx_pcie); - ret = imx6_pcie_clk_enable(imx6_pcie); + ret = imx_pcie_clk_enable(imx_pcie); if (ret) { dev_err(dev, "unable to enable pcie clocks: %d\n", ret); goto err_reg_disable; } - if (imx6_pcie->phy) { - ret = phy_init(imx6_pcie->phy); + if (imx_pcie->phy) { + ret = phy_init(imx_pcie->phy); if (ret) { dev_err(dev, "pcie PHY power up failed\n"); goto err_clk_disable; } } - if (imx6_pcie->phy) { - ret = phy_power_on(imx6_pcie->phy); + if (imx_pcie->phy) { + ret = phy_power_on(imx_pcie->phy); if (ret) { dev_err(dev, "waiting for PHY ready timeout!\n"); goto err_phy_off; } } - ret = imx6_pcie_deassert_core_reset(imx6_pcie); + ret = imx_pcie_deassert_core_reset(imx_pcie); if (ret < 0) { dev_err(dev, "pcie deassert core reset failed: %d\n", ret); goto err_phy_off; } - imx6_setup_phy_mpll(imx6_pcie); + imx_setup_phy_mpll(imx_pcie); return 0; err_phy_off: - if (imx6_pcie->phy) - phy_exit(imx6_pcie->phy); + if (imx_pcie->phy) + phy_exit(imx_pcie->phy); err_clk_disable: - imx6_pcie_clk_disable(imx6_pcie); + imx_pcie_clk_disable(imx_pcie); err_reg_disable: - if (imx6_pcie->vpcie) - regulator_disable(imx6_pcie->vpcie); + if (imx_pcie->vpcie) + regulator_disable(imx_pcie->vpcie); return ret; } -static void imx6_pcie_host_exit(struct dw_pcie_rp *pp) +static void imx_pcie_host_exit(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); - if (imx6_pcie->phy) { - if (phy_power_off(imx6_pcie->phy)) + if (imx_pcie->phy) { + if (phy_power_off(imx_pcie->phy)) dev_err(pci->dev, "unable to power off PHY\n"); - phy_exit(imx6_pcie->phy); + phy_exit(imx_pcie->phy); } - imx6_pcie_clk_disable(imx6_pcie); + imx_pcie_clk_disable(imx_pcie); - if (imx6_pcie->vpcie) - regulator_disable(imx6_pcie->vpcie); + if (imx_pcie->vpcie) + regulator_disable(imx_pcie->vpcie); } -static const struct dw_pcie_host_ops imx6_pcie_host_ops = { - .init = imx6_pcie_host_init, - .deinit = imx6_pcie_host_exit, +static const struct dw_pcie_host_ops imx_pcie_host_ops = { + .init = imx_pcie_host_init, + .deinit = imx_pcie_host_exit, }; static const struct dw_pcie_ops dw_pcie_ops = { - .start_link = imx6_pcie_start_link, - .stop_link = imx6_pcie_stop_link, + .start_link = imx_pcie_start_link, + .stop_link = imx_pcie_stop_link, }; -static void imx6_pcie_ep_init(struct dw_pcie_ep *ep) +static void imx_pcie_ep_init(struct dw_pcie_ep *ep) { enum pci_barno bar; struct dw_pcie *pci = to_dw_pcie_from_ep(ep); @@ -1018,7 +1018,7 @@ static void imx6_pcie_ep_init(struct dw_pcie_ep *ep) dw_pcie_ep_reset_bar(pci, bar); } -static int imx6_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, +static int imx_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, unsigned int type, u16 interrupt_num) { struct dw_pcie *pci = to_dw_pcie_from_ep(ep); @@ -1065,35 +1065,35 @@ static const struct pci_epc_features imx95_pcie_epc_features = { }; static const struct pci_epc_features* -imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) +imx_pcie_ep_get_features(struct dw_pcie_ep *ep) { struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); - return imx6_pcie->drvdata->epc_features; + return imx_pcie->drvdata->epc_features; } static const struct dw_pcie_ep_ops pcie_ep_ops = { - .init = imx6_pcie_ep_init, - .raise_irq = imx6_pcie_ep_raise_irq, - .get_features = imx6_pcie_ep_get_features, + .init = imx_pcie_ep_init, + .raise_irq = imx_pcie_ep_raise_irq, + .get_features = imx_pcie_ep_get_features, }; -static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, +static int imx_add_pcie_ep(struct imx_pcie *imx_pcie, struct platform_device *pdev) { int ret; unsigned int pcie_dbi2_offset; struct dw_pcie_ep *ep; - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct dw_pcie_rp *pp = &pci->pp; struct device *dev = pci->dev; - imx6_pcie_host_init(pp); + imx_pcie_host_init(pp); ep = &pci->ep; ep->ops = &pcie_ep_ops; - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX8MQ_EP: case IMX8MM_EP: case IMX8MP_EP: @@ -1115,10 +1115,10 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, if (device_property_match_string(dev, "reg-names", "dbi2") >= 0) pci->dbi_base2 = NULL; - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_SUPPORT_64BIT)) + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_SUPPORT_64BIT)) dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); - ep->page_size = imx6_pcie->drvdata->epc_features->align; + ep->page_size = imx_pcie->drvdata->epc_features->align; ret = dw_pcie_ep_init(ep); if (ret) { @@ -1126,30 +1126,30 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, return ret; } /* Start LTSSM. */ - imx6_pcie_ltssm_enable(dev); + imx_pcie_ltssm_enable(dev); return 0; } -static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie) +static void imx_pcie_pm_turnoff(struct imx_pcie *imx_pcie) { - struct device *dev = imx6_pcie->pci->dev; + struct device *dev = imx_pcie->pci->dev; /* Some variants have a turnoff reset in DT */ - if (imx6_pcie->turnoff_reset) { - reset_control_assert(imx6_pcie->turnoff_reset); - reset_control_deassert(imx6_pcie->turnoff_reset); + if (imx_pcie->turnoff_reset) { + reset_control_assert(imx_pcie->turnoff_reset); + reset_control_deassert(imx_pcie->turnoff_reset); goto pm_turnoff_sleep; } /* Others poke directly at IOMUXC registers */ - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6SX: case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF, IMX6SX_GPR12_PCIE_PM_TURN_OFF); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF, 0); break; default: @@ -1168,73 +1168,73 @@ static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie) usleep_range(1000, 10000); } -static void imx6_pcie_msi_save_restore(struct imx6_pcie *imx6_pcie, bool save) +static void imx_pcie_msi_save_restore(struct imx_pcie *imx_pcie, bool save) { u8 offset; u16 val; - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; if (pci_msi_enabled()) { offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); if (save) { val = dw_pcie_readw_dbi(pci, offset + PCI_MSI_FLAGS); - imx6_pcie->msi_ctrl = val; + imx_pcie->msi_ctrl = val; } else { dw_pcie_dbi_ro_wr_en(pci); - val = imx6_pcie->msi_ctrl; + val = imx_pcie->msi_ctrl; dw_pcie_writew_dbi(pci, offset + PCI_MSI_FLAGS, val); dw_pcie_dbi_ro_wr_dis(pci); } } } -static int imx6_pcie_suspend_noirq(struct device *dev) +static int imx_pcie_suspend_noirq(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - struct dw_pcie_rp *pp = &imx6_pcie->pci->pp; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + struct dw_pcie_rp *pp = &imx_pcie->pci->pp; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; - imx6_pcie_msi_save_restore(imx6_pcie, true); - imx6_pcie_pm_turnoff(imx6_pcie); - imx6_pcie_stop_link(imx6_pcie->pci); - imx6_pcie_host_exit(pp); + imx_pcie_msi_save_restore(imx_pcie, true); + imx_pcie_pm_turnoff(imx_pcie); + imx_pcie_stop_link(imx_pcie->pci); + imx_pcie_host_exit(pp); return 0; } -static int imx6_pcie_resume_noirq(struct device *dev) +static int imx_pcie_resume_noirq(struct device *dev) { int ret; - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - struct dw_pcie_rp *pp = &imx6_pcie->pci->pp; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + struct dw_pcie_rp *pp = &imx_pcie->pci->pp; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; - ret = imx6_pcie_host_init(pp); + ret = imx_pcie_host_init(pp); if (ret) return ret; - imx6_pcie_msi_save_restore(imx6_pcie, false); + imx_pcie_msi_save_restore(imx_pcie, false); dw_pcie_setup_rc(pp); - if (imx6_pcie->link_is_up) - imx6_pcie_start_link(imx6_pcie->pci); + if (imx_pcie->link_is_up) + imx_pcie_start_link(imx_pcie->pci); return 0; } -static const struct dev_pm_ops imx6_pcie_pm_ops = { - NOIRQ_SYSTEM_SLEEP_PM_OPS(imx6_pcie_suspend_noirq, - imx6_pcie_resume_noirq) +static const struct dev_pm_ops imx_pcie_pm_ops = { + NOIRQ_SYSTEM_SLEEP_PM_OPS(imx_pcie_suspend_noirq, + imx_pcie_resume_noirq) }; -static int imx6_pcie_probe(struct platform_device *pdev) +static int imx_pcie_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct dw_pcie *pci; - struct imx6_pcie *imx6_pcie; + struct imx_pcie *imx_pcie; struct device_node *np; struct resource *dbi_base; struct device_node *node = dev->of_node; @@ -1242,8 +1242,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) u16 val; int i; - imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); - if (!imx6_pcie) + imx_pcie = devm_kzalloc(dev, sizeof(*imx_pcie), GFP_KERNEL); + if (!imx_pcie) return -ENOMEM; pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); @@ -1252,10 +1252,10 @@ static int imx6_pcie_probe(struct platform_device *pdev) pci->dev = dev; pci->ops = &dw_pcie_ops; - pci->pp.ops = &imx6_pcie_host_ops; + pci->pp.ops = &imx_pcie_host_ops; - imx6_pcie->pci = pci; - imx6_pcie->drvdata = of_device_get_match_data(dev); + imx_pcie->pci = pci; + imx_pcie->drvdata = of_device_get_match_data(dev); /* Find the PHY if one is defined, only imx7d uses it */ np = of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0); @@ -1267,9 +1267,9 @@ static int imx6_pcie_probe(struct platform_device *pdev) dev_err(dev, "Unable to map PCIe PHY\n"); return ret; } - imx6_pcie->phy_base = devm_ioremap_resource(dev, &res); - if (IS_ERR(imx6_pcie->phy_base)) - return PTR_ERR(imx6_pcie->phy_base); + imx_pcie->phy_base = devm_ioremap_resource(dev, &res); + if (IS_ERR(imx_pcie->phy_base)) + return PTR_ERR(imx_pcie->phy_base); } pci->dbi_base = devm_platform_get_and_ioremap_resource(pdev, 0, &dbi_base); @@ -1277,12 +1277,12 @@ static int imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(pci->dbi_base); /* Fetch GPIOs */ - imx6_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0); - imx6_pcie->gpio_active_high = of_property_read_bool(node, + imx_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0); + imx_pcie->gpio_active_high = of_property_read_bool(node, "reset-gpio-active-high"); - if (gpio_is_valid(imx6_pcie->reset_gpio)) { - ret = devm_gpio_request_one(dev, imx6_pcie->reset_gpio, - imx6_pcie->gpio_active_high ? + if (gpio_is_valid(imx_pcie->reset_gpio)) { + ret = devm_gpio_request_one(dev, imx_pcie->reset_gpio, + imx_pcie->gpio_active_high ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, "PCIe reset"); @@ -1290,70 +1290,70 @@ static int imx6_pcie_probe(struct platform_device *pdev) dev_err(dev, "unable to get reset gpio\n"); return ret; } - } else if (imx6_pcie->reset_gpio == -EPROBE_DEFER) { - return imx6_pcie->reset_gpio; + } else if (imx_pcie->reset_gpio == -EPROBE_DEFER) { + return imx_pcie->reset_gpio; } - if (imx6_pcie->drvdata->clks_cnt >= IMX6_PCIE_MAX_CLKS) + if (imx_pcie->drvdata->clks_cnt >= IMX_PCIE_MAX_CLKS) return dev_err_probe(dev, -ENOMEM, "clks_cnt is too big\n"); - for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) - imx6_pcie->clks[i].id = imx6_pcie->drvdata->clk_names[i]; + for (i = 0; i < imx_pcie->drvdata->clks_cnt; i++) + imx_pcie->clks[i].id = imx_pcie->drvdata->clk_names[i]; /* Fetch clocks */ - ret = devm_clk_bulk_get(dev, imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + ret = devm_clk_bulk_get(dev, imx_pcie->drvdata->clks_cnt, imx_pcie->clks); if (ret) return ret; - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_PHYDRV)) { - imx6_pcie->phy = devm_phy_get(dev, "pcie-phy"); - if (IS_ERR(imx6_pcie->phy)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->phy), + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_PHYDRV)) { + imx_pcie->phy = devm_phy_get(dev, "pcie-phy"); + if (IS_ERR(imx_pcie->phy)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->phy), "failed to get pcie phy\n"); } - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_APP_RESET)) { - imx6_pcie->apps_reset = devm_reset_control_get_exclusive(dev, "apps"); - if (IS_ERR(imx6_pcie->apps_reset)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->apps_reset), + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_APP_RESET)) { + imx_pcie->apps_reset = devm_reset_control_get_exclusive(dev, "apps"); + if (IS_ERR(imx_pcie->apps_reset)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->apps_reset), "failed to get pcie apps reset control\n"); } - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_PHY_RESET)) { - imx6_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, "pciephy"); - if (IS_ERR(imx6_pcie->pciephy_reset)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pciephy_reset), + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_PHY_RESET)) { + imx_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, "pciephy"); + if (IS_ERR(imx_pcie->pciephy_reset)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->pciephy_reset), "Failed to get PCIEPHY reset control\n"); } - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX8MQ: case IMX8MQ_EP: case IMX7D: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) - imx6_pcie->controller_id = 1; + imx_pcie->controller_id = 1; break; default: break; } /* Grab turnoff reset */ - imx6_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); - if (IS_ERR(imx6_pcie->turnoff_reset)) { + imx_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); + if (IS_ERR(imx_pcie->turnoff_reset)) { dev_err(dev, "Failed to get TURNOFF reset control\n"); - return PTR_ERR(imx6_pcie->turnoff_reset); + return PTR_ERR(imx_pcie->turnoff_reset); } - if (imx6_pcie->drvdata->gpr) { + if (imx_pcie->drvdata->gpr) { /* Grab GPR config register range */ - imx6_pcie->iomuxc_gpr = - syscon_regmap_lookup_by_compatible(imx6_pcie->drvdata->gpr); - if (IS_ERR(imx6_pcie->iomuxc_gpr)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->iomuxc_gpr), + imx_pcie->iomuxc_gpr = + syscon_regmap_lookup_by_compatible(imx_pcie->drvdata->gpr); + if (IS_ERR(imx_pcie->iomuxc_gpr)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->iomuxc_gpr), "unable to find iomuxc registers\n"); } - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_SERDES)) { + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_SERDES)) { void __iomem *off = devm_platform_ioremap_resource_byname(pdev, "app"); if (IS_ERR(off)) @@ -1366,59 +1366,59 @@ static int imx6_pcie_probe(struct platform_device *pdev) .reg_stride = 4, }; - imx6_pcie->iomuxc_gpr = devm_regmap_init_mmio(dev, off, ®map_config); - if (IS_ERR(imx6_pcie->iomuxc_gpr)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->iomuxc_gpr), + imx_pcie->iomuxc_gpr = devm_regmap_init_mmio(dev, off, ®map_config); + if (IS_ERR(imx_pcie->iomuxc_gpr)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->iomuxc_gpr), "unable to find iomuxc registers\n"); } /* Grab PCIe PHY Tx Settings */ if (of_property_read_u32(node, "fsl,tx-deemph-gen1", - &imx6_pcie->tx_deemph_gen1)) - imx6_pcie->tx_deemph_gen1 = 0; + &imx_pcie->tx_deemph_gen1)) + imx_pcie->tx_deemph_gen1 = 0; if (of_property_read_u32(node, "fsl,tx-deemph-gen2-3p5db", - &imx6_pcie->tx_deemph_gen2_3p5db)) - imx6_pcie->tx_deemph_gen2_3p5db = 0; + &imx_pcie->tx_deemph_gen2_3p5db)) + imx_pcie->tx_deemph_gen2_3p5db = 0; if (of_property_read_u32(node, "fsl,tx-deemph-gen2-6db", - &imx6_pcie->tx_deemph_gen2_6db)) - imx6_pcie->tx_deemph_gen2_6db = 20; + &imx_pcie->tx_deemph_gen2_6db)) + imx_pcie->tx_deemph_gen2_6db = 20; if (of_property_read_u32(node, "fsl,tx-swing-full", - &imx6_pcie->tx_swing_full)) - imx6_pcie->tx_swing_full = 127; + &imx_pcie->tx_swing_full)) + imx_pcie->tx_swing_full = 127; if (of_property_read_u32(node, "fsl,tx-swing-low", - &imx6_pcie->tx_swing_low)) - imx6_pcie->tx_swing_low = 127; + &imx_pcie->tx_swing_low)) + imx_pcie->tx_swing_low = 127; /* Limit link speed */ pci->link_gen = 1; of_property_read_u32(node, "fsl,max-link-speed", &pci->link_gen); - imx6_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie"); - if (IS_ERR(imx6_pcie->vpcie)) { - if (PTR_ERR(imx6_pcie->vpcie) != -ENODEV) - return PTR_ERR(imx6_pcie->vpcie); - imx6_pcie->vpcie = NULL; + imx_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie"); + if (IS_ERR(imx_pcie->vpcie)) { + if (PTR_ERR(imx_pcie->vpcie) != -ENODEV) + return PTR_ERR(imx_pcie->vpcie); + imx_pcie->vpcie = NULL; } - imx6_pcie->vph = devm_regulator_get_optional(&pdev->dev, "vph"); - if (IS_ERR(imx6_pcie->vph)) { - if (PTR_ERR(imx6_pcie->vph) != -ENODEV) - return PTR_ERR(imx6_pcie->vph); - imx6_pcie->vph = NULL; + imx_pcie->vph = devm_regulator_get_optional(&pdev->dev, "vph"); + if (IS_ERR(imx_pcie->vph)) { + if (PTR_ERR(imx_pcie->vph) != -ENODEV) + return PTR_ERR(imx_pcie->vph); + imx_pcie->vph = NULL; } - platform_set_drvdata(pdev, imx6_pcie); + platform_set_drvdata(pdev, imx_pcie); - ret = imx6_pcie_attach_pd(dev); + ret = imx_pcie_attach_pd(dev); if (ret) return ret; - if (imx6_pcie->drvdata->mode == DW_PCIE_EP_TYPE) { - ret = imx6_add_pcie_ep(imx6_pcie, pdev); + if (imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE) { + ret = imx_add_pcie_ep(imx_pcie, pdev); if (ret < 0) return ret; } else { @@ -1438,12 +1438,12 @@ static int imx6_pcie_probe(struct platform_device *pdev) return 0; } -static void imx6_pcie_shutdown(struct platform_device *pdev) +static void imx_pcie_shutdown(struct platform_device *pdev) { - struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev); + struct imx_pcie *imx_pcie = platform_get_drvdata(pdev); /* bring down link, so bootloader gets clean state in case of reboot */ - imx6_pcie_assert_core_reset(imx6_pcie); + imx_pcie_assert_core_reset(imx_pcie); } static const char * const imx6q_clks[] = {"pcie_bus", "pcie", "pcie_phy"}; @@ -1451,11 +1451,11 @@ static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"}; static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}; static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}; -static const struct imx6_pcie_drvdata drvdata[] = { +static const struct imx_pcie_drvdata drvdata[] = { [IMX6Q] = { .variant = IMX6Q, - .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, + .flags = IMX_PCIE_FLAG_IMX_PHY | + IMX_PCIE_FLAG_IMX_SPEED_CHANGE, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, @@ -1464,13 +1464,13 @@ static const struct imx6_pcie_drvdata drvdata[] = { .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, - .init_phy = imx6_pcie_init_phy, + .init_phy = imx_pcie_init_phy, }, [IMX6SX] = { .variant = IMX6SX, - .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | - IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX_PCIE_FLAG_IMX_PHY | + IMX_PCIE_FLAG_IMX_SPEED_CHANGE | + IMX_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6sx_clks, .clks_cnt = ARRAY_SIZE(imx6sx_clks), @@ -1482,9 +1482,9 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX6QP] = { .variant = IMX6QP, - .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | - IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX_PCIE_FLAG_IMX_PHY | + IMX_PCIE_FLAG_IMX_SPEED_CHANGE | + IMX_PCIE_FLAG_SUPPORTS_SUSPEND, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, @@ -1493,13 +1493,13 @@ static const struct imx6_pcie_drvdata drvdata[] = { .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, - .init_phy = imx6_pcie_init_phy, + .init_phy = imx_pcie_init_phy, }, [IMX7D] = { .variant = IMX7D, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHY_RESET, + .flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx7d-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), @@ -1509,8 +1509,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MQ] = { .variant = IMX8MQ, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHY_RESET, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), @@ -1522,9 +1522,9 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM] = { .variant = IMX8MM, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_PHYDRV | - IMX6_PCIE_FLAG_HAS_APP_RESET, + .flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX_PCIE_FLAG_HAS_PHYDRV | + IMX_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), @@ -1533,9 +1533,9 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP] = { .variant = IMX8MP, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_PHYDRV | - IMX6_PCIE_FLAG_HAS_APP_RESET, + .flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX_PCIE_FLAG_HAS_PHYDRV | + IMX_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), @@ -1544,7 +1544,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX95] = { .variant = IMX95, - .flags = IMX6_PCIE_FLAG_HAS_SERDES, + .flags = IMX_PCIE_FLAG_HAS_SERDES, .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), .ltssm_off = IMX95_PE0_GEN_CTRL_3, @@ -1555,8 +1555,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHY_RESET, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHY_RESET, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, @@ -1570,8 +1570,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM_EP] = { .variant = IMX8MM_EP, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, @@ -1582,8 +1582,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP_EP] = { .variant = IMX8MP_EP, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, @@ -1594,8 +1594,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX95_EP] = { .variant = IMX95_EP, - .flags = IMX6_PCIE_FLAG_HAS_SERDES | - IMX6_PCIE_FLAG_SUPPORT_64BIT, + .flags = IMX_PCIE_FLAG_HAS_SERDES | + IMX_PCIE_FLAG_SUPPORT_64BIT, .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), .ltssm_off = IMX95_PE0_GEN_CTRL_3, @@ -1608,7 +1608,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, }; -static const struct of_device_id imx6_pcie_of_match[] = { +static const struct of_device_id imx_pcie_of_match[] = { { .compatible = "fsl,imx6q-pcie", .data = &drvdata[IMX6Q], }, { .compatible = "fsl,imx6sx-pcie", .data = &drvdata[IMX6SX], }, { .compatible = "fsl,imx6qp-pcie", .data = &drvdata[IMX6QP], }, @@ -1624,19 +1624,19 @@ static const struct of_device_id imx6_pcie_of_match[] = { {}, }; -static struct platform_driver imx6_pcie_driver = { +static struct platform_driver imx_pcie_driver = { .driver = { .name = "imx6q-pcie", - .of_match_table = imx6_pcie_of_match, + .of_match_table = imx_pcie_of_match, .suppress_bind_attrs = true, - .pm = &imx6_pcie_pm_ops, + .pm = &imx_pcie_pm_ops, .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, - .probe = imx6_pcie_probe, - .shutdown = imx6_pcie_shutdown, + .probe = imx_pcie_probe, + .shutdown = imx_pcie_shutdown, }; -static void imx6_pcie_quirk(struct pci_dev *dev) +static void imx_pcie_quirk(struct pci_dev *dev) { struct pci_bus *bus = dev->bus; struct dw_pcie_rp *pp = bus->sysdata; @@ -1646,33 +1646,33 @@ static void imx6_pcie_quirk(struct pci_dev *dev) return; /* Make sure we only quirk devices associated with this driver */ - if (bus->dev.parent->parent->driver != &imx6_pcie_driver.driver) + if (bus->dev.parent->parent->driver != &imx_pcie_driver.driver) return; if (pci_is_root_bus(bus)) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); /* * Limit config length to avoid the kernel reading beyond * the register set and causing an abort on i.MX 6Quad */ - if (imx6_pcie->drvdata->dbi_length) { - dev->cfg_size = imx6_pcie->drvdata->dbi_length; + if (imx_pcie->drvdata->dbi_length) { + dev->cfg_size = imx_pcie->drvdata->dbi_length; dev_info(&dev->dev, "Limiting cfg_size to %d\n", dev->cfg_size); } } } DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, 0xabcd, - PCI_CLASS_BRIDGE_PCI, 8, imx6_pcie_quirk); + PCI_CLASS_BRIDGE_PCI, 8, imx_pcie_quirk); -static int __init imx6_pcie_init(void) +static int __init imx_pcie_init(void) { #ifdef CONFIG_ARM struct device_node *np; - np = of_find_matching_node(NULL, imx6_pcie_of_match); + np = of_find_matching_node(NULL, imx_pcie_of_match); if (!np) return -ENODEV; of_node_put(np); @@ -1688,6 +1688,6 @@ static int __init imx6_pcie_init(void) "external abort on non-linefetch"); #endif - return platform_driver_register(&imx6_pcie_driver); + return platform_driver_register(&imx_pcie_driver); } -device_initcall(imx6_pcie_init); +device_initcall(imx_pcie_init); From patchwork Tue Apr 2 14:33:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13614225 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2131.outbound.protection.outlook.com [40.107.7.131]) (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 45D9112F393 for ; Tue, 2 Apr 2024 14:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.7.131 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068463; cv=fail; b=gi+1CeBcdPffC+PSe3ic63kkNi36ihd/XRrqLkE7VNKzqWoQNxkYXmjTseqRh1a8jR1jBHXSwc7+VQBxQJ6zB/sdFSJmTJc1h3U5uFGwgmurXLN5zHTJscf/e5c1AaIGVuV2qM54hPcsMgZkh49+ogyc680lCmq6z3WKYIKzQMs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068463; c=relaxed/simple; bh=1r2H1hqe2HsquQcW5xHXQOeJXeR6VzCgSFRI6Lw/PzM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=WaBsAiRnz1mY9m6etFJmG4hvC2KxaLEqxgsOEGQeck/7GgDpH4pbhXCFcg1uXF6Q8Dexado5RHIySlYznFYMY3zX/oVGpFi+l67CwXDLkWZW/CgPV7deiTAtH/f8Ou4OL50CKkCfkmJNA9y7P+LWRF+2Eiy/f/Lahxfw9H1z/is= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=qV8UsHIi; arc=fail smtp.client-ip=40.107.7.131 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="qV8UsHIi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S3fDtIHLQfhC50Nomt+QFbGmUUODXx2M9uYY7maNIxp05kGI+/0VnOC2syK0xXHGhPsvNncG1lNizU8BiDZoF1J+6Lc4I9e4R7cPuOWpRrvR9BHVlwfGO216RU5N/4OSMYPPFTtlHWsrnXZVlxY0xLDjjRgfZej3srRmq8qDWdD5UjTH0oE1PTAQ3TEzjwugUzGS9DMRR80cWq0/YdWpmykqim149P+93NYNxwRvkuSB9EUceOppZaeQj4E+SoTrKcoQQ7im3I1S0wFJTm50Tk0bxbRHNyyu4SrCEyEMBy8MUDJkI4reEyOzvOzyu/4zdWnHlUPMSGxichgVuYDDWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=BTPBXfAX1P6YHzKk8sQ6o3YDjVYk1m+DwbidtzQix0E=; b=QtnooFjNX3Sk3Rxi5yJmfVovnJ8MP5s5rZOvoG4yK4wU4WCOJbMx+YFRm2So9htixspubFxODz6jC4mdcg0SUF7a4p96BimIa/RePVyC6i/krsug3GNf3bRcA6irYGDyPG19ipr8x4BWBhciMRt4mVi9koq4AmZkuoJe/sBVUB8qX74l8/mZnUOAeYuNrGeHXpH8pve8j4xYKQwiLk4AeaoVsajQuqssSc3YJYAHmAHsn5iBGH2NNK6rlK2+xWMwq9ImxQdwQoEialQP0yUqggCo1BhqmDTl7ACV9xLl88qKZ+I317Wvzq04dFM3fcFeh5TmTkUqHx1OoNrOvUs3Ww== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BTPBXfAX1P6YHzKk8sQ6o3YDjVYk1m+DwbidtzQix0E=; b=qV8UsHIi58jcqnr/J66MwYD6vGIYfmtjXlQtoKxRTDo3+jw+5K5v1kE1LQqgPwm7pDZ+MONY5lFE7XHJpIry2oelcsbYAHb0oOdSrCGzA6VPHtxALiGNaVQS5C8vBLkSpl+Dlts76DAZZluTMOmBXDcC66CmJK4bt9R2HUEkLdY= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DB9PR04MB10036.eurprd04.prod.outlook.com (2603:10a6:10:4c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:17 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:17 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:40 -0400 Subject: [PATCH v3 04/11] PCI: imx6: Rename pci-imx6.c to pcie-imx.c Message-Id: <20240402-pci2_upstream-v3-4-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=1420; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=1r2H1hqe2HsquQcW5xHXQOeJXeR6VzCgSFRI6Lw/PzM=; b=4vhMeFDdU4NfO4+DzVp1yOWAc8rlHxNKTnSn9X8PeoVpCKKpakXUwcSjOV9n951ZSEvB9VC9e wuJVFHNPLCoCWWvPxFBUZuvzgN4TZZiYnh29mE/+VS2V5ncioDv3qtD X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|DB9PR04MB10036:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xCbr/eX4PYoPSp08dDDAYwZk3H0xSzqnfq7dUn8CKGDOFD7Ckk+QIQgGHvNXRLSilwQS7JN6tXhldZGHDnDxaTkuMNeQQwxs2aTXqAGTBo1AgWBdiFlm+mkxrlWhSpasAxj3ZUyOzHCK2PDpt6JIFiEaamiBp8+ABqIPA8wM9WEOnc77Ew5rK7MhfXavJjq/gtN1N7ttsR0aHd+Gvu/BpMqFW7CG+Do77VqLRFCYKjRjab8vm3DHToJyh7yN46uDnAuhgj2HL9nsVZ6B//JKWbCDA+3dvLP9BAu0NKnqx+II4cq68d09oO92qPLHPa4f0XYHKvyWHRMzEitmh3XrnP8cQJHIhlV8q59u/uyYNLs4hh7RZ3b2jLtn7XbOSqpGOTLbUk0G/0oN6/NjfJvgA4FiuQCWMDbwPeGMpEn/jXmZUv98ZgQX6I1CJFWqVF+WfBKqPCFM1hcp7Gc5M9v0NbCrlaGMXiJY+CIT8tO+5UeFXNydyOMGG2OctNMCW0eRq//MHdpNVJGy4XPq8V0IssHzSNAmmWlXrk58EYIG6ngJdLl9HrCy7TQunvZUEpxYk3SwiaGSpQzBox7cVL2l7hpCWgzWtRAsAKSgwosqmMhnqe4lPDsjOQOq8nIi9aNKoBpsIVeP1D989eWEavLto7REgSHX5F/4NsuPmj3zEOHFQD2uuONarS6CqbdB1oj04h4miU16oc5+2wwlPJyvKHeY7u6Kht2SLPDlEcreI18= 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:(13230031)(366007)(7416005)(376005)(52116005)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?/roD3y/QwjWzXtjlzldUn/NgHK9Z?= =?utf-8?q?94H/HQWT+L1gWcEAPuvKkO4VUCDL0sfURWX2wIYYQP6+zr1ygA9+AD1dZ+rlEU5VH?= =?utf-8?q?9fb/x2x1t1e1nkvSHbO/7/8PGxicmGyJ0w2q/IidBoNOzzB7cIE0fFkTai/g0tJgi?= =?utf-8?q?MPx+8N9sGRgDZu0YdX0qvj++Xv0C7/wZU51p9RsR2PTr7yN1f5u8wH3JRy4m7NMH0?= =?utf-8?q?32D05bFJ0DtBRIEEQ/rG/cHYsYWf137LfPt5lGJtzFM/SmMRdgqUjLTT5uFHgCNvS?= =?utf-8?q?xT4Ea8cWad0c7mM2xXuYXNQ/D+qLEY3aHov0t3UQYxRAQtD59ik9O4MLCzuTGQRVS?= =?utf-8?q?GvlbXz2VkmrBKPqxsPo7+JjOE+sTDxPvCSEfYJ+T+XwJolYFvi+slOGBzWvHIM5/+?= =?utf-8?q?xJ4QItLJULwhJdi5VvyKyqBQENwNyjq1Ir7RQBv6wfFwEyB5AU8H8MIj8tU+kJn0F?= =?utf-8?q?dLjY/Q4QGeskz1LAn8fW4B1gmeke9QdVJbJt18/1pCB9eezh/5+woKQt/FOgO2wX6?= =?utf-8?q?OgiYgLEKY8MEeDp28xxxobX+0/aKtCQ0vohcwo2dD9ybaCwlpN7Ceh+jUjSff1RPS?= =?utf-8?q?R8rE9xP/AaAM/8OwQ2i6OtPmYDQ001KGqPHe3iQsSk6W8ALVMoGZ/cUhYKqMkThEa?= =?utf-8?q?RQoBDcRoEg+cv946Rew3s5MhFEE5vN067lk2Dw8whyJgMl2uuF3Un10+Tk4VoDtx9?= =?utf-8?q?w8HcZriBJvgsYGSfVzXJmKjjCf17i+1qiZLuIkjCXx2Zmwj3E8O+jwGqznM7H46XH?= =?utf-8?q?Eg/fDg2aQHuWhnmIQtCo0oQGKE1Jal1JOV5aVZM++MUB+o58fEekKs2LXRtIiOv7x?= =?utf-8?q?Mu6hjxL/mD88GbmBnk23Vbdk0E/wa0Fo15aIvAItItnj0rn2jBjh6r3I3UHiAh8RT?= =?utf-8?q?5SeRJkhD+tm8T9lnSoIZosA69qoPgHV6TG8HUv/RgsVjw+iX5eMGTbAQPkxyaoXV4?= =?utf-8?q?nz/VrOpFmk/Cm83Q1onfnJuujA/IAdPnu3A0BkutTCEQluQqsTGcv0sZzcyjqeoGf?= =?utf-8?q?EOSPmPJIsm26/N6O2Mk850/OoTPjKpaOsescedpfaLlzlveKCFtCjBV7hAKR0tfwD?= =?utf-8?q?rk3zNRUvLhn5l6wAoA5Frw5G5eo9ABgc96Ipl/pregJXWfzaIXlADsB1pp9BgI++Q?= =?utf-8?q?AGoKPNqZKyPsuKOvJv1FuCX7aPx1JVLO6k7FsDeEbjC6ZjO8Ak2xvhaydZ/7x8Ay8?= =?utf-8?q?sZm2elSDBwD+vY14/cSVgihq8HVDJjQ/OIn5YlZ8EOJ0NGUn+gcEFW4RyJZvk/COI?= =?utf-8?q?DnyVx9Z4iJeGw6hjt8d5uGSsafv+oxZgtXpfOqgNLXBGdOcAgRkkl8jQdYYFNgZmp?= =?utf-8?q?hoNRtHki95AQUB8S9lynF9B75VzVkU+8G3jhQn3vQ/az/JSP+hETJDR1/YaDZJLGY?= =?utf-8?q?EbYtMhV0HMZtLImF3dNq2Jk2SA1Gn5cPJJhvkSEUG+RxKlPUlfeskRYbc7K1Q9ayU?= =?utf-8?q?c2IBAREsabfZ/d8Bb0LuXDIgeWwESlPR/gNGUEysjSfhfRzU53v32TQA=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d800e46-4824-4d87-ee6b-08dc5321fa14 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:17.6350 (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: Qh29KrfikLEnw/rVOgOB0eFIuaagOm3HlDko3vMBnQRKeLgBmH6wEvqA7jZrLFSBQNQ6LF/A37WH4gepv7T+hQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB10036 Update the filename from 'pci-imx6.c' to 'pcie-imx.c' to accurately reflect its applicability to all i.MX chips (i.MX6x, i.MX7x, i.MX8x, i.MX9x). Eliminate the '6' to prevent confusion. Additionally, correct the prefix from 'pci-' to 'pcie-'. Retain the previous configuration CONFIG_PCI_IMX6 unchanged to maintain compatibility. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/Makefile | 2 +- drivers/pci/controller/dwc/{pci-imx6.c => pcie-imx.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/dwc/Makefile index bac103faa5237..eaea7abbabc2c 100644 --- a/drivers/pci/controller/dwc/Makefile +++ b/drivers/pci/controller/dwc/Makefile @@ -7,7 +7,7 @@ obj-$(CONFIG_PCIE_BT1) += pcie-bt1.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o obj-$(CONFIG_PCIE_FU740) += pcie-fu740.o -obj-$(CONFIG_PCI_IMX6) += pci-imx6.o +obj-$(CONFIG_PCI_IMX6) += pcie-imx.o obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone.o obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pcie-imx.c similarity index 100% rename from drivers/pci/controller/dwc/pci-imx6.c rename to drivers/pci/controller/dwc/pcie-imx.c From patchwork Tue Apr 2 14:33:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13614226 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2098.outbound.protection.outlook.com [40.107.7.98]) (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 BFEA0132C17 for ; Tue, 2 Apr 2024 14:34:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.7.98 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068472; cv=fail; b=jlPM3FLaVl/9JyVHCzEQNRDaGT2WJsYXcZb4upqxfk/LvIkLX1PP4NPnKfnfoNcp3ONuh2oCeNyz2v2MTOyXJS21vJbbFgsYsMsXtSaQTrrc6z890Gpd4y4VYkAnTlCTGwgJt2J2JnUvSCHXZhi4DuXAYWLu+xCEvA1fKmIeCWE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068472; c=relaxed/simple; bh=7LEmma9asVcc2UpABKTIPCze0Rfq/WnOrCDirUI9M1s=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=TeOTgYWEuly5uygBPCxCWJLrMOrLJUyl2DkN+MMkhABW8AjTi/PQx4KTc6JSpq9boVC2qRXLTVup0qL/XRYoN50oexUfoLIRBxDEvCb+Vv8c2ijzl13abGj/Dg4U0hiO9RAa76Xqi8O0I3/pgItqI9WpjefBwbSH1gIm9rP69eE= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=Khhpuut8; arc=fail smtp.client-ip=40.107.7.98 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Khhpuut8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f3pVfNN6EFLScJoBv6ZjKdcPitGCWGhsELFZCEExTjHjZhsC+1FTM1aSa+jOUuwPL9P/MHtSXKDRuWaHykuDIzrA5sj7fcV2tYXgeEs41aV4k1n+r+BAvvLZ620BWCSfuh8udCSZdW2rCZKX4zZuuCxlOHA64rBhCMlObsmgPgWYI5wL4oYKe5GfTdgFq6UHW9fi5shcufR/sgXf+/wvCdxPJjmPvBse4N7spqJOKjTfOxg4ei6qRbicBtXCrug4XPE3a9oBwaEJzRcZd8r3wTrgJuT69VLhKZJMSmw6LGYUwXrsO5vRpeZ/fra2YdVqw1v6AVJsXuAhe5m10pK1rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=bYoXCN2Cg7BevWD2QEgj8BjNP6h0jRB2sBiityVf9KU=; b=J2nRjrbzvQUpaaXxZMMn3f4kSI9vD4In7eCzMSAj6nPgTY16mSU4Htq4CCg4ztGNgEvfju8KJbRnsIxujlwr6f3of50hKBrgMCDZFJlOn9h8iAln1GP87guhXXMfTaKjI5l/2B2T5ADz4tJRxrIAJh1b9Dp++bUp5tJJpURLxZJNbUOBzD0ITbruKtLbuMdieEV30peNEdVENaHCjSf56+GFutW/x59QfQPz6FnXHXg/lzr/UxzI487CSutOU46npSD6qwBJHCNcu4LyqisGQT4JzZch88Vsx1xGO1DMUg2We6pCBO9DwdPDFIMtvr7oYlbtSqeLXmeMkiDE1AZtUQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bYoXCN2Cg7BevWD2QEgj8BjNP6h0jRB2sBiityVf9KU=; b=Khhpuut8llAmT6ecUhT5Bk3lX65Ao9J5cWg6/WPjJrrosCYUKOzefB2YGg0SkhUHTD65CHxxnkKUw+3755pH3NPigJpjHLp/TAGgekbn9m4L13Z7Obn9k0R6kwijpp6dHSNTTT2/2+37OXXE5M+nyw8TeNc4e4NPrxN2zZJBNsc= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DB9PR04MB10036.eurprd04.prod.outlook.com (2603:10a6:10:4c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:23 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:23 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:41 -0400 Subject: [PATCH v3 05/11] MAINTAINERS: pci: imx: update imx6* to imx* since rename driver file Message-Id: <20240402-pci2_upstream-v3-5-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=1049; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=7LEmma9asVcc2UpABKTIPCze0Rfq/WnOrCDirUI9M1s=; b=aftJlbsjlodAFp9hOENvhR2GZ+yUnZOJ1sTDdeqq1T7D7XylZ2L5kxqtXf9dSPd+zYpkLaUAQ e+z/jbMBjs7Cx5kCjrMfUhUk+uP5yRVEvEpdAKaBPuts0JyXJ27mfLz X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|DB9PR04MB10036:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pBtQjS0iOVcQTQYi5/xlOcZW2nv2d0Mh9qWvsLFnVL5agshxfgsKswqMviXH5/f2R3Sd0HLNJ6nQX8Ypfu4M93gj8wZWNSzgRD5BOJ8So4fH2YvtMsaEH8IC512V1ztJ+K2N4dIw3uW2bQdK4qQLfXB/HTuOfW2gWzXVnn3uX+t4yp3Lu2hhdMWY+ZXaUE9HSZ6NZ2YbPHL1vGEGr+ZHdHL9vrB/fqSAh0eHBAqLIeuPesoW17Df4wXCurUzX1sg0OZymgmcJYNaWf8ctAw2J3qxfH/EX6b0ejAw5PH6Dhvn/pFzqyu15V4ezKGXnE+q1rIQ3kasYfEY0oRrb0Rc/p4DgxKe4+jugIEaQ4I5MlE5ho2xTVExHV8j5ziL0O1RoblABpW+axZk+iGadY5xQzhQPvgp5QoBERNoj8hHYwVNf0+G66/jVdRILmUrg4+IgkI62LC0AhhlmROvL/tw4ykldZA85gPngMFbBPBa/TTtiYf13vVfBocUqP3txcesUyH8jcYiIvY74XrvsMngS/Ror2TMw7Q9gjHiM+/hSMWgkkzE6Hmi8LsOvTpfD+Eg3z6TnZa3LIeY4VKhaVTZ2U0S0THr8vqdnKfwjMSY7PqomKnPoEm8fdF6XU7M4afIx/3094/Ex6YCcl2a18KtP5atkRWFrXq06r9Nhm/vyYYg1Ekj3mp/8baVmNJW+0ooLNSJkBh5/eInH9v4JspLX+xhvUXkFVUVfcLtp2uNC7I= 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:(13230031)(366007)(7416005)(376005)(52116005)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?FfDRpAODa6rdjZwAvF3NM289wxa8?= =?utf-8?q?7PgR79UZ/uhcSt5mkCfqmwOJkIx6wegA41B0GBaF0dWUuItDHLDZcSYxueAiPvxg6?= =?utf-8?q?hCq8g/eq21Zdu+VCjpWuAtOvRt8EELOcF7+rbdfS/BiBQtej8gF6cGG+MdlXrAr4H?= =?utf-8?q?vg5XqgHk8F1Xx6KvGJYAYBCp3PSzIXaO0NNzk5CDy7/nEXlx9P6UPTqPP2BZQuVOF?= =?utf-8?q?NymBucrRi8u6HnD3eAoL9xZRAusAw6hZoJS2C7d/eUm4K+1XeNe/XQcYBuXYlHTTW?= =?utf-8?q?v5WPEPmGuLf35bFgnuhYv+9dqFvanEJXBTBInqgKpWBmWtoXtFebImdGHglRtOvxV?= =?utf-8?q?PhyWcL8B2s7X48Jq3SCquFhL9ZV7b1g5vzg/Mxncj9ujesvB3YqXDX3WqtJ/z6cpp?= =?utf-8?q?7O96bIwPRgr2+f51e31Opu63SiQzeprN+tXpjgqwIfbfqJOLcPH5N9SnHLFm338t7?= =?utf-8?q?tKfusuRdMWiKF9o95UM+RhxTYLZB3wR0u0R5DknfD1Yu99rbwOIGpwrLF/+WUMxBM?= =?utf-8?q?hzl5C72+n6eTxLlJufY8qjzRAjgf9WBye9fCd8YSV5LGENiANVk/slaEWtnNPEExs?= =?utf-8?q?J5gwXwWqRZtPrr0CEZ8bT02oxFkND6W7+1e1RPQdFpHbmv4MOKYSQ6D6oi2sPsFOw?= =?utf-8?q?6Kal/rSN/pUlsSF0wuv+iYWsubi9LyTz9MjNHTqLkbjqIafUej93zd5rMMI/TYRFz?= =?utf-8?q?2VMfb63e0BHrWmFy0heYyg9iQi/VI86HXnZiXYE1ht2bOzFnD2P9OV9LyosfjwdE7?= =?utf-8?q?jbWTS+0+6sYInz8y0tU59/1YTMflElI/EAsibwZslSg1Wp8x1CV3oDpIz8wUX+AmQ?= =?utf-8?q?CearAOJZ1iVI4RETI1xKjXntDqkZydJdQLd3odYXRlrH/w6N0e3hHXmWLZD5ogCy1?= =?utf-8?q?sxIfzvtToCco0sQODyVEMbdr9WcPwd9sccgxqC2bFvMiQ4K8tHy635aXWC3lUvQtl?= =?utf-8?q?iBEAUofZr0Lc6JwjdPJgwZdwzbN6pDTgNxyrtYptZWQioKMJVlYwEmuMpSJ+CzewH?= =?utf-8?q?QFkQ9XnS8yKnjA6iZjz3fC3K4vkbZjOXQTU+4vyTVXDq31oNFvrgUzFzZ/wNSgfDa?= =?utf-8?q?EK8dC7N977xnuAZz8PUCDQTV/PrU9o/1GDaseEFzf6GaBn1OTaAZzK3OVM44JZ4wZ?= =?utf-8?q?fI/6NDVqQPcFWpFYbJxhmrtsLgBCHzgg91BYmqxLcwp1tLSSKro+b/bfTP24kpIDv?= =?utf-8?q?IJN0JAT7Rta5b81KAZx3NRIes7ABHJERuX/t0JRra1V1hNMgrpCJwCI++T6DSHn1F?= =?utf-8?q?jGXT8e8RD9JVFVyGsrnVAxSBYDG3lMghJ7UWIl1mqeuIxnkoIKPZMIA3tkPgsdc8l?= =?utf-8?q?gFjvlgw1Os6+lF1DZlYZncfdvxcNSrXMntn1A1HM4G8L615j6MSLewloSoo3+oTqN?= =?utf-8?q?+hZX5tZRdPglFOfnSH7968MTz0JK384IqrWWlZtMMQXwBgS97Hv/I99RSIpD2w8Ty?= =?utf-8?q?ONcSltgLpe45gcJoCW1B1BtlJC/dZcfyIkLqOc6l76Rhm6tHAGDGElFU=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56d06e67-10a7-4ca8-72a1-08dc5321fd5a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:23.0805 (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: ais2wvSUtmHhVl4IR3Q5m2CeT87NwRTV8jtRMFKpQcDzbODX7KczqgVJUchWvuQkS6qjh3/ABgNkHlvCmsyEKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB10036 Add me to imx pcie driver maintainer. Add mail list imx@lists.linux.dev. Signed-off-by: Frank Li --- MAINTAINERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 8d1052fa6a692..59a409dd604d8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16736,14 +16736,16 @@ F: drivers/pci/controller/pci-host-generic.c PCI DRIVER FOR IMX6 M: Richard Zhu +M: Frank Li M: Lucas Stach L: linux-pci@vger.kernel.org +L: imx@lists.linux.dev L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml -F: drivers/pci/controller/dwc/*imx6* +F: drivers/pci/controller/dwc/*imx* PCI DRIVER FOR INTEL IXP4XX M: Linus Walleij From patchwork Tue Apr 2 14:33:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13614227 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2116.outbound.protection.outlook.com [40.107.6.116]) (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 93574132C3F for ; Tue, 2 Apr 2024 14:34:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.116 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068474; cv=fail; b=M6xUgTJGYP8jtDpVk1/V6pe/vPtVf5E+KD6eVGbn82vcZG8zjsSBTWcfquZ+bHoB8SXxwgQC4G+Qyga4JKkPWcwUC3M/kovovIusX8RgjqPPCnYIZWAO1BJiD3dyOB20jceAxrHfJRlQCQfwbNVya1jPZA0sv8hubQnSf8YvnHY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068474; c=relaxed/simple; bh=Zkat84ae4D6SJKi9k9YgxhUo2QzbOldgU2Uww6OuZ8w=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=MTpwzg7Bjx09agQkVWINKvepqAnCTYqbcQXJawHucgCdps7nDrN78+/aF9KNuSV5Jneo6Gyu2QoU5gM/D0g9zPCYffZ8MnkuD0qAmJLX6qPgk5wT4gV8tUvT9iIYnfa0Mb1m02vmTFUalrtcA7ftx3onsjTL/Dvg25htPmDEM7c= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=s2mao6s+; arc=fail smtp.client-ip=40.107.6.116 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="s2mao6s+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LNdZJRby9zoUKj6k95n3aDInG9kIW01diZkNv0PIQPqEkOWglyHL/lNef8ZChqz6qOA65OZ1SO/fTWjd/bPyH/PYv8yXIerhK3ohWee9xE0VYXMooPX0Y03fBO5cDjAExMbFYC+9FPnmotq7p6UOqIffbRB0ODXVCfjs6G2KqsZl7FZKU1ilQrcIb8dZ7IHHb31KQyBv6pLSvO+xxaeN7Rt1a+sSU3ZDq0QQOXId3q6NK7oADRpAG8vzsZJZRmyxdMXKVQc5WtPGQD+wgbsoiu6ujOOzGbvC9Sog/PpK7oAsr5mmet8jDtZZqxjWRPb3vYkB7dzJ/yZ1+QAgnhThXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=MMvuhnK89TFLqeVqTbSme4IZrMraiLpWEPVOPWW1QQE=; b=mpMOmHz7oONOtv9EM7eujh/y+/YOz/mob6swI86mt4JImHEA4XwI7hbdgV/93CPUlbM0ccP8G3MnO83DfUruQHRsYEFtcqMWJLu4t1XdYw9iPHp7r32caLCac9ucRXcuxXTT2gYfXB0eSytKXIt0eXDkfAityLGjvnatVwKsFNvCj4CXYfntbPy9HbWwRvVng/LFwNGDrxGnH4iwNdzj4Xo7PeUMnivlxRBffAAoDQRc6B5PAGScAXj+nc5RjJ5/bkkFOcFQU8XAQSgmT2svIYcXofID1wpqZu/GsEmy+irVYrjTD86+JvR1lUl/lZWczKvHsdYdPMnphYbeiKeM7w== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MMvuhnK89TFLqeVqTbSme4IZrMraiLpWEPVOPWW1QQE=; b=s2mao6s+TNzgO1DprVi1Hf40gwGcT61FOTl/WH1lgHgMcKsyewNplHb19JqvrRqwCEcANFiU7Mx1bsVqE8ISoru1IF39v+nmL3fxc1N68lH/N6hVTyfWoVqv66m1RvwYleluSs3SIzZXwlgHF0bXgzeG8bMfXQNcg/q+ejoYZwk= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:28 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:28 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:42 -0400 Subject: [PATCH v3 06/11] PCI: imx: Simplify switch-case logic by involve set_ref_clk callback Message-Id: <20240402-pci2_upstream-v3-6-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=8518; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Zkat84ae4D6SJKi9k9YgxhUo2QzbOldgU2Uww6OuZ8w=; b=shQ8QZKR8yRWA88UqsG+XTX+cBOG+AdO6vSvuEjsbquiPESZYMJHF2vB11UR7YZbGsW1vOT4s n/IOsEsqO14DI81quZJva1IMwp+i6iBjPiFsAMLpgk2+QH/aF5k6GA7 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|PAXPR04MB8926:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XSTfYK74N/rtFJkI2ez7Jm9zfSyaaD/8+SVpyMeRlRABuq9najvxX36IUYqrXCVEK24lpVWQBpjCqJf3/84YnPe2WloisY9MtUcEMcrefRuTKJrMxLHl53Am5CJ9L5kn9w36y7OuGXkthHibbzVaiTpMiy03yocmqG+aoqomaRcEwuxsqPwtYkOVZsbNTxK8Sc2Ymp9qszpbZxmW07roVb4dkeRDvsyZ3T5PMAU7RFW8h0EiSh1sNE9PIKhcmExOVnHx30/q1/Qa3FmR6Y7tFobLKDZF89nEwQCgeIPJm2ThfoS1DDt64AuqsCrUySy+2lO2XdFaCVKzO/C2dUtBPUiZdsD4we++danEtF51M3sOmcfzvfkjBBc+k+kkiFmYBd0UxgbYD9mBC8lvU8bhEDz+lGv8+bqNy3ZPEdnKUi6wWDo+oW8flQHN0VXnhIFpKyhkfHqo/5+/PlNXSoF7c/SQ2Fef0knHjj6Z/T+rJPtg7wAB3JX8apOyqTwohx7emlWZ75DMYWezszlV3EEg9LqBljtn0mFrsm+KX5Bu9WLGx10G6DCxV8WbNOasmsFBZmO4Q/hzeKqQEz5r3TkPPycLzXtErYtqiFN+I7p33kkSejC4kWMl3AvOpmIBdFzeYc0zFzzW12cA6O0B2EBlkGbT0bijAYOAxKsmWOMJAqdmM94zbT0G824iR3QqB9ir5b9ffmbaaMX+7xziUGP21RWX3Uf+uQuCoi3HFd++oAs= 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:(13230031)(1800799015)(52116005)(7416005)(376005)(366007)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?KVFdsxtFvsMeqtpHHc33IYyf/Lbw?= =?utf-8?q?RKl9wgn6Dyx3jVX0Q5/5VVCzlgbTTBFKiPQEpstWUu/JNSuAzIiFqvlPTIxZXxXs4?= =?utf-8?q?LytVQiTaPNJis7EUcTV4cORhG+iQxEbzyDOYE2ggeUggQ5zCuURPgQmiYQVThTG6K?= =?utf-8?q?GZvxot/CPYQX+nL40m7nkwGd7ljzIvhKon20w0SdLPye4CISpkPb1X6ZFxNYvnY3I?= =?utf-8?q?iXZ3CCXf1rb0Z5oS9StMLWlkBOBk1rwhVvDMfLy2jF2/uwJcDXF+TYD21CoDkckUI?= =?utf-8?q?GIIdxBumsclW5n/snyiFVNzzOh8ME1ncEXpqvcRP9rVZ/IazTzcP4QzgATAXqRDOc?= =?utf-8?q?HKfluncx65t/Bp9dwnKo5pexV2sTiiXPKEn1evo+zxoiqCX7dCSDff7UpKQRiCRrm?= =?utf-8?q?Cki0MQ9huQUAnh9fKMu2ZmfWVlBp+b5JLh7c8Gwl9kIaC09HDPZKG9DUtZ4hRjdP3?= =?utf-8?q?IQMvL04A4zu/4KhqT0RDZq6W2xIRSsvLi0ooF2+/TgvEHy5V0QUtJKpEHvoeGfZCO?= =?utf-8?q?A1V9nMaMMQLG8VwpFQyDDoLRvA0Wg5/eH2ftAD64H2wOchfSxbHXSTBb3thnR6PSy?= =?utf-8?q?TjczHtt8HNZsfAP5H9BRtAF3ipALtOsvV0kxd1n+CtqmL2vsqOJEX0t7d4YtgtDiM?= =?utf-8?q?uZz+sotEPpvj3Kpb0djenVT9zoQBwna/KOVNEX4M8fKzLFSDj1l0rfwzLA8pX5Q7a?= =?utf-8?q?ifvrq4sSZRYhoLCn5KyTSDMTc7MabIzAsLcKGog133ChmlqX1kot/jHA0gPKoXTAB?= =?utf-8?q?C6R0VwycJ9tWNWlleG+KYyqiGi16vIU8tMVouL3PHT3pnUxknIJaTTIj0mXVcBGvC?= =?utf-8?q?Bk03+EdN/VrIPxOrqBcyb9g7Qh2K9SzujlipZLdJppA19v8TWimmeWqckpB2liG9Z?= =?utf-8?q?PJ079zJGvh8xSXZV5BiahzDKT4y+RutjTBkx4aD38xy7SOP0YgP5xnqJrenaVpQu1?= =?utf-8?q?2iPwpXReT9xmngBjDjPigNiR92Y45LdNSM6dNSHlwnMQvnBXMhzYx6j9ywBDhf0eV?= =?utf-8?q?f2O+YAMloey6YhphRTI/Zdru6q1J5WZ2xqwzS4ujZU87y5Hcd38SWz6hZ3+AGc5Fb?= =?utf-8?q?OZbrr8JWz1AQDJCmJ7oxqsstiMX/vA47Ky9Q3Tgb3dmbEOm05jARlePq3pE5UqoYD?= =?utf-8?q?0nQF5sAn/Vgs06ZjYsTLf0gqAM1U71FwSqAoTIcnQ49ZAxd2rSdtpK1irxUOyHpcr?= =?utf-8?q?MLvpM4bZ1ibAKa7biu2TOjwpgkihcQGkb640ikiBfXVKU1SgK8lJFNl3sBRcKLZXW?= =?utf-8?q?wSDrus1o2WsuaKschY9laD/5mvuvF7C+Crl/BzzNaxXqOeDP2gu6s+DmsmODp+4Ln?= =?utf-8?q?fdhk/etrolzEG21DYFGvVS0zhGoFdvWB3e7unMObYvs6k2nTcQCD7FxZW1pcllZqx?= =?utf-8?q?KXPyuyD6xzs6o3QFKg5t4OcZFJiDUsbEmclBLnmE15DOu/MuZsaVXsXtzND5mXOco?= =?utf-8?q?i8g+mKKh+z1vR1WPZNp7JWzx7ivn8pTp7ioMFFhnpDIo0pcA+Wbw/uzI=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1c0610f-578e-4831-7608-08dc5322005d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:28.1311 (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: SMhYZraARkPrZK5ndgrV2EskqctmhilG8hNeRpTKbetHxFEbIG7FXQCJ8s/vA7g9fjItza8slk9fXrxRD2DW7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 Instead of using the switch case statement to enable/disable the reference clock handled by this driver itself, let's introduce a new callback set_ref_clk() and define it for platforms that require it. This simplifies the code. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pcie-imx.c | 119 ++++++++++++++++------------------ 1 file changed, 55 insertions(+), 64 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-imx.c b/drivers/pci/controller/dwc/pcie-imx.c index e93070d60df52..77dae5c3f7057 100644 --- a/drivers/pci/controller/dwc/pcie-imx.c +++ b/drivers/pci/controller/dwc/pcie-imx.c @@ -103,6 +103,7 @@ struct imx_pcie_drvdata { const u32 mode_mask[IMX_PCIE_MAX_INSTANCES]; const struct pci_epc_features *epc_features; int (*init_phy)(struct imx_pcie *pcie); + int (*set_ref_clk)(struct imx_pcie *pcie, bool enable); }; struct imx_pcie { @@ -585,77 +586,54 @@ static int imx_pcie_attach_pd(struct device *dev) return 0; } -static int imx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie) +static int imx6sx_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) { - unsigned int offset; - int ret = 0; + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, + enable ? 0 : IMX6SX_GPR12_PCIE_TEST_POWERDOWN); - switch (imx_pcie->drvdata->variant) { - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0); - break; - case IMX6QP: - case IMX6Q: + return 0; +} + +static int imx6q_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) +{ + if (enable) { /* power up core phy and enable ref clock */ - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 0); /* - * the async reset input need ref clock to sync internally, - * when the ref clock comes after reset, internal synced - * reset time is too short, cannot meet the requirement. - * add one ~10us delay here. + * the async reset input need ref clock to sync internally, when the ref clock comes + * after reset, internal synced reset time is too short, cannot meet the + * requirement.add one ~10us delay here. */ usleep_range(10, 100); regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); - break; - case IMX7D: - case IMX95: - case IMX95_EP: - break; - case IMX8MM: - case IMX8MM_EP: - case IMX8MQ: - case IMX8MQ_EP: - case IMX8MP: - case IMX8MP_EP: - offset = imx_pcie_grp_offset(imx_pcie); - /* - * Set the over ride low and enabled - * make sure that REF_CLK is turned on. - */ - regmap_update_bits(imx_pcie->iomuxc_gpr, offset, - IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, - 0); - regmap_update_bits(imx_pcie->iomuxc_gpr, offset, - IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, - IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN); - break; + IMX6Q_GPR1_PCIE_REF_CLK_EN, IMX6Q_GPR1_PCIE_REF_CLK_EN); + } else { + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_REF_CLK_EN, 0); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_TEST_PD, IMX6Q_GPR1_PCIE_TEST_PD); } - return ret; + return 0; } -static void imx_pcie_disable_ref_clk(struct imx_pcie *imx_pcie) +static int imx8mm_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) { - switch (imx_pcie->drvdata->variant) { - case IMX6QP: - case IMX6Q: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 0); - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, - IMX6Q_GPR1_PCIE_TEST_PD); - break; - case IMX7D: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, - IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); - break; - default: - break; - } + int offset = imx_pcie_grp_offset(imx_pcie); + + /* Set the over ride low and enabled make sure that REF_CLK is turned on.*/ + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, + enable ? 0 : IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE); + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, + enable ? IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN : 0); + return 0; +} + +static int imx7d_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, + enable ? 0 : IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); + return 0; } static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) @@ -668,10 +646,12 @@ static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) if (ret) return ret; - ret = imx_pcie_enable_ref_clk(imx_pcie); - if (ret) { - dev_err(dev, "unable to enable pcie ref clock\n"); - goto err_ref_clk; + if (imx_pcie->drvdata->set_ref_clk) { + ret = imx_pcie->drvdata->set_ref_clk(imx_pcie, true); + if (ret) { + dev_err(dev, "unable to enable pcie ref clock\n"); + goto err_ref_clk; + } } /* allow the clocks to stabilize */ @@ -686,7 +666,8 @@ static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) { - imx_pcie_disable_ref_clk(imx_pcie); + if (imx_pcie->drvdata->set_ref_clk) + imx_pcie->drvdata->set_ref_clk(imx_pcie, false); clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } @@ -1465,6 +1446,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, + .set_ref_clk = imx6q_pcie_set_ref_clk, }, [IMX6SX] = { .variant = IMX6SX, @@ -1479,6 +1461,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx6sx_pcie_init_phy, + .set_ref_clk = imx6sx_pcie_set_ref_clk, }, [IMX6QP] = { .variant = IMX6QP, @@ -1494,6 +1477,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, + .set_ref_clk = imx6q_pcie_set_ref_clk, }, [IMX7D] = { .variant = IMX7D, @@ -1506,6 +1490,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx7d_pcie_init_phy, + .set_ref_clk = imx7d_pcie_set_ref_clk, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1519,6 +1504,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[1] = IOMUXC_GPR12, .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, .init_phy = imx8mq_pcie_init_phy, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MM] = { .variant = IMX8MM, @@ -1530,6 +1516,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MP] = { .variant = IMX8MP, @@ -1541,6 +1528,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX95] = { .variant = IMX95, @@ -1567,6 +1555,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, .init_phy = imx8mq_pcie_init_phy, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MM_EP] = { .variant = IMX8MM_EP, @@ -1579,6 +1568,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1591,6 +1581,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX95_EP] = { .variant = IMX95_EP, From patchwork Tue Apr 2 14:33:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13614228 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2116.outbound.protection.outlook.com [40.107.6.116]) (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 08BDE133439 for ; Tue, 2 Apr 2024 14:34:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.116 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068477; cv=fail; b=sQ/MWO8NkwrZKPCspAf2KwiPV2Qa1r9RT2NZYBZu+j+Ja+0j4gYiZrF3+gXmYjIRmXT83LLXCJbPsTPQTuMhJ+jktdSch+WXEcKC63armFJmrwlsH9hrYuTpGyUre9CosgD2nc8P7yx764KX93xkxGLm2wHSEUOkjQg4FW8vap4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068477; c=relaxed/simple; bh=mFhMz4VdFXqRSX2lKu1hElYPiRsX2Dg/xKkGszGaOgI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ErAYESVKFFKmTcvSjDOvok30b9zuENfajRljPGBY+xzT5U6Mk/5Uzh3XRxsADdr+V6tqxvhtX5FSQ5zj0sN6tMHLltRaaUpijK2LSu5shpZCgAYb/MWUef4v46BKeQU/rug7cs8vDQ6l/Yyx5EhJl4op4C9AuxCuyTz8KMs6wKc= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=NqEul29U; arc=fail smtp.client-ip=40.107.6.116 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="NqEul29U" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RWJHGb3hv7kf/fRawXA5+2XdiET9v8sGM4yfxSKsyc+xHjggTtB+DC075gkR93N8TteF72vR93J8jSIKU37KBk4DYVZ/FUN2fpIUPMaUR7K8C7/nfgizpJZ/6WzHBT2GAFQsUStKFvF9qi49UqsPZDmR3zYpbufDaIPqn36x0Y3G3kqFjhGvnl9JNXti6z3KtMyW2vXPRWf9whN8KszFJcG9xfd3oHbDtx59fSBQyYZ4lGhuLRZAnZkWyeV+FhaNFB4lyHpocodWDWXwWVWmXzRg9q/cJSrIllvc6SruWuQM8m9Ztol8v0VfHfcLADrlLePkWOt609+91xfA6OPGqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=qv2RQwHxs4Ro2donJnjea0UmCTHdA8dsbQjjgbryEcE=; b=B3g0sPKkVGLRupIjQViUMMWssIhsNv859THMeLuSx1fVn2zxzR/heccmew3tOijArLoHhmz7OUzwn/Iez02CX1iyvIvXOapNtLXdoebY6ThV2lDpQGXD7++TiUdd0f60k5VF0hlCMNyh42L8aliIv5tArZyZ+TpRhSrgFRrkeWvGBiucJTyOa+P0ZIP/A4ftHuy5kIG1yQRVK7mhXX2aba55AzgkaV+EhfTrO91bh8rKw0j7bTvVG9SAkkQE1obSzzZxdA+g9BOgtkDa/4j34TIamYsU3HpshkY6yrX6qdtYJZ4Elhvn/w+IY1KOnvw0PbJFJbCVcQfjcw+Mhbp0bA== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qv2RQwHxs4Ro2donJnjea0UmCTHdA8dsbQjjgbryEcE=; b=NqEul29U4SkdfXW7yry809idt9TenmMh8u8k/tbY0BJr333UfkBxipC6FF2vntCJRAPdCvF6vk6KJvIPgY3yVqbtM8WFvrntOsfyQJ6kv8b9uAYK2zpQAuI7U0sxHTKhgFTI7YAsoAnfzRW4Snk9OYdhjcq2R22jUddLm5DZX2g= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:33 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:33 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:43 -0400 Subject: [PATCH v3 07/11] PCI: imx: Simplify switch-case logic by involve core_reset callback Message-Id: <20240402-pci2_upstream-v3-7-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=7125; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=mFhMz4VdFXqRSX2lKu1hElYPiRsX2Dg/xKkGszGaOgI=; b=4hs9iF9y+Gkzkopym5BC7dFu24MFD0bq8Y6yuBb82Lyz6F2BOM02L4A876Cz8RZZVtbH3SzRl SjNNPWoVR/XBZLSZv2tyk6cQeiNRo4KeGtMVMHWo2nc1v5Ghx930OQc X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|PAXPR04MB8926:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gB6bENnlrdsaH2JrZ83VJemnLQRY3cuX6LfKbRtWZkwRu5WL1Kjy8gxiRXEoPN0ekufo72GFS8hrS7lQ82pYWSf76QSCv1OJ/Ay6SzOHUMVn55kWGO7zDRSdemG8ept3zrH26O1UapKMmjP+9UPnDnIcyJ+fvkq+90mKUyELxM3zBZhZ6VOMRslXPVTkxYbCMZboiFHjHUpLM15nHXizMW+Z23JAHI+xGsb8ulNlVuWzWDai6wUj1kXCTLOdBC3YHYz+C733KScLM7NZxjPpDWe6pcz/ZoIi9R2a6WCRTTIQaijm3IImdIEwbe+tZc1E+xgFjHN+UGx1fJ4MkusquSOfZ7tLF9JeIOgkMg78LJkA2ev+LkSDdIYMH5CDCWw+wA4jIH4Q4DQxgCRNcm0x/AvvGiruLeQv+Lb0sLY7iy3RcLJwFkSTiVQStUrNzAOhJ6eg4TR9n6O7jo5UXxhBrANebv0qv5SVrriRh6LUIj2r+pogs7BQ1f4B3oUrfxDwMA7hPL7MT9k6D17lgxVUhGXvBZMQKS9LflJ1UhKXX3YlaSGw00a/+UcJouM2nb75RiNgEstsR10p67V3QAFUC4iWlbCC6FPUQJOpjLGX57dN0cMLQ7z5w+U56I1APMqBZ0aMziiXmtv33abM/LiLK3PJpyVQ3gMFvzP3ttbuwL2djRQPykJskW/Zc0n7Obh45KHBsgdFcyINYpZPgnUd+QDg8lAYZUB/VEZTmsRsoCQ= 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:(13230031)(1800799015)(52116005)(7416005)(376005)(366007)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?9Bws7Z0d+5SK8UhgyQy5Hc/20teP?= =?utf-8?q?JhPcZP/R1TYx9eXAtduHkun3WAA+vYaWA46PiOFSMflLCTvjssNd2rBZuJ9n9ujwA?= =?utf-8?q?r+jWjgnSgdSupDKaRUp2hnet1vsBSII82LeZvv53AYDrCr8g0bpS5pqpA8fzQEDit?= =?utf-8?q?dn9x20KT7rQZel+DHCxm3bNY9+d1lt58JqpMPFMSxXwLKdG7689Y6VVfPgZSX6fKE?= =?utf-8?q?5AuEyFChgB1up6FmIUDGstrKsYYOR4YizNswFamcc0BdprSaLNhFcuv/AnVPBxr5L?= =?utf-8?q?TJ2XwqssQt7L2P7WLF8PfWlFzWwTXFBw/lhgCMZ+bcqSHhCWxwlxtYP2swig7Zy87?= =?utf-8?q?fp223oOQ2Ux59euiji15vBfemJABvfQE1BkcyV1PO0VUbns5PWdMSrS3QwOHfxlwQ?= =?utf-8?q?LeRbGDG3G2msyB/wBUyxc+EAbdAwAlrMbxMg9nRkj+W131VdwY9uFBqtFGDj6wSMK?= =?utf-8?q?6LB4PxAkBe5GrmnIJ0xzESDjI2dcoGVujn8ABuXkx0BgGLxbu/tt0x/Q85DY36GYP?= =?utf-8?q?zgxgd2GNzZyZEZ24QilHFjSgT4eGu//O4JSn5dtUugNB6jG5jVJI4L/qLMpbR56y/?= =?utf-8?q?qTWb0LuaUIRpfl0a1hLsvUsBnBa5JCiUJT3Fo2yWs4RNI0X1nN43iSIwd9EIITWtJ?= =?utf-8?q?WYhZYaHc3JxiDMJpt+0LWkFJysMle2NAqreT8gMOF46EJEoAAqXpa2BZEVUwnOy1w?= =?utf-8?q?Q1srfkeIlCXe5QqHtervCNi6Tm22XTpd5orD/rguFSt3kEjWFJa92tzXu9UYi4/qk?= =?utf-8?q?lafXGIVaedlvl/WI+hWlaABl6lu+XwlrFJKwnYCLIVefNftiuekQ2KQNezndFKRlF?= =?utf-8?q?/Y71ch73m20hHaISMFwiqDQwjSoH+1jZJ3DVtE9J32//MNTY7BWUi18lpOeqMI4B4?= =?utf-8?q?q6w0JizxarCTDUkEYtiMsc9vTP8IpxJXSvIRmTc7tIE3lS5iwmOodd5ZY/Fghzjuv?= =?utf-8?q?KrCHKHkUK6OHTOrsCcC4AI5mtB+b0d8VC3XrdV+gbx99vuAciewW03H5mQiAb7yMu?= =?utf-8?q?na33UynM0gp1u9ghi5Wq/f39/CsUawpbUqoVG8NmbIr7lQSihTJp3t95wOVDyFqR1?= =?utf-8?q?R0D7GxibsYBmSwTdYsAZ4PBKvesPvVD55L7hAXvkWHs8/fKvgJ0mSN1FPLdHQ7PRL?= =?utf-8?q?Q6YjDfs4Ft+CYN6TVSaGgaQ8EeMXiFZ0xgPdexGxWl3ottQiYs5Kz8UOGeycSTpEG?= =?utf-8?q?67Yo/DnIzCAXPzXWVbGNb91oSN96XwGDi+/baFqlzx+yykcmvmSGQsojCF78lYpRl?= =?utf-8?q?R24RPeQkLN4fWjI29AhQAkkWz18CMHsR1Qny9NgI2S3YtrximmAxsGvrdbZ6F5SVk?= =?utf-8?q?6onzg/7XnTqJk0bSs1xj6uK7visIyJ8kkmLXJdZeLqS5IMoKiDFSrF5C76TmPVGg6?= =?utf-8?q?1+vpjc7Dl3HywwzflUAqrQwYHQhJ44d6qEpiOSF30tiUf5ax6I1FkCSkj2xDFQtBh?= =?utf-8?q?+OXW4PjY87psXdIgiytJPGiFTgGGO9p/Od9TS55YEkQlJb7Dwb/uAkPQ=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f937455f-d1f3-4093-05bf-08dc53220354 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:33.0867 (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: KLS89qlMGFhVBjGXigtv15AJ7oaxm9xFEkFvUXCAn12ffiydEt9HqqwwLGMdU8iRMw6Gs5SJixQwbK6aQbM94Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 Instead of using the switch case statement to assert/dassert the core reset handled by this driver itself, let's introduce a new callback core_reset() and define it for platforms that require it. This simplifies the code. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pcie-imx.c | 131 ++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 63 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-imx.c b/drivers/pci/controller/dwc/pcie-imx.c index 77dae5c3f7057..af0f960f28757 100644 --- a/drivers/pci/controller/dwc/pcie-imx.c +++ b/drivers/pci/controller/dwc/pcie-imx.c @@ -104,6 +104,7 @@ struct imx_pcie_drvdata { const struct pci_epc_features *epc_features; int (*init_phy)(struct imx_pcie *pcie); int (*set_ref_clk)(struct imx_pcie *pcie, bool enable); + int (*core_reset)(struct imx_pcie *pcie, bool assert); }; struct imx_pcie { @@ -671,35 +672,72 @@ static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } +static int imx6sx_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, + assert ? IMX6SX_GPR12_PCIE_TEST_POWERDOWN : 0); + /* Force PCIe PHY reset */ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, + assert ? IMX6SX_GPR5_PCIE_BTNRST_RESET : 0); + return 0; +} + +static int imx6qp_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, + assert ? IMX6Q_GPR1_PCIE_SW_RST : 0); + if (!assert) + usleep_range(200, 500); + + return 0; +} + +static int imx6q_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, + assert ? IMX6Q_GPR1_PCIE_TEST_PD : 0); + + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, + assert ? 0 : IMX6Q_GPR1_PCIE_REF_CLK_EN); + + return 0; +} + +static int imx7d_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + + if (assert) + return 0; + + /* + * Workaround for ERR010728, failure of PCI-e PLL VCO to oscillate, especially when cold. + * This turns off "Duty-cycle Corrector" and other mysterious undocumented things. + */ + + if (likely(imx_pcie->phy_base)) { + /* De-assert DCC_FB_EN */ + writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, imx_pcie->phy_base + PCIE_PHY_CMN_REG4); + /* Assert RX_EQS and RX_EQS_SEL */ + writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL | PCIE_PHY_CMN_REG24_RX_EQ, + imx_pcie->phy_base + PCIE_PHY_CMN_REG24); + /* Assert ATT_MODE */ + writel(PCIE_PHY_CMN_REG26_ATT_MODE, imx_pcie->phy_base + PCIE_PHY_CMN_REG26); + } else { + dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); + } + imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); + return 0; +} + static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) { reset_control_assert(imx_pcie->pciephy_reset); reset_control_assert(imx_pcie->apps_reset); - switch (imx_pcie->drvdata->variant) { - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN); - /* Force PCIe PHY reset */ - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, - IMX6SX_GPR5_PCIE_BTNRST_RESET, - IMX6SX_GPR5_PCIE_BTNRST_RESET); - break; - case IMX6QP: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_SW_RST, - IMX6Q_GPR1_PCIE_SW_RST); - break; - case IMX6Q: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); - break; - default: - break; - } + if (imx_pcie->drvdata->core_reset) + imx_pcie->drvdata->core_reset(imx_pcie, true); /* Some boards don't have PCIe reset GPIO. */ if (gpio_is_valid(imx_pcie->reset_gpio)) @@ -709,47 +747,10 @@ static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx_pcie->pci; - struct device *dev = pci->dev; - reset_control_deassert(imx_pcie->pciephy_reset); - switch (imx_pcie->drvdata->variant) { - case IMX7D: - /* Workaround for ERR010728, failure of PCI-e PLL VCO to - * oscillate, especially when cold. This turns off "Duty-cycle - * Corrector" and other mysterious undocumented things. - */ - if (likely(imx_pcie->phy_base)) { - /* De-assert DCC_FB_EN */ - writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, - imx_pcie->phy_base + PCIE_PHY_CMN_REG4); - /* Assert RX_EQS and RX_EQS_SEL */ - writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL - | PCIE_PHY_CMN_REG24_RX_EQ, - imx_pcie->phy_base + PCIE_PHY_CMN_REG24); - /* Assert ATT_MODE */ - writel(PCIE_PHY_CMN_REG26_ATT_MODE, - imx_pcie->phy_base + PCIE_PHY_CMN_REG26); - } else { - dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); - } - - imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); - break; - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, - IMX6SX_GPR5_PCIE_BTNRST_RESET, 0); - break; - case IMX6QP: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_SW_RST, 0); - - usleep_range(200, 500); - break; - default: - break; - } + if (imx_pcie->drvdata->core_reset) + imx_pcie->drvdata->core_reset(imx_pcie, false); /* Some boards don't have PCIe reset GPIO. */ if (gpio_is_valid(imx_pcie->reset_gpio)) { @@ -1447,6 +1448,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, .set_ref_clk = imx6q_pcie_set_ref_clk, + .core_reset = imx6q_pcie_core_reset, }, [IMX6SX] = { .variant = IMX6SX, @@ -1462,6 +1464,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx6sx_pcie_init_phy, .set_ref_clk = imx6sx_pcie_set_ref_clk, + .core_reset = imx6sx_pcie_core_reset, }, [IMX6QP] = { .variant = IMX6QP, @@ -1478,6 +1481,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, .set_ref_clk = imx6q_pcie_set_ref_clk, + .core_reset = imx6qp_pcie_core_reset, }, [IMX7D] = { .variant = IMX7D, @@ -1491,6 +1495,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx7d_pcie_init_phy, .set_ref_clk = imx7d_pcie_set_ref_clk, + .core_reset = imx7d_pcie_core_reset, }, [IMX8MQ] = { .variant = IMX8MQ, From patchwork Tue Apr 2 14:33: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: 13614229 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2125.outbound.protection.outlook.com [40.107.22.125]) (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 E27D11350EA for ; Tue, 2 Apr 2024 14:34:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.125 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068482; cv=fail; b=BXxmVBNGv1YJ11DLCs0Mg9kAe+HTgnGJXJ6kQNo+D7fsiITLmqy68eilC297dZfY9fHL6juoH5TcTefCyg394VK3qNweQFTxSK5rjusbGByBsnfhFgfZEuEAKQyQGxdIdUz2B5INBOHxWf705cs9wBo4DPS3zqhF/LJ6/FSacY8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068482; c=relaxed/simple; bh=fahIF35kCzzN2NR1WBFY+sDojPrl8TAvK/Kx6xk+iXE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=YXPo7ze3h+LWakpnbXvx9bPoghJmtB6j7jyvVY9a8xmLuCL5MKddyk+x6i8P+DeYKPYB7lzS2x9RjvyOPiapwbIcP6YQL8l4kHMSRrsyn/nGShFlD+xS1lPG64wwn6L5IdYGdTlUYt1qUSNOBVy49Alo87zvu/xGisvKrmwlvhU= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=QDPqeZ2U; arc=fail smtp.client-ip=40.107.22.125 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="QDPqeZ2U" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZuZ+oYG6U3XFBqstUsmrIEZSfYdJ5aMCYfH+3eDX9TQW1TDt1gqmfE3l1lWSJJsir3wVIcPeyotFQwNYGSPSLhHgusSCxJwbJ4okUgGsTTmKn64RkglHoeiAf4ZqR76LCowdcs78o2ez7kDXbamAem+pwqo3W6NXt34gSss+kiBIYGWxRhDFYbr7cOisIc2GtkADWIYzPV90/BtVv2Bv1BqDOC7GoNAZ0QQpS6PD1yUeIqtNwY3HMM6QimlvZLTZ6MSdb38lx/6R5qPnN/tvMGxFKALXhn85qazFA1rQ3MCcW2q/rJsR2jZCwuKMuqL4yPc9B0EIPaP+yV3+rciSbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=tP8kCdgh9JdBZ9PsUYjaNu5y7zPL3VGTR6UEGj6lmUk=; b=iL2PFNAowo46V787OzIMxMHvSAlDHYCQynf7FDDkjTyYCOscaisPr2PJhNqWmmU8VG6I7CEmAO1z1sNLN8qYzZ4oak8W9FTSyjYTCAsGoaQ2ScjpKPW5BJVqnwDnR+M9KNX0ilUU8tqYPbXpmIhjgrKjInxEwEvXZNjaUFyvyd+/0j+OAK+JJ8UBkSkLIVwgULCnKNRjvPEH8ZLqaRuC1fIB6yhx2qiuAYt+h2xFnJN/w+747YZ5tiU+VrdaMgWKeKytL5KFuu2pcExirNMO8J1vsr6Imwjmuqtaq2b5W0YjUl3/FiQoGdwSx6HKmqdJM+AJq1s7rgCT3qHYBB2cYQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tP8kCdgh9JdBZ9PsUYjaNu5y7zPL3VGTR6UEGj6lmUk=; b=QDPqeZ2ULSKjYiSP2C+PwpLPdcXIzdB8loNxpgUDgV3wBZF2HvwTxCDqAoDa0lhlG+MyH7yEeto84sj5ccAi8ijWA8FHOLbCEz3k+jHjAw8Vg9MGEdYgTCU1jSkoqip7oTMLJLC3Qs1zZez+GwdeufM44o8zQwvSUDoU02a+900= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:38 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:38 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:44 -0400 Subject: [PATCH v3 08/11] PCI: imx: Config look up table(LUT) to support MSI ITS and IOMMU for i.MX95 Message-Id: <20240402-pci2_upstream-v3-8-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=5960; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=fahIF35kCzzN2NR1WBFY+sDojPrl8TAvK/Kx6xk+iXE=; b=frWJTcymRSS0mT7N+72Jabvb9ATyTzdlIu+vXLhrdwUUXV6UoAGAIjF4LwkDSBK74zb+kO4xl h8om9wj6BhxAXtN9u2vT/LLgvyE/ynRsfHcMwO6PUaVuBI5FIUwGL9Q X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|PAXPR04MB8926:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iO5FvEW6kwMA+7jfDT8DotLOtQy49acskemoV8Hf47IoYwm/Gn371zLYlE47yKFVnJrFHSbL/5sVJ5RfIak175NDPgQy1pmJ1//7A5oJpXA9IyqLafsYMMs/IqgcKGN8kVwF5I4VWHuJHW9rKZ0UIEAppHnb14EaBn0EDW3345tivCbOdTcHiFGPUou3MtFybwy5sK6ozeKfV2HJpfR1YZRC8tcD3grl1wAQglWuLozKL/X2B3vcBW2HJtqRVO4X/eA2DPIVFhg1ZXcvSzw14WT2SVW0nyLawlPIPpWmhdi2FbEdm9vzYlNANVvVF6UW83uC1+EsGTS9iaZoGOpT3WrqJ0s6EwdRTcT3p9VRdR73oS0PpGxy+ezrcnhfx89kBOR2bN0PCTpCsgBwIHlFZH9ON2PBrRLi8Fb/+bowgrJSZyiz02tmG4KWgRApINDtQIX/PDjUEKR6UGW3G5f5Q3Op8m0zIfA1nlv6hVtYXds6lwARuV6bSa46u9nq2mhibPBOqbibR/azFJr6NIPGO3iDTWTejMOBEABT0PbOx+cDWOGsocPs1PqSDWmJDBQYXjRrqgbaI2PD0Rwci+0/DLDqOnjE+YTd1N1iTSvVYLCJS7Xl51I+wYTVyWneS0+kSbEfX1jNko410t2NtQgW0kIHE2bT/3m3c4Sp9G/xAn77jJ4aGjnCj49SVtclHOXxQxFPYarA0nQFTnwwNdmo14684OvjI4Rw1pu6plT2dZs= 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:(13230031)(1800799015)(52116005)(7416005)(376005)(366007)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7RbgwT0CzffOYyJ6hELAvtJ/l5Ev?= =?utf-8?q?GL65LU6O9vzWiAyo6IWAwteexc2yfF0OE0gZg/KMKPZtdkdnpnvvaCPP3pwbiUUZf?= =?utf-8?q?7lGVREMxveSUheQT2n4Pgs2mmARJJygmCX3QemkRJ93lH5PveVz02OX4U4OpJgGxs?= =?utf-8?q?0ddPk8VwAQzcP0RMPhzfiPDbwDvXS3uX14H7H+CSxZkDyDgsqaLGKb74BzXplt/zy?= =?utf-8?q?clAX47VMs5q0dTnsRF9VyT2tiP7hyDc4SwcJUnZRSTO0GYZViycubc1tIKik/URGk?= =?utf-8?q?XvuYyJPC95pu9KwI3Ys9EevwE69KbikE8eE8FMDMG+r+kjLFsQ23d9qt5Xg3mFJ6S?= =?utf-8?q?7hKiuBR2RN/65U8qT8g1aXqbiTmnNifTTdmr7wv5To8Bgtkz9/kbiWRm97w7o5kbd?= =?utf-8?q?7dV8gQQ/Y9UxnSI1inBldoAkcaJJye8SpWrJOBWtdOOr6OZhxQGi4pfC+H8v+U86T?= =?utf-8?q?Zla6en01VYpuFxuSzeMTjOmpypciMbgMMRDTlDDV+yg113RNzfXZ444bqHo7Xdvx4?= =?utf-8?q?dadn1m79cAgVb97HL6Kg+wKADVzHINy8cCx7kn6BGCGhJ6Y9kuKd+gopunOrfmmtL?= =?utf-8?q?bKCTWWmWS2rwXvGXLf1YaA2iNb47cAgegEqdQGepzezEglu1dzKB4mVTm7q29OqE2?= =?utf-8?q?PhLpbLNtk5rlD6yUIOEPJcvwMmQTkRjlgF+Ankbzp6kSuzMb+7xiFiaQff3YZdXWM?= =?utf-8?q?rAH2s/qrGXTNN+SmpupBLRSUAHxb5YCXUKFf3uof8oG5d4Dg1MglYZk0HeHUFmd/5?= =?utf-8?q?a+0TlFopba8NZecIInNGe0djE70e4QXbQRBeaxxo/Ps39avQI29AxE8lKtwK28Eft?= =?utf-8?q?81630E1SgsGLM62Ui9wsFPYZrqfStWFr1GVebUHR9UxZoO85Wo88P2oQtMuUHMFKH?= =?utf-8?q?Q0BO/ljVA9SU8RFO02PDjDZUK/Y5VB6TtRjS2K/+uD7RZ4GBD+3expUVvbm/QaVes?= =?utf-8?q?N3ytqIY3bCbv766ElBwXGxsBSJpqI7qsJz2Lkb2K6uP1pDSiBEbvYf3RsUbF8IdFE?= =?utf-8?q?/56PmlToZSL1dV8fznGGSAlPA3AGqmYtPNZqvo04pYSsNvPRb/UD7OLypA2wmG4Zp?= =?utf-8?q?g88lzoNhwhhcRH5v4bGg1iT8BiDBYVbgiiFXRtb9NmgPCoudX4X4gE3pDzuU7Tagx?= =?utf-8?q?lwiezefDrDJULmeYAQ9e1krBiWMCf9sISBXbRdBQn/H/Ew6B1K+cj0AQjBPRZYE6t?= =?utf-8?q?0f5SpUG4MPyJKtdx3SFRkOvbff/nhSKFlIpiJ8nURv5NiN49MnZOr6xkP7uySc4Rn?= =?utf-8?q?LSRZpjHviaWALGDy09ZjP+YExYRMNyS9lmWQVw0zrIqmF5/3dIaOyvxp/ZFkV+3n7?= =?utf-8?q?kH9n7MJAN86oa8dbPQFQSRLzAtLQ1PDVDcl+eXQh4I207JveT25yh8X0jxZ0VP2Fc?= =?utf-8?q?pqBc6LePhFzFK4sFejp9Fzt4Q6o3BVOGwGu82cOsVf91qPa0CzFwAPZAJrVuGlQDH?= =?utf-8?q?7Pozj+jSZcv0Dsr7jLNn0JGT1VJ/+Gyekg3EG0Wz4Hs87SDGgogZL4eg=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a56357fa-4096-44be-6f43-08dc5322064b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:38.0366 (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: ijAiLgxffw0qp81eNSGtrUbrdifwY8D5OeTfrMaZnrhK/2+ntHZixygQjL0EnPkMUTAXU+5mZsiz5P/rEI63OA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 i.MX95 need config LUT to convert bpf to stream id. IOMMU and ITS use the same stream id. Check msi-map and smmu-map and make sure the same PCI bpf map to the same stream id. Then config LUT related registers. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pcie-imx.c | 175 ++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-imx.c b/drivers/pci/controller/dwc/pcie-imx.c index af0f960f28757..653d8e8ee1abc 100644 --- a/drivers/pci/controller/dwc/pcie-imx.c +++ b/drivers/pci/controller/dwc/pcie-imx.c @@ -55,6 +55,22 @@ #define IMX95_PE0_GEN_CTRL_3 0x1058 #define IMX95_PCIE_LTSSM_EN BIT(0) +#define IMX95_PE0_LUT_ACSCTRL 0x1008 +#define IMX95_PEO_LUT_RWA BIT(16) +#define IMX95_PE0_LUT_ENLOC GENMASK(4, 0) + +#define IMX95_PE0_LUT_DATA1 0x100c +#define IMX95_PE0_LUT_VLD BIT(31) +#define IMX95_PE0_LUT_DAC_ID GENMASK(10, 8) +#define IMX95_PE0_LUT_STREAM_ID GENMASK(5, 0) + +#define IMX95_PE0_LUT_DATA2 0x1010 +#define IMX95_PE0_LUT_REQID GENMASK(31, 16) +#define IMX95_PE0_LUT_MASK GENMASK(15, 0) + +#define IMX95_SID_MASK GENMASK(5, 0) +#define IMX95_MAX_LUT 32 + #define to_imx_pcie(x) dev_get_drvdata((x)->dev) enum imx_pcie_variants { @@ -217,6 +233,159 @@ static int imx95_pcie_init_phy(struct imx_pcie *imx_pcie) return 0; } +static int imx_pcie_update_lut(struct imx_pcie *imx_pcie, int index, u16 reqid, u16 mask, u8 sid) +{ + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + u32 data1, data2; + + if (sid >= 64) { + dev_err(dev, "Too big stream id: %d\n", sid); + return -EINVAL; + } + + data1 = FIELD_PREP(IMX95_PE0_LUT_DAC_ID, 0); + data1 |= FIELD_PREP(IMX95_PE0_LUT_STREAM_ID, sid); + data1 |= IMX95_PE0_LUT_VLD; + + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA1, data1); + + data2 = mask; + data2 |= FIELD_PREP(IMX95_PE0_LUT_REQID, reqid); + + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA2, data2); + + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_ACSCTRL, index); + + return 0; +} + +struct imx_of_map { + u32 bdf; + u32 phandle; + u32 sid; + u32 sid_len; +}; + +static int imx_check_msi_and_smmmu(struct imx_pcie *imx_pcie, + struct imx_of_map *msi_map, u32 msi_size, u32 msi_map_mask, + struct imx_of_map *smmu_map, u32 smmu_size, u32 smmu_map_mask) +{ + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + int i; + + if (msi_map && smmu_map) { + if (msi_size != smmu_size) + return -EINVAL; + if (msi_map_mask != smmu_map_mask) + return -EINVAL; + + for (i = 0; i < msi_size / sizeof(*msi_map); i++) { + if (msi_map->bdf != smmu_map->bdf) { + dev_err(dev, "bdf setting is not match\n"); + return -EINVAL; + } + if ((msi_map->sid & IMX95_SID_MASK) != smmu_map->sid) { + dev_err(dev, "sid setting is not match\n"); + return -EINVAL; + } + if ((msi_map->sid_len & IMX95_SID_MASK) != smmu_map->sid_len) { + dev_err(dev, "sid_len setting is not match\n"); + return -EINVAL; + } + } + } + + return 0; +} + +/* + * Simple static config lut according to dts settings DAC index and stream ID used as a match result + * of LUT pre-allocated and used by PCIes. + * + * Currently stream ID from 32-64 for PCIe. + * 32-40: first PCI bus. + * 40-48: second PCI bus. + * + * DAC_ID is index of TRDC.DAC index, start from 2 at iMX95. + * ITS [pci(2bit): streamid(6bits)] + * pci 0 is 0 + * pci 1 is 3 + */ +static int imx_pcie_config_sid(struct imx_pcie *imx_pcie) +{ + struct imx_of_map *msi_map = NULL, *smmu_map = NULL, *cur; + int i, j, lut_index, nr_map, msi_size = 0, smmu_size = 0; + u32 msi_map_mask = 0xffff, smmu_map_mask = 0xffff; + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + u32 mask; + int size; + + of_get_property(dev->of_node, "msi-map", &msi_size); + if (msi_size) { + msi_map = devm_kzalloc(dev, msi_size, GFP_KERNEL); + if (!msi_map) + return -ENOMEM; + + if (of_property_read_u32_array(dev->of_node, "msi-map", (u32 *)msi_map, + msi_size / sizeof(u32))) + return -EINVAL; + + of_property_read_u32(dev->of_node, "msi-map-mask", &msi_map_mask); + } + + cur = msi_map; + size = msi_size; + mask = msi_map_mask; + + of_get_property(dev->of_node, "iommu-map", &smmu_size); + if (smmu_size) { + smmu_map = devm_kzalloc(dev, smmu_size, GFP_KERNEL); + if (!smmu_map) + return -ENOMEM; + + if (of_property_read_u32_array(dev->of_node, "iommu-map", (u32 *)smmu_map, + smmu_size / sizeof(u32))) + return -EINVAL; + + of_property_read_u32(dev->of_node, "iommu_map_mask", &smmu_map_mask); + } + + if (imx_check_msi_and_smmmu(imx_pcie, msi_map, msi_size, msi_map_mask, + smmu_map, smmu_size, smmu_map_mask)) + return -EINVAL; + + if (!cur) { + cur = smmu_map; + size = smmu_size; + mask = smmu_map_mask; + } + + nr_map = size / (sizeof(*cur)); + + lut_index = 0; + for (i = 0; i < nr_map; i++) { + for (j = 0; j < cur->sid_len; j++) { + imx_pcie_update_lut(imx_pcie, lut_index, cur->bdf + j, mask, + (cur->sid + j) & IMX95_SID_MASK); + lut_index++; + } + cur++; + + if (lut_index >= IMX95_MAX_LUT) { + dev_err(dev, "its-map/iommu-map exceed HW limiation\n"); + return -EINVAL; + } + } + + devm_kfree(dev, smmu_map); + devm_kfree(dev, msi_map); + + return 0; +} + static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) { const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; @@ -950,6 +1119,12 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) goto err_phy_off; } + ret = imx_pcie_config_sid(imx_pcie); + if (ret < 0) { + dev_err(dev, "failed to config sid:%d\n", ret); + goto err_phy_off; + } + imx_setup_phy_mpll(imx_pcie); return 0; From patchwork Tue Apr 2 14:33: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: 13614230 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2120.outbound.protection.outlook.com [40.107.6.120]) (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 8732C1353FE for ; Tue, 2 Apr 2024 14:34:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.120 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068488; cv=fail; b=JYJijENicHQxmQjBT+Xb0w6T8JNghpPgqGvTIkNqjmpGH1iK+hcArqWFt7nAqZqTxmtPQuG8JwaBUo74xg61Tg6JPWNcSl6yHgrZOGRjtjXGDtMeddwHiwj5ShEBLZvMuFSEYVa+7lm78DUbVye7cyr/9cHV93M+jWF/qbscQCE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068488; c=relaxed/simple; bh=VF3tYmlcg/VMfEHxTbMiyjtGVpVYE79MrCZJlbIsON0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=lRUahtWgLv22YWYt6yLRDnKD4Fn9amIb44zvHbCobAenu4A3Cc69L9vRd3w1aqoI6T385Yir1KCxefIeK1uvxFXaGy4Q+9Ou22vVCQX1c+aApBerZhdag6l68FrbWWIBfyaulH1uJOrdy8sMqlynnN6KDoq7ne0j/QikIixlR8I= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=o5OEclIg; arc=fail smtp.client-ip=40.107.6.120 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="o5OEclIg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wu7ju5+/qxo5n5Ds35taPNAK61vpJNJEghKlw3sXBi3kryR79wIP1cHHX1Y2cPCFL+rhmkVpduccj+u0OE0ovqH1FhXMngaCQ8KMI4dFQeMEDn9Va+XPtSrOIDaWJCGeKUnfsXx9qLMS74COXWc2bbfeiKT6Ycv6/1x9O+7Ykwqr1zQR8OTqfSzPe8Y8+5UUBm74cUyvf4x0SSio6Lsngjb1AXRKxz5Buf7ZIuYrzt4iL9/rJC3WEPSn/m9f1r0grCSRlDsMwqYF1s5rfltlz/95fS5PASErbLVY+0RHnbTnXBK4E+Ax4o3e3gJDK2cFjZjAPiyjjskT8UAgpwWPng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=9Bxf/nwc+muySGSCfmby0y1/0mJ6Nd25suYBqOpzqHU=; b=XvCJNSLzZBRCvuBmRkN3qrACYTrf4iAPQlhUjUt29S0CleNIwlU4dojfxAg2RlsgI3YD9VJdpp/gABr7SDU/4+vdWdFVZed1r3rmOlDWfUpkOgHwQrFJGFZMMiRAjxLGaoKyzLshgfjSb2JNQK6472gRMTEaQUIcKenk4HcUyimnVd8W3Nolw5w86yrpp6RQZyAxldHDF1ySIr1UyCDmZExIfOKugaNZ6YZQRr6Q3543KHit/3vbiBzwwNRauVbc3jiqQVkQR9N5wB3QJwaJkNhVe9ViGHARD7x3bgL/AnYi9AjQe1axwtwTJUiloKqkJqSYR5zgy+lLo5MoTMNLOQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Bxf/nwc+muySGSCfmby0y1/0mJ6Nd25suYBqOpzqHU=; b=o5OEclIg2rUUHA2QYPBQ3VUPr9kKqvoEkBn9qnzavUIjutjnq/grPsD+MZLshsjPDzOeHXtZNGi2NyX0zguH7x5CxXs2U4q6IX3iUr98QIVBtjxHEsw65cYmZE2GTdLvyfVyemFJze1JieW96N8Cl5exNUb588V3JI4giZKhsjA= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:43 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:43 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:45 -0400 Subject: [PATCH v3 09/11] PCI: imx: Consolidate redundant if-checks Message-Id: <20240402-pci2_upstream-v3-9-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=979; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=VF3tYmlcg/VMfEHxTbMiyjtGVpVYE79MrCZJlbIsON0=; b=+0bKMkodHyRByDaCR8zT9fPtUbvsDh2UwDSNyTGQwxuX0FXqj7KsnrL1WCuhvdkesKrk0php1 WC5Ua+HhfS8DHwGEw/dF2fnWyDeFZMfnh705gprCBcHkzVk/S0Y455z X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|PAXPR04MB8926:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ojUg0/t81jPuRCIV88+8hB6bwozRIdwKCSod9e8C380dm+2LxhduxL4+sm2g7soBPYv/hpBx+dZvpjTqcx6gJJlGj4PE6npXIELq7+6TRMzTn1mrDMpFDTADh/8d6ui5lqkIQlUaxgK1yssGYZHYuKDelTL/3cNykUWj9+IzhpGzqfu0Jwy5/Ao9Qz+5bivfgMynGprIr/VI+ooicRE20UQd2R4Md9R+yic9AOqGwIxX/UkSyp/IWstjPuksan1Tzaw8tOXduSBJ/GPKkpI4zBf/u4L+/+P0FuITNbczz87O6nGQEoKgGLG3BYYtCHEsAv0nAmxEUG75Xkiv3Pe8/1Y/kwh7ummdd42JChRV/iTObwJqtHSnaKHMS931GoW+FpAezmfvNY+Qzk+9EAmP/SOV8GRUNu6Yorlsf4VEL224iQuvwSMwMQpGGVTk0PT5PuYMoveCXldrg/0KEI2rxZ8GmSBZc6RjPh74dU2PmjDVmfYX5l6ZjxFZfQU3EK6bCufNFEaI++4otJZsI+SjTqAZOekVzLbpv2q8tYjGrQwepWgXEIb+7/8CeGZj/I8NtzKHUehKjE/vmJo2jSRwLoEvjxTmct1zLAUY3zRDNGIsTxZnsgoH55uidCxgaPTB3ZCYF+1Yaj8/rXoX6LbZXTlbB+cGU+YoEf5tBNW2KvA4JLmYMr0Ln8JfyVFyhpMlLx5oTnIcws0CwbaUH60AGjxaGFXPV2CsgRkFJuc7Ed0= 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:(13230031)(1800799015)(52116005)(7416005)(376005)(366007)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?N1CX/TVpMm8M0Bj0ZaRjSwuQJbhp?= =?utf-8?q?nV62Cy1v5lWkteuhyWseOI4iKkVfdCaxKr4lD88jhZPChRwcDKENHHR71B5ju9fnr?= =?utf-8?q?4eaTDWI6i3uMgKh823E5WmO6iV0aMqo4hjInA8a5IpSRVe1p8HdHyy5FEYjOW0pAD?= =?utf-8?q?+3YaMupaq/Y9tsdDMttlGip5457+movIINGPRfzr26Jq7XJM7ZF/TTekaUKxngm24?= =?utf-8?q?bWmvPX5zJc923cV4p0ymuEMUX5Z8tusn1+UHvSVwfzYww0ACg2YwQiD6bHbptpVXb?= =?utf-8?q?FCwKIZ+vbx18DmdTPBCp4YoS44P4DBdEuiDqv7BILxRSk/gvRuRGKBzpqGKo1IbVG?= =?utf-8?q?vSMXTZBvuXr0FLvWupzykuOExL+neQDHZQF3krkeqtPqkq+06LY1GDi8GNn/unYmx?= =?utf-8?q?+HUt9F4IVhxChOEg06Oe3JGtw2Xk8FyP3zvxYtftdYglAK1A1DWlrvCjV2M3xHNVx?= =?utf-8?q?6SNtSwzdfkfEzGh1I7hNtl+lBVDGwzfCXhoS3pqmV0Ck1SeXkRVK7x/bu7am8na8O?= =?utf-8?q?McOA6XCSnrK2KfH9+dEl5/pJNl/fLZq+59vLBWbyCDAEAVjo0sAnfZoOJsu3uYrgx?= =?utf-8?q?246HocHMJDo+hub+SUW2KNtHot8VNbfmzoYwxMKT9MWWVmkzNbOV/gLSAZWks7CRf?= =?utf-8?q?RnkEVSLgq3oKlUAd6V/zHNd6nbbOFVrOgPMWoP+8zsmWRg2RvmVlu2suhBlsMaTWZ?= =?utf-8?q?GXEyDVCeDyMeHhZdSXi7TUcH5EzKb0L4NIWkTM+ZcNmHboPdfeSWnugpTQw2rQ4/m?= =?utf-8?q?r1erhOuGnoX0UWmsBivBCsWh8jjuiPWN7NI8TY/xDwOmacjKMzlH2GYqJcyNpCK6i?= =?utf-8?q?RjmMhYRAIWHz2K5L9nwB3L1yNKlWDoz+ZA7EmCsYHUC+ORLH4ENC0KtPGAKoKQr9m?= =?utf-8?q?0g5xfDJrw9iu22u0P1J1Y8ouKuyc3+ripuLNNzcWptu/tVZd/2OmLacHPfKxiZ6T3?= =?utf-8?q?1ea+rExTvlLB7UJKq3lkvRGSigycMbd9A/S0k52D4/lo9SI1d/FrTq08fpfKkm5RZ?= =?utf-8?q?/luUZoMwBtAim84j9PYaULll4Mj9GyGx5B7KzFjJTVai9GNOcukWqioaEatmFcp+K?= =?utf-8?q?+eGh127e5eu3/g5vnwXh5S0PinM72v6i2FhVku26l/57k4iSDiszAqOzL1X2KY4P2?= =?utf-8?q?h9lz77Itq+gIZ3xn+dz9OXILpAts/+e8Z5UKYDBG3uuDLH8YoWEpAL5Fr7juoNPMl?= =?utf-8?q?wQikhF3P4R5F2BB37stB0W28b0izVOKJsoEo7/LLZo/9GsUekV7MOIdcKdNTCneSa?= =?utf-8?q?hW/fRpYOHr/cqmFeKTu5PRnQVKSBP7sTcy1A0QzU5zWf7UuQ1FBetedPEfWy2SbZN?= =?utf-8?q?8si0q8rFBwc2XKbyVpQ0kCKFTso8+QkVKl4SQQcnO4IfD5AypNfIOA63fPczfKZMC?= =?utf-8?q?AbdC+eZRXm4iQlwVylwolP0AKyv2w/75hmC2SaRRWIFYme6P739Zr8LI23A97YgaH?= =?utf-8?q?k4qVKhLuslPZ5joVbER9PoJh1Ujpp/Ktjy+XQ9916RDtI6r6Opm3A3FU=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbbaf992-968d-4cef-7b04-08dc5322093d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:43.0988 (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: zSoQH5eIknRw/Mj7mtP8dJrRCJrj87YPDX5cVXQusBZ7Be4m0EYUjg3zlwn9Pvh9pD42FS9rDMAGlU9opIWiFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 Consolidated redundant if-checks pertaining to imx_pcie->phy. Instead of two separate checks, merged them into one to improve code readability. if (imx_pcie->phy) { ... code 1 } if (imx_pcie->phy) { ... code 2 } Merge into one if block. if (imx_pcie->phy) { ... code 1 ... code 2 } Signed-off-by: Frank Li Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pcie-imx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-imx.c b/drivers/pci/controller/dwc/pcie-imx.c index 653d8e8ee1abc..378808262d16b 100644 --- a/drivers/pci/controller/dwc/pcie-imx.c +++ b/drivers/pci/controller/dwc/pcie-imx.c @@ -1103,9 +1103,7 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) dev_err(dev, "pcie PHY power up failed\n"); goto err_clk_disable; } - } - if (imx_pcie->phy) { ret = phy_power_on(imx_pcie->phy); if (ret) { dev_err(dev, "waiting for PHY ready timeout!\n"); From patchwork Tue Apr 2 14:33: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: 13614231 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2134.outbound.protection.outlook.com [40.107.22.134]) (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 BBDDB135A64 for ; Tue, 2 Apr 2024 14:34:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.134 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068492; cv=fail; b=tscHIG5K7g5ubnEg3azBQNSdhsl+C4Scww9AoUzMZgTuuN3SGHfWS+Z/a1oZUlvhFnxcChY/oBkjHPjOM57hlx0R/AMLZjd5TkSQYHgySJ9RVQvgwyK12Pd0A5TRA9JFv6v6itGcabqp24mhrJN8titSpsigYD83Q8jhuDvkp1E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068492; c=relaxed/simple; bh=uYxRRhEdO8Op6DTFc/KsdWsD3YBT7Dqg7jlzrmnm0K4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Ub+/9m+dKygGzrqJoD7iLamCv+9OGK5MzCoOgaCS5Xr48ZOmyKN1Ny6xHEDDuDqZ1As4XZg/s8TVbxpGJmaIv2WSp8tei0GT0IVKnq8aj5CkrrLP5JSeEMHZWv+CwL0wwPHPDhvqx+w+AJOZQLOJBugms5XbBg9cJzLCB4KK3V0= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=dFdVmjKh; arc=fail smtp.client-ip=40.107.22.134 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="dFdVmjKh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PdkPQdLwnuoLN1otNk4qqCXyF9aMrZZakilmP5SpAXGSJ1tzBeZKtO44Zg28uWTQ5CR2yu3lxgXw+vkL/clUhRzKlyhsZIhBRjsSpdb8kopFyuGtTfIIvfHV99Ji5eybpPr87DWn0yP7hHm1O6QlnjYqRkWXVtHUe6h6zVJJbPGPIhEq43NA/WCjNN11F23kw1zLNWO+c01xyM8amoN+rUTggJtv0YQfAPOcIlsygE5VQw8EJzFIXnQkWiLgNVA9Gw8JkH8D8Gc5M8nZkdZqNi7h3UarEHAGgdxbTSHx0U1Dt9oP3vcIUtWTlFHbapm6Whus+JRXc7Ip9hU9KiLY2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=UwqfHfZPUpoS+JPj5+NsOWVWn3HmciXazJhQ3qM/feU=; b=WDTASvxA0hhxhQ6ptRUOzHw7e2uZ61KuLJK+Q8B11M+eg0SmZFZCWehb7ppKkhjdmFCDrFv8DkG4vwy2Vrum0ODO6UAYVXneEEqQ83zxj19Hiy9T8O1Xu+EyAzcIiTSHfUejm3SCf6Grve4isByipUtYe+Y06DJfbFDkFY/3eeWCbDoAuCuCqsC2uJTkFqIwXytPj9yT9aqvEpIHatibGLvfoIiEQzr5Ftcvj/MOgCQz8z3U9hRsvILKp8e6+K9/9nXAbVH4CV4Dq7PE+Dkj58Z3posvWcTZtYd5zLDKskSgRdIVY1XFYAqOaJl6dtA/CrTCVExrE+yu+4CRR/6ipQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UwqfHfZPUpoS+JPj5+NsOWVWn3HmciXazJhQ3qM/feU=; b=dFdVmjKhhWoXsgM36EsihRX4dFyHJ/zYaZou/JLqcIZ30DViLKbIZstUxo5xcqyspW+NCeMkbSGAQFwwJQbyLYkx+n6380FFFcQXSHxszk0iuQ9yaNFr3Nu9kYjRV6pLRzOkOyrKUWkJmRrm1pd/bIN+P8p41eNU7+5Whcw8EWM= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8926.eurprd04.prod.outlook.com (2603:10a6:102:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 14:34:48 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:48 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:46 -0400 Subject: [PATCH v3 10/11] dt-bindings: imx6q-pcie: Add i.MX8Q pcie compatible string Message-Id: <20240402-pci2_upstream-v3-10-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=2236; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=hR2tYSzPSPzPh+Bvg1NYZZOz6QTugoJC4tZMVcPoyCA=; b=0wsWG4wPXSe6Cz6ulkGzvOVMvrb/JY2K3VAXL7nNEQ1CngdiX55mCJCOj4FfZQpjOv4z5rMfI YVWPFbQIlVnCo6/yHzoAEvG463V8mRFijyf8OKm3hiNfqzo5Xk361ME X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|PAXPR04MB8926:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mcOQHkSt7QO8KsRPuWL+BDjauxh1C8P9svQIxWUzPVRQvxa2IfslQK5ukO8dJ3gvbGkAQxWexCIWrvgsdKb4H3dnaLA3CRoA4dJdGQYyYqejdu4SlEwKQ73sIZ7aWyy76KrGEX56wMhksNiSq2mdOHnFc3BU42QJTRlnakWmWrI05AA2uftH/98v4ogUkJF9jEgqVNcV61vRWj8UHeVMGrR268wrxDLU9HOL59PZtwgBCYxGky6WsYMa+BA5bbjn5aWlDWQwve+R6IX2T+QvHN2GYAW8TjxUuhFArene9h2JeLJ5XozF+yhSLYBd77ikC1/gNK+3Uxhn5cpF0dzVmgA3amiYyA8yi3aGmJjnWN1eR59Ayy7zd/oW7adRtXQAwP1v6j5wsBQg1WNsuXKrKKSV9Js22TAagXqTwkAnNuwtFcRj/EvUayR+diGgCmL2+Ji89I1jmivhYTK5tYbt5Zwg99xkTM8C47/c8pdC/DIlrkRhYSH1kcf2Og4BO8S7ZjeEEKA/0mEtNyqH0DGhSsxKrtqeHdLQbF7yR0hCxgCJ1Rs11J6SBYPEsJZfrJwmhZrXZzDnPnYgIxCBjDHzDmFgIXRBcm4ujkjrXNrs3o2DIrmVkNLjjvuSA6UyQZATv/ypfTo7evoWl2mTf7hZ1Rt+DT1uqVZsFURTbNCukpyvsMhEWV+ywORrfxfI/TTwt7UxN57EJIcne5WiSpwK8wDUQzqqCMKujjVXkiQBz4Y= 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:(13230031)(1800799015)(52116005)(7416005)(376005)(366007)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?1C/CyoPOjKZZaxoZlSykjXsTBoXW?= =?utf-8?q?VxLg/1RTVrhUQf+5ALtphLlE0lIEooPmZ5gRpvwppqvF5TG5UV78A/BjvMUmD8SEo?= =?utf-8?q?yZjWVngIaJlAqM1v84VsMsLWsalFmBlkhs7h/VrpFFF7Ax3sBWc2+4mEwbWDzqGEc?= =?utf-8?q?PV/4T8f9PDghnM4gAuelvkPZP7Q/7xRCsEA1uBBLwHnu5259KwJTuzsWVFMd2LUvN?= =?utf-8?q?PISkejkcIv1nFSuyI/2nx9FkP1jRd47jpy1vEMDKNkHy3LQM9VupbIN3un3q2YMAP?= =?utf-8?q?AIH2S9BHUc7GAV3wRyAicJigzUWOfvfOHnJ2MnrJ+oMRfziVjzEynuXqy98uZ8E9O?= =?utf-8?q?RTKtrO59hxJfbm+ApTlnezpDbnmUnNwgZNpm2cA6YROBwOYa4u/rTHziAGAye3uv0?= =?utf-8?q?PNur6+gdQp3T0ZmhJRl6iPEkO5irCcy/NZCBnHL9vpcslETOjjd/A6HmIVbTPlPDD?= =?utf-8?q?GQ5tLnCLCkAzhHtzuqJAEzT2JErD9wWWNqj74ril/XDmd7wS7YOrdhv/EkGfHq9RA?= =?utf-8?q?2x+Puj8sRIPjn4DYtRoluZy+tzpecojmFIH7EnNi8VmrkBYmRPTttXr6IP0C8YrjG?= =?utf-8?q?c6aD5Brg9imSd7B5q9KVuamdk/FgPVOHOj6UXZaOtOCwjHk+5mwqHPxcAcek2ZHSC?= =?utf-8?q?kZpf6HLbdBXboflNtkMcaNP83voVAB7GPtqQrN3FZ0l4InZ2AIAhyH413yjQsoUML?= =?utf-8?q?9HnMcA1yWeeCiNia+Wx0mbd8/CeaCxoIts3xyucYyX3CAKHNyx5RI2jLTusAD3tI2?= =?utf-8?q?ZJJrErqC8lDVcNyTJnQhVfDU7BhTPFRuqqF7v2LVxuqgoK26IZ6M6pGkmD4ZXK5lx?= =?utf-8?q?1KxUh5BwGyVZpv5wUjYBX/Q0ljaYAVweso3XueLQ8Zsly69dK4OadZ5ykSbRt/ME8?= =?utf-8?q?HQ/FLQs/uWL+U4F4Hx5VX6FGpK84QGjSR6ak28q+ttqVW7GLo74bQMIYyoAXKcf7U?= =?utf-8?q?TVVrL9kILktf+NefDKGXMyn2a5otZ0lhMRIPeuaJHC+6OR/QFvcMItCBuvI6746g8?= =?utf-8?q?700r93pcYh/b29GbJT3GNXtLvGKYksrahPJOe14cpOWmHe9k7XMxEm013QJa7SunX?= =?utf-8?q?80XAq4r5NjgnDhWyyFouKiSh5ppQilJHvP0d7M0OvbR90kbpfX0qGHReC9jiv468b?= =?utf-8?q?wM9z+qZEo1pwdwictOp6XBwa2ThFkUn5OmsXe8LWWXTyuU66RpL+nimxSle0i/c8b?= =?utf-8?q?xnjBgU6egJATjZt5XMURn+V5W56+VMJV5HZvG0Dip4AwSx8JCPgMJ2VRBbtNuhxP7?= =?utf-8?q?fc4xIMuSxkaNVrOOBZqU0GxnfOmt0H/HJMmT24jcHgAJuncpCdDUE84rxuFdD7N9h?= =?utf-8?q?qxYnCiQYW3Umlj+h7g4bVStNpHoZVpdX5D3C5afgLp7/hUsdFyGQpvrkKFQI5q+3y?= =?utf-8?q?q3SiKI1IbnVhhICD5cO2SKaFouS3lq1NpZzUsMuD/p4BXv820+//cIHCSwlShdvIL?= =?utf-8?q?/G3/y1HeanWvrzaOzqSkSFk1NxiNTzoblevBcYeef4uxiRBiDFNm/QZ0=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91003759-f276-4583-e8a8-08dc53220c48 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:48.1121 (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: Au1UikEpCjxWRFVPZlUw4j50xqjUDvrJ10jx4IwRIF61PBeJlS8jHT4GVoT7/TPCNdULN4DjmYpkPRxHshmF2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8926 From: Richard Zhu Add i.MX8Q PCIe "fsl,imx8q-pcie" compatible strings. Add "fsl,local-address" property for i.MX8Q platforms. fsl,local-address is address of PCIe module in high speed io (HSIO)subsystem bus fabric. HSIO bus fabric convert the incoming address base to this local-address. Two instances of PCI have difference local address. Signed-off-by: Richard Zhu Signed-off-by: Frank Li --- .../devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml | 5 +++++ .../devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml index a8b34f58f8f49..9e767695d6480 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml @@ -92,6 +92,11 @@ properties: enum: [1, 2, 3, 4] default: 1 + fsl,local-address: + description: Specify the local address mapped by the HSIO bus fabric + for i.MX8QM and i.MX8QXP PCIe module. + $ref: /schemas/types.yaml#/definitions/uint32 + phys: maxItems: 1 diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml index 8b8d77b1154b5..b73218933b80a 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml @@ -30,6 +30,7 @@ properties: - fsl,imx8mm-pcie - fsl,imx8mp-pcie - fsl,imx95-pcie + - fsl,imx8q-pcie clocks: minItems: 3 @@ -184,6 +185,23 @@ allOf: - const: pcie_bus - const: pcie_aux + - if: + properties: + compatible: + enum: + - fsl,imx8q-pcie + then: + properties: + clocks: + maxItems: 3 + clock-names: + items: + - const: dbi + - const: mstr + - const: slv + required: + - fsl,local-address + unevaluatedProperties: false examples: From patchwork Tue Apr 2 14:33:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13614232 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2090.outbound.protection.outlook.com [40.107.105.90]) (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 7461B136657 for ; Tue, 2 Apr 2024 14:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.90 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068498; cv=fail; b=IGQ5n+0jssNQY7R58HhM/019CACKvybCybESrwnPNIxdRFYrNmOD0evjnbVWYHW+QaAuyacAFBtuWyEG2Qv/MndlNH/E1YV5PgIeBknBUf9fuyPNdzwO71IoCK8hBABBgpf82HtxB1xr9ckzaotaLAYEpjHS6OF3uZfEYdRWeRg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712068498; c=relaxed/simple; bh=W5Ja/aOtHcr7fQ+ZC5kV8MpJGt4HFMAXp5sPXdyeNFg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=a/eBxzuAbaVTdVZKl27S5T+CHOp15HvFU45qd5aa20t2U0CoIjx5WRuqKqdnEQiJUNOWATb+ADvVGDPlxgMLtf3kQoH17/2RUeH5GjOMQrrxv5j1BdMmnmaIpqa8R/IJacwf/YOLIjcj4P/wwzC8GguNZ8ZRrH77WGLXPKQPB4k= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=Nv06wxJA; arc=fail smtp.client-ip=40.107.105.90 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Nv06wxJA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FrG58nKmYfQZ6ZyXn3rd8fyaogPMvxY6qhrs2zqCwHl4/lk3P9AFPIEALSkeV4SsHbKrCQCIWCeULFX4a8bN7njiOAbFEhMPaBjNVF4UrBabZo4WVP33GUDbmjwTobPLo8xYFQW5e6dRuvsZe+TKB1aelYYGpO778Yq6NPfwJ67kLfik48xm6iGTiDlF3pQ7duPLgcuI3dIjGI1ML9RCG2ZUoIaD23e7u0AX3LGGah/JzNvH4ko8AxiVUpkFD/9Aehpx6JUOvWfmr7cuZGda9+/qPSGfB9B0FXrYUB7z07bvfL5etFNBZR9uk4/SUklrO7ZQoM6fo4t3ofYU5vIN8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=7hT9OuiFh234KpH0JqKQ6bxALCRu9jXU7vD0g8Ik8Mo=; b=VfQI1nD+zHHJ4W9TevzC+uWhiPUxWzr0a2OWaGX/jvlY0NMFdx9eE3xWF9JijzYRMC/1WHe5qXc8WbP0kG0RPhXTF7FNAE/419gSUWossteK1OU862ySWD06W5Yw4TEZ8YY6lpmF/Z+BqAYfYfs2xen86xh8m3v8A7utVapbUq0XjQqhcZ7trQ8SKX5iVqu5iPJ87tdLiw5+ubKDcrc8dotdqEctOYLTrjVFcFeZWwPVkZFQXS8TaqGp9xSghUJMrvNadLUUYXw++7DokymVQaQ4akQlmNqEkImxWV4ZuSvjk5bE8eTdw/Nkn3klG5KjeO+NZSJZBWjIcXpZ6fL8TA== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7hT9OuiFh234KpH0JqKQ6bxALCRu9jXU7vD0g8Ik8Mo=; b=Nv06wxJA6eEzeHP0f8y8kcmRRggEu+7mFBXR7g1I+TbnJxOd4kmzKXhfXRI2qPhMReqKUZxPNM6mDJHVmypzzFbdnCB7GH56uTEJ7OEky9OYoO/tvmIbatJS7OG4RFmSpW7r5nWjtYFYpQI8EMQX20tWEFqsxLy2VP6gfUt6rj4= Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAWPR04MB9986.eurprd04.prod.outlook.com (2603:10a6:102:380::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Tue, 2 Apr 2024 14:34:53 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 14:34:53 +0000 From: Frank Li Date: Tue, 02 Apr 2024 10:33:47 -0400 Subject: [PATCH v3 11/11] PCI: imx6: Add i.MX8Q PCIe support Message-Id: <20240402-pci2_upstream-v3-11-803414bdb430@nxp.com> References: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> In-Reply-To: <20240402-pci2_upstream-v3-0-803414bdb430@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1712068432; l=6004; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=1InHHTt94Qoa5DZtH+PuBX0T7azBh9B1HU0Tvhzx7eM=; b=5R3vKC3lwVauaZflM6UtT6VhwD5mbC5po79wmuYX/9cp3gE7+apXI6AtIR2Glza1ywkAI3RvD q8FD+vCs6XqDzuegSj1PnZa+VD4vZUb4AjtjCW+21EPTRXz0H2QTUlk X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0011.namprd17.prod.outlook.com (2603:10b6:510:324::20) 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_|PAWPR04MB9986:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +fhuaRh9n3Ea41/EmXveTOJMNUMI9/ntXVZ6PiHcjZYkxNfBF4NjrJ8Z3Pk8gJghn0RsvsnJ1FvvBM17s3NJwItcQhLn+cKBs1nFQ3nIIsem+2wLsIhZQz5ZuHQk5clH0DLbU6o4IsQBDoFClDGOW6gyKORPaM4gYk+IplmRWkwsSSmxW7XNNbQX9eE+DqFdAaNGkDQX02n5/rPn+JE+7WPfQSZGbcPWI3/jgt2j9YK3NRV+l/PhLq1cjx5pSmqXFyEA7+A76bSI7SbQ1TeaACuVVKZI26YBxG5L1HvdRU64gYUOPBkm2zPsyJ8os7/qVn2xHkAbqptSJ2/jwOwmQe1nwGDSOklS5ssWq3GTsF062MnUCb/BQVETkJ1PmLIqm8R9SO7fG680fXN1zyVwsjW6MG17f5kzXtEmlSpxkvEti89+yhV8VkmHzBA6Cklf1yKVmRUdyMiJzdv+jUalmvxQ5W1qFmyyah++4VK+B9nGbSR/sBXdBpC43Tox3GxvjFt9DJlo+W6A+CZKMXOZNPjIiOrJFNeWjaOWxX6fFwGvJQLZS84N0V7zqytqtsBWFxu2/cs5cdwNCJ0sY2JMv8mtVICDJPjEPlRljAm9OIqgfhobpT1hPe2Y+NFIvnjjknyUlGQhCCjj+OkL3UuVFGm21xTHqgCrcUMfHPYm6Ob7bHG2N2c437lN6CyBF3lbLk9mjrtj89rDKjw5/mCEZ4PmbIPcPMwY1Cv9qA6GuR0= 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:(13230031)(1800799015)(366007)(52116005)(376005)(7416005)(38350700005)(921011);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?MaJhiNSmsbKGwO3sfXRqKKx9IzHj?= =?utf-8?q?tszZo/pDO7TdOHafS7VG05Hzeg+MaX7wP8+LCvvFu18rpnq58RV8poxTkj6bXby3E?= =?utf-8?q?XIaZrKKPOGk5iYcTqZV5waUHJo4vd5OThiK3s5xDnDHoU3x9rluyZ+iE20yRV20LL?= =?utf-8?q?n5grviTrxmX17DPCQoOux0sJgwqa9e9S8Ih2+4Z2HOceluvj/HAScqc+imiBe3BnM?= =?utf-8?q?iCk8NTh9xm+j0Iu2z08iVbgiOe1D0XMZO8z0+BqUBaUtVmTDo477PM0Nf2phuS9DC?= =?utf-8?q?MIqliF4yrMYcWE0WvCmSD+1zUleyLv5bup25S1gpsVQGOyMjk5c7AKH4mI7odWWjn?= =?utf-8?q?DJdWSDlGYZN+NsmStJewiwF1WEmJXXrrKn5bwAd3FU1/hZaidk343mQ/LkAOasnaf?= =?utf-8?q?v8ty8LeLWxskBzSsrlbTx5j7pVn5Rtzt5vbu+p8DvFgjDbcE7NFWzpNTu6imxZoCh?= =?utf-8?q?bkmERZiLvBU7HDKGQoOEh5z8hYKwM1Ktbwk8YCTwmt42xoPEN6L3SXKeVHQ1uH6QO?= =?utf-8?q?LGO8kSR1uSNtWn4VqgfYbvnnlFQ2DPYV95VrekM40acbqoO8fn8hUP6Q8hKSfhx7X?= =?utf-8?q?VDmQGFiysZUkv8zXQCAkGSahdw3ZcNVrjxIlpVa96zoq650ypPMWriD99RjZkYUyL?= =?utf-8?q?zmECEPp9C1gnCmpZIWzZzpI2xxTCKrFBmCHlU6htye9D4Hh3o7ArA85SyjDfLt7LZ?= =?utf-8?q?4bu4d7npj2VvBVw0HYEp/w4qBEypO/f8kABai6UHb7FogKiDrSWbfGDR7Oj/UlGXJ?= =?utf-8?q?U2MCYKzgx2wX2Ddqg4qyXf8N9Ji0P0cZVspmzttH50X0kL9iQ3kitJIewCIAdlVez?= =?utf-8?q?ouflPtuigz9A6uhiY98yOdH/H9ZWjq8AolUEnM4Qa4lhEqogvQuUfJ5BnGvX+idTP?= =?utf-8?q?YeND+nFVgsYJ6EjLarQi3vkMavZlbIUG1AewHDZr7q1+VjPK9ktZXRFDiYMNbOM+7?= =?utf-8?q?UeGjcRjfED4G7j7b13ESRuFspGU1W36mFe+11kOuAgPfBXTY/qlRhFafdfh0TAEUC?= =?utf-8?q?Xyko7jCzLHbZQ7yd0MmVJRyeTcwGiAlWek/xAe4DiF1c8VK0HUh+Tn+ffChpcqRHA?= =?utf-8?q?0NdLFsnVhg1yE004qzm9eaJCt9ag0GrZY7SVHqt96kXqmCZAvtoNONQdKD8O1fok+?= =?utf-8?q?z3IG8EJJ8Pk5jS2VsnnxkNjWfxMNcxi/7iD0Gbuc5FatRJkSqzR0Tk4a9cn8dh5H1?= =?utf-8?q?wtO4y3J0Wdd4huH8GBJPwVX5NkTDF4MRz8uDXYoywFzV/Z3IOH7cQOqs4PYNR8e6B?= =?utf-8?q?9SDk2j1BYwKmQ8qRJhbLR6QWJlZKommr3ARBlGxqhdKi6JiBChuQMCXUovqekqTrc?= =?utf-8?q?rOFWZrORxIMBQIrzr1hAn2FiYuXZIpgDVLf+KxxenLzz8yodtrii6DIhyPM0gb8PK?= =?utf-8?q?gi8XPMRksI1sNE7zcafO0H2GtSviPGtbWi+p1LBgce7Iig+M0jRFflgO4xCr29qzL?= =?utf-8?q?nKeAQCyAoLwRE2edRG2YgFwwdDCVRzgvMp6RAc/2RwkFdoUqWkzxd4IM=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4b0d47b-6166-4878-c832-08dc53220f67 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 14:34:53.3416 (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: urDcbSTbUEo8ulVIIZwqYpGxGXgKPSE+de5NHMz2eHfSMY/vGcop8Jefu7zeHIJ2HAxrwCjf5v0X1Gw4U/TX8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9986 From: Richard Zhu Add i.MX8Q (i.MX8QM, i.MX8QXP and i.MX8DXL) PCIe support. Signed-off-by: Richard Zhu Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pcie-imx.c | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-imx.c b/drivers/pci/controller/dwc/pcie-imx.c index 378808262d16b..af7c79e869e70 100644 --- a/drivers/pci/controller/dwc/pcie-imx.c +++ b/drivers/pci/controller/dwc/pcie-imx.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -81,6 +82,7 @@ enum imx_pcie_variants { IMX8MQ, IMX8MM, IMX8MP, + IMX8Q, IMX95, IMX8MQ_EP, IMX8MM_EP, @@ -96,6 +98,7 @@ enum imx_pcie_variants { #define IMX_PCIE_FLAG_HAS_PHY_RESET BIT(5) #define IMX_PCIE_FLAG_HAS_SERDES BIT(6) #define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7) +#define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(8) #define imx_check_flag(pci, val) (pci->drvdata->flags & val) @@ -132,6 +135,7 @@ struct imx_pcie { struct regmap *iomuxc_gpr; u16 msi_ctrl; u32 controller_id; + u32 local_addr; struct reset_control *pciephy_reset; struct reset_control *apps_reset; struct reset_control *turnoff_reset; @@ -402,6 +406,10 @@ static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) if (!drvdata->mode_mask[id]) id = 0; + /* If mode_mask is 0, means use phy driver to set mode */ + if (!drvdata->mode_mask[id]) + return; + mask = drvdata->mode_mask[id]; val = mode << (ffs(mask) - 1); @@ -957,6 +965,7 @@ static void imx_pcie_ltssm_enable(struct device *dev) struct imx_pcie *imx_pcie = dev_get_drvdata(dev); const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; + phy_set_speed(imx_pcie->phy, PCI_EXP_LNKCAP_SLS_2_5GB); if (drvdata->ltssm_mask) regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, drvdata->ltssm_mask); @@ -969,6 +978,7 @@ static void imx_pcie_ltssm_disable(struct device *dev) struct imx_pcie *imx_pcie = dev_get_drvdata(dev); const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; + phy_set_speed(imx_pcie->phy, 0); if (drvdata->ltssm_mask) regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, 0); @@ -1104,6 +1114,12 @@ 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); + if (ret) { + dev_err(dev, "unable to set pcie PHY mode\n"); + goto err_phy_off; + } + ret = phy_power_on(imx_pcie->phy); if (ret) { dev_err(dev, "waiting for PHY ready timeout!\n"); @@ -1154,6 +1170,28 @@ static void imx_pcie_host_exit(struct dw_pcie_rp *pp) regulator_disable(imx_pcie->vpcie); } +static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr) +{ + struct imx_pcie *imx_pcie = to_imx_pcie(pcie); + struct dw_pcie_ep *ep = &pcie->ep; + struct dw_pcie_rp *pp = &pcie->pp; + struct resource_entry *entry; + unsigned int offset; + + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_CPU_ADDR_FIXUP)) + return cpu_addr; + + if (imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE) { + offset = ep->phys_base; + } else { + entry = resource_list_first_type(&pp->bridge->windows, + IORESOURCE_MEM); + offset = entry->res->start; + } + + return (cpu_addr + imx_pcie->local_addr - offset); +} + static const struct dw_pcie_host_ops imx_pcie_host_ops = { .init = imx_pcie_host_init, .deinit = imx_pcie_host_exit, @@ -1162,6 +1200,7 @@ static const struct dw_pcie_host_ops imx_pcie_host_ops = { static const struct dw_pcie_ops dw_pcie_ops = { .start_link = imx_pcie_start_link, .stop_link = imx_pcie_stop_link, + .cpu_addr_fixup = imx_pcie_cpu_addr_fixup, }; static void imx_pcie_ep_init(struct dw_pcie_ep *ep) @@ -1481,6 +1520,12 @@ static int imx_pcie_probe(struct platform_device *pdev) "Failed to get PCIEPHY reset control\n"); } + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_CPU_ADDR_FIXUP)) { + ret = of_property_read_u32(node, "fsl,local-address", &imx_pcie->local_addr); + if (ret) + return dev_err_probe(dev, ret, "Failed to get local-address"); + } + switch (imx_pcie->drvdata->variant) { case IMX8MQ: case IMX8MQ_EP: @@ -1605,6 +1650,7 @@ static const char * const imx6q_clks[] = {"pcie_bus", "pcie", "pcie_phy"}; static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"}; static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}; static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}; +static const char * const imx8q_clks[] = {"mstr", "slv", "dbi"}; static const struct imx_pcie_drvdata drvdata[] = { [IMX6Q] = { @@ -1708,6 +1754,13 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .set_ref_clk = imx8mm_pcie_set_ref_clk, }, + [IMX8Q] = { + .variant = IMX8Q, + .flags = IMX_PCIE_FLAG_HAS_PHYDRV | + IMX_PCIE_FLAG_CPU_ADDR_FIXUP, + .clk_names = imx8q_clks, + .clks_cnt = ARRAY_SIZE(imx8q_clks), + }, [IMX95] = { .variant = IMX95, .flags = IMX_PCIE_FLAG_HAS_SERDES, @@ -1785,6 +1838,7 @@ static const struct of_device_id imx_pcie_of_match[] = { { .compatible = "fsl,imx8mq-pcie", .data = &drvdata[IMX8MQ], }, { .compatible = "fsl,imx8mm-pcie", .data = &drvdata[IMX8MM], }, { .compatible = "fsl,imx8mp-pcie", .data = &drvdata[IMX8MP], }, + { .compatible = "fsl,imx8q-pcie", .data = &drvdata[IMX8Q], }, { .compatible = "fsl,imx95-pcie", .data = &drvdata[IMX95], }, { .compatible = "fsl,imx8mq-pcie-ep", .data = &drvdata[IMX8MQ_EP], }, { .compatible = "fsl,imx8mm-pcie-ep", .data = &drvdata[IMX8MM_EP], },