From patchwork Tue May 28 19:39:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677224 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2065.outbound.protection.outlook.com [40.107.20.65]) (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 4630C17836C; Tue, 28 May 2024 19:39:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925177; cv=fail; b=X7eRssRT7Bv29bIyCCiKsyCS9XbCWXm60dqXcWGhFi+39Bbbh7LkjZpT/UACfVdHFw4gZdXpI3lW1bkOapy5qX9510H2iNR8mFZKQkhY6xN4pPLw/3YPgWmWM3tChp/s+pOEIXkW8+18iglho3nH76AIhYJ1TeRxEf/TmtH7HJY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925177; c=relaxed/simple; bh=mL7P+VmAKqXwuvaP9LpUU4giX8nowQXttSuo1u7H44U=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=bqYNhxyKgVasXjxJ/n0g0ZcQLuvEXxf1qLHMORDvwHiUsh52Ob5ICuUuYz7seTE9EzRSqHB2Dq2JJKsXcakDT97FddWliZS18r/t0YXmvDFkbs6qtNm1iy6NbsKuecZqAUmyFbnuLxfJ7DSjHev7otjxMC1jJ+I+E9or7StjFrY= 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=NoBlis2v; arc=fail smtp.client-ip=40.107.20.65 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="NoBlis2v" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PSSGWs1f0RRYnnRqTYa5vVRhFao38iRzmBE8pwuqSKct5Jss6zhfqCZbUti01+0lUuHCWFuPRLKRQG+a9FF2yBv8Qh0V1XK7gokj1mldlEeIOPu7ARowPdcbjGPi3n7xZrNt/Jz8mau1dRdp9P3BTDv40Bzm1yVsN6jgg/ORzt5kDSxYaw7VPMDJlLY+nqvCiesHgxGx4RLtAejeca3Y+FfJ1ho53WdPVssWRYXIgDYuYX5j3hQ2stPSxv5/sGKLZyG+63ZJTAEyTdzBBeRnS2mInQ1BX7SfkHUYS7Zd87k2Ky/nHH3Yp5WxFcUHQIj3zNS+jLKr4zcAGXeoRIYFIQ== 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=GYUB3tl5kIi+kVHs3bp7a/znXcH2HlQ3RI1CGeMqQEQ=; b=nbFaregc6P7DFqoOhg/Z2VV7sS7iyS/j9QeJUtsiIxtJEJCY0iKSOgZQcldI/hDLTr+MY9qCsnGsLiJ1Vl73zwboCLxqLZt0HqZE8RP485xEQ1yGrA00kE1xSLSkylZW+CbibOkRr2D+HXxOmRv+ewcFdPQo19awqVf3zna8kkLy+LoRcbSlkTgpbYiBZn2Ld3I6Up1zG4zFR3/RChYUqQlny7zlc9ScrF1jyBZVIcTbvAP0O3Yfdi+PHV+BeKB5MQId6kwg/hlO413zTMkSdhGSa9wys3j7rY+N04j1X5GarosYT0bfSIxH5YxLNAVjfdJ9fxxp2DXSbuK9MIHG8w== 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=GYUB3tl5kIi+kVHs3bp7a/znXcH2HlQ3RI1CGeMqQEQ=; b=NoBlis2vak8tjvtVhzoIFtjn5MzgO86u9J0VDCBUy3bX773BanhT+WVtgjGYRn6yxdRtTjfkIdeexF3IiMFxPn8xWd/22/M1CAOQ7Bz8ElErUwjXUxb39Nf38R4aBCSeAq8i6Xd5o+go9q/ZpzaCNaYFAoz72poFqGJVr9MgyLo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DU2PR04MB8663.eurprd04.prod.outlook.com (2603:10a6:10:2de::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:39:33 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:39:33 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:14 -0400 Subject: [PATCH v5 01/12] PCI: imx6: Fix establish link failure in EP mode for iMX8MM and iMX8MP Message-Id: <20240528-pci2_upstream-v5-1-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=1456; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Pysl1T42hNHtG1QAGHioLlAZS/qhp6TnqoOHQL4Is3w=; b=IE8CFDTcPynPQ+U/TppmViALoub2is6yJiL2pUhtHqyP34AzebCs6xF5db7CQe1p4yP9zvDAm xs0yvwairJ2Cp2f4FJqlePg2NNU84X6PT6iovpkX3sizWi6HrUcw/e7 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU2PR04MB8663:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a9040c3-b53e-4b85-ae0d-08dc7f4de60e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|52116005|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?7k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l8Za84voMjlCN8qgaEpr91zRImf?= =?utf-8?q?Z10Y+OQsT9Z8uUwWghlFLypha1iVYPS0q9tBDgUBOTNxrTrapdL+yRQPmFIPt92uJ?= =?utf-8?q?y7m7hRbBHO7JBDJ4a4Ep5LCvWN9z0hHbOyHeTJaz7Hp4eu/SEbqEb9pi1bsIy1po3?= =?utf-8?q?FedZzJCCLspN/49As+tIILtHCG5/H1WY4Dx1ETBubV6MCKD5F219U9v4cIpYMkHU5?= =?utf-8?q?e+EsK8VAQGne7YvJMi8QXkabuFWRmya+fNDrv9xh961CAVPkszMt8UFk1yZw6HqNL?= =?utf-8?q?/TmX/gfiOC8bBvA6yg50fcpHRKC91t+ViVhPPtVyXirXjIEiismRgXv+6cYxR0BPB?= =?utf-8?q?FKmHyL71RH8Ci7nxxyUEm8LWYLzaNXVg+K3wFIEo69UKGHENgN3AaNREbhDCMcRgH?= =?utf-8?q?Igke4Qov9L+1ngP6v9MrgEXWxkxXG11aJYIfZHh5AxBNQMOhRHZav0S8=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(376005)(52116005)(366007)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?o9cfnQIa6Z5bhw3adx59rUSilohu?= =?utf-8?q?CBIZzo8ty0IX9tFSfDW8b7qXdoBgybYI6FxhT1BwDbrCmJ+x+xmJ7U3kkx3GC6VFH?= =?utf-8?q?urRZ7ISmOk/RGcGeqTMa9ffhEk6UjDKDjSfWmoco7Tmr98tjDksRfxtSH8lj07K84?= =?utf-8?q?CNs2P1srBTs/opyV25m2YQ2FjuRuFs1h2TPN26apfbXVP7VQvY4jfJzLnWxOOoli1?= =?utf-8?q?OOPpz3Bik8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LkEYxJUJDAyrljd+a6UTFv0Pb2+Czb/C33njUToXKmlkO/NmFbGnb/DCWD/LXy?= =?utf-8?q?8ej1ADscZ+R3sK0pZFJC09EX0v2KGJFj4UoXf7su/Ys4zEMGDDygSOTTJ4V973wRq?= =?utf-8?q?a2NNF9NFqrjyYgWPm3fAQT5r+6lDs6QLyXfUjqKzvCe6tWeVw64LEOE0zkacKGXBI?= =?utf-8?q?vgMofPwFnUb7JS7UGsMWVGXeTsa8+sk7Dyd3DipfGPc8doq3jwq0AtD2Iut5npwNG?= =?utf-8?q?7H8HhBYUhDri3Nf5bxM4tQpQBBgRTHRKDagz/BKbi+HjQlVq2Dmxl1S4y4FzpSSuK?= =?utf-8?q?0qAQhKEDIZlQIHH/SUolV6nJwVKsB3fzkgJ83CE7lqATB6YSm5PMIuUW4Vd6cKOgL?= =?utf-8?q?yo/27P5LB3g7TJMVCP8T7AqQyk+5YPXH6Siyl2tqvZFQjmxRJBY5Cmm4=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a9040c3-b53e-4b85-ae0d-08dc7f4de60e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:39:32.9636 (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: sKdTJRAubF2HrgxYSV0veSvntvF25+687GgdfyUVXVNo3viesJXSa2ErOCaVcmM88vwXc1Zv8W/T6QY9ezx+iA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8663 From: Richard Zhu Add IMX6_PCIE_FLAG_HAS_APP_RESET flag to IMX8MM_EP and IMX8MP_EP drvdata. This flag was overlooked during code restructuring. It is crucial to release the app-reset from the System Reset Controller before initiating LTSSM to rectify the issue 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 62a4994c55019..e9a16083d79d8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1562,7 +1562,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, @@ -1573,7 +1574,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 May 28 19:39:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677225 X-Patchwork-Delegate: kw@linux.com Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2079.outbound.protection.outlook.com [40.107.15.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A61217B40F; Tue, 28 May 2024 19:39:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.15.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925183; cv=fail; b=ngeiVAgD0Vm4rggbKc7PsQbp+VrgHy+cT7RjnQwdojdy1JJBVkZqihpkRlqi5fElmH/XHYaB7EHaGA9HsWSwKZq/hKPQsIVwC/YkGUPksVWbYhR+2pJV7G94zUmk4nEVlrvSKTsY8GkrNUEuvcqAyeEEQNKAQ6t9PtaHOIyTqLI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925183; c=relaxed/simple; bh=xuuFZZmFwLzfr3EwP7rBkaowEqdCoyLdbmk+g9T6uJ0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=EuiMfqLyJ0dPKTExdI4XuVjNLzhcl2FsUgOilh9fREnWHc9uscVm4gmui7qSw810z3Gt4waqOglsTj0VPzGnnjQa/JQtOvwB5pIHsCQiWZF2gRJbw5qk1Gye3qD5+aEbjhvmBnIxC5dCQ4lgti7lFSK7HPrmE6hcntGPLIunVXw= 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=SWd7kaGb; arc=fail smtp.client-ip=40.107.15.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="SWd7kaGb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dJcotbGmPoo5xFqMSYaJgETR4PvotE8wYYogbxCfBmuXzWII4eKXl4uzQVxJVtbWFGJpT9tLBe3vqKxKi8civD0jN9rf2lX+nsmd/rCzkOzBuZip3vcmQj1pfBloS/Tvjdjrv3vK168PqRFUiDsi05RpZXD81IdPUgWOHix1V0k4WWC9PNx+T/639xGRZEvBEdJsKyi2YYzWkb6WBnpCKocBjejZlEgavZryU26UegOPqYlKOPuJmQxGrXPT36IOtmd7a75OuW1OziM9axkqPUHfIpj+6J7kLPvlEg4EY8z5QerYd4WW7yFK9b+YTyqPGjaDrR2iIaeRwAUrFnGpqA== 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=gusIGSYkHi6d8e7/P6xrgDBiBJjdKRaehtAk6+gU0hQ=; b=ETHhJLg7mVw7VV84+ktTsocU4vguU1OIP1l484rKaih2+3Ge5o8FVT2mXHsIGbz2s4xElub68SWYxDAX5yOwNuQN/rwViTsEG4eoKONGcDpOOh0s5M//OQ2BzDmI6WcLVaDkLsHklDHVkFtB9YKYDiEdH4+VoHPhqFSIJsxP9JSjzDsunWZRS5nItn/07L4XA5R2WBFAUekYStJFmCGuzPpYWUUcTAXwIlHQ0wUdpj84zyKbxNcxIN2jMf9U2uHjGg69GfbPqrWNf3ONXAbXt3ti8Simwnx0vgx+c2r/EjLCFAjGlsdxoXBrR0REsNMqwaKfkevVN9F28JxBPyxypg== 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=gusIGSYkHi6d8e7/P6xrgDBiBJjdKRaehtAk6+gU0hQ=; b=SWd7kaGbr+dnGELY1QS+aR4z87fxX1u0Kk/PpY9tXorJFOV4/+g0y6NX+e0ktg+OYjOZj0KULSqotZunnC8aj+rM1INfierfi3X7xQerIekGf0bb3N6k2f2qnRWjMEXzfi3X/pNaNu8DtjmD0hQfHiSrUlYaKV67y5APunhT+MM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DU2PR04MB8663.eurprd04.prod.outlook.com (2603:10a6:10:2de::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:39:38 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:39:38 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:15 -0400 Subject: [PATCH v5 02/12] PCI: imx6: Fix i.MX8MP PCIe EP's occasional failure to trigger MSI Message-Id: <20240528-pci2_upstream-v5-2-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=1357; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=bSLzEn4WP2o59goDiJt0y+MAE1L3Qob46G2eyxAvsHE=; b=IHsNuLI9KEzqmFrZ9uY6rFIOIDEULpHj4gLoVzwGoipaIvI15rHqC4QksTp2oodPmdD7HuDc7 d17TQt0FG1pBL5u+R0mkEO2BIJ6O4ip30Ooc+UIQWrsYCI9tJ9EghA3 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU2PR04MB8663:EE_ X-MS-Office365-Filtering-Correlation-Id: adb3b20d-afda-4ae1-f692-08dc7f4de982 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|52116005|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Ouft4aMCpBqMIYZNI6gIHD6SrL/fWmo?= =?utf-8?q?7OAK5cYs3O+AyHjJ0qGqlYxxzLDmX8EuIwJteFP9+rUi4rb0jwBM6CJvSoFI8C7mo?= =?utf-8?q?1f11YHCuvhpnjL/d6wCYprzErkLX2lckV+y14qvhdtKycnQ8qGEj6DbzaZQrqG0vX?= =?utf-8?q?fqS4I8bOE/WPEvXozJ4QikHbO/AYHGC8gtGkrn/19c6m/rhiifxQ0r6Mnw7B8Lo4a?= =?utf-8?q?Ay2Q+Cw18e7zt5WcOC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eD14SR7QMM3oQdjFPpMqFIjaTtJpwXb/+AZx9rvDaM2Jg3?= =?utf-8?q?1B8Rp8TVraOoKeamOfLJMvq8vMbOeZJrnoqd1UWICz86MWc2X2JuSx5iNOvoL1q65?= =?utf-8?q?XhxkJhi0XhXiEj24FuGlm/1wny68y29R3Y7zI+kAvXhmADlj+W9tFEI+cB1viPtUX?= =?utf-8?q?a0p98l+IRrkrW20X36chxMLTbHNqFxtV2kX55nYYjLYO5uv32kKDV2s8=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(376005)(52116005)(366007)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?5c6Vv1w8XBDJHg3mNJDgx4sd7+QM?= =?utf-8?q?5KS96r2ehX400EN/so5N3onnyCAcWnxkB+IIvPmV7ooF9CslDPll7iFrhc7kCYDNB?= =?utf-8?q?7DNbvs4BS9Kk0a3PKLbEk1fxJG09cFyBCx/q8dWCX/pdEWYieWSgCYIC8EPW2UDx8?= =?utf-8?q?fyrd9BFVU3LYyFtJP7jdbhaIEYVgej8BcUKSsIPrrC77dFZDj1r+8LykFWyQW5iih?= =?utf-8?q?sALsmPpcGoIaePq7X0lqVxSRkxuIIZ3BPFvQ5YlOuwlDGTgxCmJ/5CiFuQsUjWsCL?= =?utf-8?q?48ZbfntIRiTMSACSk2gq+c2Jl2zs5Zk94oJU3oKDEu11qCe0cLCa5HCmzUUwziZsw?= =?utf-8?q?McGbd3FoR8lGhxbyFTMqivDjEcHPuOm06hw2UPrsQlvZioG2LJsUVo1gSYtt6JFCV?= =?utf-8?q?rqoE/0jh4E6ahQvEjr9Wy+lmqKVRE8r3vy11pLLMNfh2inQXD/5OZNGXC9XJcz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6BCVjKWfWs+6ZxiOI?= =?utf-8?q?MoEjFLEblRbDorGDHUKcAR8qrxIHdoIs2y8+q6xDb31Jc3DRbj5cbE+2AXGwi3c0r?= =?utf-8?q?u6Zig4UpQwryyjYzdUXrvXCd39VVAcTe2L/99F/wTt32uqL0cjjsKzb/r1sMWOZjQ?= =?utf-8?q?SKJxYw+MAqAGTHv+InggUeeZ5grvcKGoHFe2LnbcvwRaDo+zINEXVGkk=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: adb3b20d-afda-4ae1-f692-08dc7f4de982 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:39:38.7414 (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: pojKYAdk7pH1sdqgZsiDHqjyHbNPleQIDW01QSHE8/qbHLL9a6RbmGBlSRvFLdgkMhQ6zglxlqLFBTHSboQGbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8663 From: Richard Zhu Correct occasional MSI triggering failures in i.MX8MP PCIe EP by apply 64KB hardware alignment requirement. MSI triggering fail if the outbound MSI memory region (ep->msi_mem) is not aligned to 64KB. In dw_pcie_ep_init(): ep->msi_mem = pci_epc_mem_alloc_addr(epc, &ep->msi_mem_phys, epc->mem->window.page_size); Set ep->page_size to match drvdata::epc_features::align since different SOCs have different alignment requirements. 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 e9a16083d79d8..282261b2e28e5 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1113,6 +1113,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 May 28 19:39:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677226 X-Patchwork-Delegate: kw@linux.com Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD8AC17B431; Tue, 28 May 2024 19:39:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.15.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925191; cv=fail; b=h04y427aVbNRIewAAr1sEuHdUEns08XmpdU+PxZ2wk5WA/0ZmlrxQBXhrfZsN1JwCPo56Hvov9fUrMKr/7D3UmP/lY0cWMa9r49A07QPJqci9tB8cGsJOWh6itJQ3G4SyfcUWtnYwP99wWLq57Y72dsWq12z/J8homa4YbPXR38= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925191; c=relaxed/simple; bh=Z48VUgGmy8O42l7XHVl/YHQMfVROH/z6nFIwp7nCcOE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=rXCvuBGTMF36nG++7mgrnBhN/FtMV1r1RPJ7/7KveCbTjtG09jlUOV3wTvgmKrLiMLsj47wk3H50YnQ0NUzEPRupBDGf89MMlUBNJN6SYlIuGkxB7O8IKl/0pckQGZQifg2s0jy5/CKRTF602cmHWERne/HlsC0O/mgdtJ56Jbg= 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=pxrW4BPR; arc=fail smtp.client-ip=40.107.15.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="pxrW4BPR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kqQcl3uEvPoC9kWSBlJNVzgPTn0pBG+aHtPZeTiIz/I6WsMzKKnFuYl8vlkHYWzpJarNaHBUH3gJvu+Spy6vVzGfBPmq0MPg5tsVHxj2zC2AD2yN4KS9ld72qTxTTcmZN07e8kd3vgC6w4WslAj8/7C350SNBBWNlDB46q/cjuWPn25uyvVFFzYiqbeO7HNMvCIVzSHIX5IN1dE3HiYl261ZK8yd8TTRm72Owehy2qMPxcUzS46jdfySiw50ZZ8yQI5Fm1xEOrZCfMncRxcgfMC28D8IBHqPdW5dmblkOpYeAtOIkY8yUNXoECmWvbgYsmQ/stemTiffMl1yfOT4bA== 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=B1lwEUqTKkcJmLrdAndjRW7s9niw0ocgAdzy+OX9eJ4=; b=fEH9Dlw7NaoAHtYB1VFA0ftdAMHwyDo6CwMItROCa1L8PGNr6Qw5c4cJ41tn6NeW5O1Chn73UYPaXm/PmUK5NggrbvIQ0RyJDlHhF1N+ZfZaTBcBV+0c/yeEkrf5aP28qfn0vbxyDcOkQliGUlXDQLvTDWvscdbnTJB3iq6cbLHKAzStbqHNicPy6toSarwSaqdVIiGraURdg47GJvZwI1SXmJFxJmhgdU3ZqK4o7//DP1TpYgj2FjkzSs9GU178ETFMNnSbn2i8JcbaA5JiAanumgJYuU5Ey5f9Exh8aPv3doMbB52f25h62ST+3tDBqWT1Qjhew4fvLtznPtgNyQ== 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=B1lwEUqTKkcJmLrdAndjRW7s9niw0ocgAdzy+OX9eJ4=; b=pxrW4BPRlryPRdrCiNBekpRjiIV6DOKYTYftd4jSHij4WJhKfgaqInrO5n4dRByAKdKDmA1L9ksu3lOTlzaKPHqIkqau1lNOQOO787oWxqOKdDDlOzCEMuep1CSsCcp1R1yel2XgwqStyLujGXt9zdHfSyn7JLAQKk3j7uMPYMg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DU2PR04MB8663.eurprd04.prod.outlook.com (2603:10a6:10:2de::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:39:44 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:39:44 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:16 -0400 Subject: [PATCH v5 03/12] PCI: imx6: Rename imx6_* with imx_* Message-Id: <20240528-pci2_upstream-v5-3-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=59236; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Z48VUgGmy8O42l7XHVl/YHQMfVROH/z6nFIwp7nCcOE=; b=eTx7t3agUQTYu2JEakH3ldlxOC4rzMo1ib8Cqfd27nfb3aIL+Zeb7S5atBaZYOZ6szFGrbvSv Hjly+jZkMQqCul9RqnNSkmqvKDs0QRpSuPoLr7E2I+pyOAL+EkCrTqz X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU2PR04MB8663:EE_ X-MS-Office365-Filtering-Correlation-Id: 8283e21d-f52f-43fb-3d1c-08dc7f4decdf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|52116005|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?kEBevW9GZc6poddgln9jKfl6Sqja/Qb?= =?utf-8?q?1+7SMYNy9aHnslKFmwqy2x3quhHFD6tHR09o6V7Ymk8gH4YcM8s/2LI7QvgpygjZJ?= =?utf-8?q?nm7M6p1Tl+j0I8F5C0azeVsulTUpepIWame1faItRMyLDcJbylVvGQlhGHWfvElPi?= =?utf-8?q?wifDlBk8bQ38q+vLypch6jN885t44d7V4FnEjni8Rs8jlkOD0Bjg4VvEEVksouIi1?= =?utf-8?q?E0Lv5ZOGX9h0bIhBi2+eE604iPJfr04Q/fXirr2kUfniJofp9ixxuTtV4SJwWAvvb?= =?utf-8?q?wF/cwKAatPt9Pln3mqReHdKwvvQvDeT29+a9vxktFYsxGjcUJQLImmEcfloVfYsnH?= =?utf-8?q?9kwthWxCxoh1LaY1E64iwAXR/mSSV2oRjF5q/D04rcyLPkO+iwyhTaVdk9OtHEgUb?= =?utf-8?q?QXQcnzTaQG4Jko5VkvT5hEFUQheeuGQo5VyqjNR34WqT79hFx4C25JN/83y6FPwMq?= =?utf-8?q?tPnIovL7Szhg9P0VaBKBO5ZSMAs63VD8I/9LW4Pcuq3hOHb7Im1SIy+UUbtU5OSv1?= =?utf-8?q?zBkmQLyen+XMY3x/ZqDhAEyV+TSAapbLG8p8810vQyCyez+g02KBy2r4aMeJlt49L?= =?utf-8?q?HU5/U6+v6ySrRH5SOi+iNKxzZbybf9dSpdH2kTNJeur/oOJxsjPQhf4PhGV23dASx?= =?utf-8?q?oz6nwNqErlH727iDZSofiN4UQSA2UycZhrOVpoxhIiBj95EXiBPIjSfBzGQV/G2Mz?= =?utf-8?q?7NGPTMtJFWwIA2+zpc6e7py+zGwBn9umEAPssF9YM7/duT0M4OsERGxQvdztXeuww?= =?utf-8?q?GbB81c/cvlAM5BLRCCrNiqQByjZJv4nNHlvYp2ls5Yem87SnMHp+KCWZAX4z+VqQx?= =?utf-8?q?ptcy5PxrgKATW4WQSNUR0QovLRilTrdbBgtqqesAPBQfQ9KnY5dZ6x19icFN/XBlC?= =?utf-8?q?ypOZLG5aD85bpvLlgQjuaeXCTVQqbhL/GUOx/b1ljgiasy4crxoXoqzLWG58RJ8GR?= =?utf-8?q?n/brwLR/80jqsfXDdOARpZ+DROoLgCySpuc0hC2J+BuRETUxwQX51XBAdBKygCn+0?= =?utf-8?q?s2ky8DAeXg5kG5oAmss0nV1XhtYD2uO2wUHiTf8Z2gE/pBIkBXSaN9w8IfNlJ+eof?= =?utf-8?q?2LDae5+QvM7f2yoQEBoqL68HgQJor0WkUKwtrk4jyVqpzfajgmGMzogEF4Xv3iBuw?= =?utf-8?q?UsXCNloQxzNzQGkx8eUPM+btf6GCTv5NfApH3Id62/wVMyOgnygWZL+txTZAsxJ5+?= =?utf-8?q?aiFrpKtF60DgOAJ36G/Ad2swcQ50E9WvNUwnfIAlkzKfg6UBM4fZ7p8JCoME0VQPz?= =?utf-8?q?iUrmkTtYigBIu22Kl6y0CKfZ04F9szMvC+E2H4O4AYj6XqCvtEYjJde4=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(376005)(52116005)(366007)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-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KNovqW0Yp7mkI9lOMi1PH5Ef4/D?= =?utf-8?q?a+YfuJVsbfuDezTr9irC5hBL72RZumeNbdJ/4Hb0iTa9t37xt/Dj6A39lnmxGTs2+?= =?utf-8?q?+VLlCcSzSQmvBnu2OwB0qRQoEC37+I1rFgt3pGR3vwgM6YaN3raHBNP8yHuCcWmLp?= =?utf-8?q?zo7pNSBVyQsQps3oAQe9InXrdaEi9iqAyZbpJS7jCdVoD4t+FRAp/UFrx6kWYvpcX?= =?utf-8?q?6Iv93xzoPvAnyD3I8XHDYYItT/br9nBubHoml6kPPk/vIsHbH1HE6pp9NseGkJiVf?= =?utf-8?q?LYB85T+023IzGGrDkFEPz6ee0UoXnM4ypbxCfm0eXyiL0OqiI0CZuj51iwWFqlh7T?= =?utf-8?q?7hGb4mCWag6H1wx70Sy7L72/jocWjAqmdH2A/gD4VPr0L8cwOegs4dKZYUbX3E6DG?= =?utf-8?q?U7g5T7/AZ+V+N5+dkgI1/pSt9jHJpO5p5ntMTst347IEJRTAujEQvbXV72Yoft7fc?= =?utf-8?q?AMYA3WFwZOMTQSrVPdlAaqcp2w6ui3tiM3bg7MrQQ+BfE0zVB+9n2tz445h1kJ7Lp?= =?utf-8?q?AWgKKu1U1eqO7YEki4myMQtRZ3BhdP04CB++kQFzCR1hZbcbhlOUJnSBF0BmnMDiX?= =?utf-8?q?tNer2Vpfv6+N02BHgmLNRuzijHRFAh62+rHTTiZGdvLPKXDa+IKU/nv8=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8283e21d-f52f-43fb-3d1c-08dc7f4decdf X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:39:44.5364 (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: x9ruCx+Uim+FeRmGMbsJd9R45W0AXAUXYBsPwQFkbtyj/CIvd3St3Xu9hv6MX92L/PJIUqksv2UlSpmYKF3U0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8663 Since this driver has evolved to support other i.MX SoCs such as i.MX7/8/9, let's rename the 'imx6' prefix to 'imx' to avoid confusion. But the driver name is left unchanged to avoid breaking userspace scripts Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 748 +++++++++++++++++----------------- 1 file changed, 374 insertions(+), 374 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 282261b2e28e5..72e973312d203 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -54,9 +54,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, @@ -71,25 +71,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; @@ -98,17 +98,17 @@ 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; struct gpio_desc *reset_gpiod; 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; @@ -129,7 +129,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 */ @@ -184,28 +184,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); @@ -213,9 +213,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) @@ -223,7 +223,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]) @@ -232,12 +232,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; @@ -256,9 +256,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; @@ -268,24 +268,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; @@ -293,7 +293,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; @@ -302,18 +302,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; @@ -324,7 +324,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; @@ -333,7 +333,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; @@ -342,7 +342,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; @@ -351,7 +351,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; @@ -360,74 +360,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, @@ -435,19 +435,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: @@ -465,46 +465,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 @@ -543,22 +543,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); @@ -567,11 +567,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); @@ -583,20 +583,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, @@ -605,7 +605,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: @@ -618,15 +618,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; @@ -635,19 +635,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; @@ -656,17 +656,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; @@ -677,41 +677,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: @@ -719,45 +719,45 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - gpiod_set_value_cansleep(imx6_pcie->reset_gpiod, 1); + gpiod_set_value_cansleep(imx_pcie->reset_gpiod, 1); } -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); @@ -767,9 +767,9 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - if (imx6_pcie->reset_gpiod) { + if (imx_pcie->reset_gpiod) { msleep(100); - gpiod_set_value_cansleep(imx6_pcie->reset_gpiod, 0); + gpiod_set_value_cansleep(imx_pcie->reset_gpiod, 0); /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ msleep(100); } @@ -777,9 +777,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; @@ -796,33 +796,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; @@ -841,7 +841,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) @@ -864,8 +864,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 @@ -875,7 +875,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; @@ -890,37 +890,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); @@ -928,83 +928,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); @@ -1013,7 +1013,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); @@ -1060,35 +1060,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: @@ -1110,10 +1110,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) { @@ -1131,30 +1131,30 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, dw_pcie_ep_init_notify(ep); /* 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: @@ -1173,73 +1173,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; @@ -1247,8 +1247,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); @@ -1257,10 +1257,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); @@ -1272,9 +1272,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); @@ -1282,72 +1282,72 @@ static int imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(pci->dbi_base); /* Fetch GPIOs */ - imx6_pcie->reset_gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(imx6_pcie->reset_gpiod)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->reset_gpiod), + imx_pcie->reset_gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(imx_pcie->reset_gpiod)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->reset_gpiod), "unable to get reset gpio\n"); - gpiod_set_consumer_name(imx6_pcie->reset_gpiod, "PCIe reset"); + gpiod_set_consumer_name(imx_pcie->reset_gpiod, "PCIe reset"); - 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)) @@ -1360,59 +1360,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 { @@ -1432,12 +1432,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"}; @@ -1445,11 +1445,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, @@ -1458,13 +1458,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), @@ -1476,9 +1476,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, @@ -1487,13 +1487,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), @@ -1503,8 +1503,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), @@ -1516,9 +1516,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), @@ -1527,9 +1527,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), @@ -1538,7 +1538,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, @@ -1549,8 +1549,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, @@ -1564,8 +1564,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, @@ -1576,8 +1576,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, @@ -1588,8 +1588,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, @@ -1602,7 +1602,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], }, @@ -1618,19 +1618,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; @@ -1640,33 +1640,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); @@ -1682,6 +1682,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 May 28 19:39:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677227 X-Patchwork-Delegate: kw@linux.com Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDC64178395; Tue, 28 May 2024 19:39:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.15.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925193; cv=fail; b=Q+Hj1uwcbBvm4uojrY2/ZNSFWKSAEdSdPdaiTvsN3Sh7OS9D3GtX5hFu7WJmhcDIHv672AGmkdfkUWeyGSCvcRjeiiXG9P0YRhxTeXo/s7hUNrMlf6zzc5HzWpg4g61nLToQaCu04iSmxnJwCVi+S/yFSe6Y7F9hidL/W/PvSCA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925193; c=relaxed/simple; bh=uVycvYKF9FbcM4J26/0fGgPxT4dBZOyMSszVrgcFckw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=nejHpDOiymFTBS0s1RMOJslZz9Tb+WjHdJtENv1q0t9pKmF/pzyLmgqdP07ZTemZu64jo8s4qYGPop8RN1oXQLWj+PfJ7lKefEdu5nHeARztAlfCnrOhPSWWzDO73b8pGcDoAJbYAa8uuINMx1jZr/4UiFj3kpU86QVEOt1WXY0= 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=ahh8OiZh; arc=fail smtp.client-ip=40.107.15.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="ahh8OiZh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ndYyou8g64WWso8Tblsjr6c9zumSXkatzyKLm9N/eN3fmMS1S+/2LmDA5GJyn2Dg7IUm1qrnPr8Ix6DybL2qfRD+hq9+elzv31aDVUfeBn0cgMGgWjBc5IBN1COVoas90Cb2Y4T3bmia45zo2lwGXoZyxwjBB4TGjJSHYOT8AaZ8CsngotzEuieRXTUCRcecm+JP+Ac1k7UQeo4Hqs9tIGM3IQZ0D3el3QHDFmtmR5j52d+V9HjuwlN4OOLuyyqkR2DMoEUfhO3vAiHWGvniAKG/eCKvfwyVBkTcq+QT59AhpZTA71bOtEAwSWzVzaOnO//T9mxgqnfG9d7Kyq4GcQ== 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=6XrA0LI3S6lI8lMmP9q8jfBHI3r86VK5vf/jA3slmco=; b=OjecnZ7CsEXQXhohfe0qGzTUsjeFMJ+rPDEVtBxH2HEFAIoeASstL9mjE+lTnCZkm0x0C9YsLiXNd35NcuW67wIcogkmrxlJeejKTN7wLmsgBJQjPTjVYQYBcEemayEOKj8+7s1q1fNFiLCqmCd7LeV82LDEInJ8w0KXfx33D4lsAZ+GvMzBtBbVKwAUrCB/fH6dsP7S2IQ1zbwJFdmHk12T4RuMuwGuIwlw9EkQCNRc+XkxhbR6sJp0+sfkmm/iejiIRZ3vVK2GRumMovx3WEbLYy1M9wXy5UPzfwb9AFIrTe01PkW65YeJA+HI5waNrnOlsMneojd4coPOL94YQQ== 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=6XrA0LI3S6lI8lMmP9q8jfBHI3r86VK5vf/jA3slmco=; b=ahh8OiZhVMGZ5m6qxf9ylrcjP/Sh9hQdgK6/Ji7FXAxIivO1hbV+dC6ibmck15LMwpmV6d7K9nPcLEvZa7RXL80X62s3IHRF8MPOftFW+VwZNUWkIh/8j9L+pZz8CvG2XP9zgqVzMzFB4EIlimaYYG+4hio0YSyOf6JSSfqhOBQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DU2PR04MB8663.eurprd04.prod.outlook.com (2603:10a6:10:2de::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:39:50 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:39:50 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:17 -0400 Subject: [PATCH v5 04/12] PCI: imx6: Introduce SoC specific callbacks for controlling REFCLK Message-Id: <20240528-pci2_upstream-v5-4-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=8294; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=uVycvYKF9FbcM4J26/0fGgPxT4dBZOyMSszVrgcFckw=; b=odTATAD5k6ayQYWiquc9kJXRRrmKbdI9TBGzu42GKzFryO68gM+vr9AoC7HuluSNT4Ha+m6/N V3zfajsk1mqAkCrx0U7SFb15GfvLf6ZC6F87WRMDjYjPwsxS5Psp2F8 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU2PR04MB8663:EE_ X-MS-Office365-Filtering-Correlation-Id: 91ab0a38-338d-4297-0205-08dc7f4df04c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|52116005|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?26alSJq9aOzbWTk84sK4aUNJcQ3ZZ1S?= =?utf-8?q?7wtcudfhDVrApJtXLmh20rhPxLiXsLJ0Fg1gKmAStAC5CNvIePh6n2oj3wxLMZ412?= =?utf-8?q?AZ10VdUNNY/HYguAuQwIoxbyB25Sks2JqWjUaE6zmJVQmzuMDta1VK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?zfmpxxCUYPzNIhlaE8Q7jfbHTPaOlerj6fBDfDoI62J9XkF+tLI40wUzpQWdNiqEG?= =?utf-8?q?ceNZYIm+DedyguzbrHZyujQ5gYlEQPV46SxfVOMg9hjgqjdlgyvuy+sy+Bht/tLVZ?= =?utf-8?q?oRWqLstSnBZDpFqnGCjcAFh1QwdisKJHAdPMnx61M2jPvDDaE/lti4qiLaikltdYt?= =?utf-8?q?UaUjXHU2QqQcQE0RrKNFKP/Qyfqc7gAhB/1xumI8cN570bTGCzbTjhop1/oTTAeGc?= =?utf-8?q?GpV9ba9ayJG23Nho7kZ/sc4NjUH1Kvafe7A/+BoFS9RbrKnaBu1Imohk=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(376005)(52116005)(366007)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?4/K+rf1VVbBRB8OdR0Zksal+Tams?= =?utf-8?q?vW+p34gCidnVqy5GnwJB2qDWYkjov0/wsQFIkvYuPOP57W8ekxEXHZJ41blKQjrsG?= =?utf-8?q?xNzMmSqWkuqgAuPf/fLVm1PrtYXGw92jLn81L+bOCzCfJzWSR8xGw7nEvCZJurVTt?= =?utf-8?q?K8ATwMyirxSBVjhns+HcFIDFGXPmrunfzvRXGsOMNKx7+KbEkysMD/M3Nu7KtHJOr?= =?utf-8?q?WDB/bNNnWScy7A5I61ts9sEesBuREf7BzSc/7Frjgpr50d8hRqWpxCpXo7dVGJ8sa?= =?utf-8?q?CfFhwGfLofmwv5lmTPu5NafbTbeWWsP0jMONLwwGjvNO4p8lQ2HMTJ4IV3RMafj8G?= =?utf-8?q?k+3uLpLv/QENF884wDdwEG3Pwuaa2r5gMFcCrcM6JatF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YOBs7smVJz1II?= =?utf-8?q?PGWtJ8l+v0jaAQYalYImqiFCfqI2B6oDIOYbf2CMx4o0UOfubBkILH6ZG9/DD3cBt?= =?utf-8?q?XwunBCR0o6ITAgpk0g8qSQrAEfaubGlX1308Vmwma0eYXqFfmddKy3VNNc7tGnutj?= =?utf-8?q?7mRT1k52zyZOlY92EY+OoWi0L4aJG5T2+XRNUh369A+9RWIyKLl2UjBRXqMVXYQFk?= =?utf-8?q?Lynfy9UYFl6pbLVrVvciFcuPytMBxTxtU41YGSilC4bydgg7lJmzt82Q=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91ab0a38-338d-4297-0205-08dc7f4df04c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:39:50.1324 (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: SR2E9rS3ribPZDaPgshXe59FD++uolZOzXOOMtqWo+0AGEIZn81LkVntSxU4EvCCbe6PLfnPHNBPWz5+Hid+SQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8663 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/pci-imx6.c | 112 ++++++++++++++++------------------ 1 file changed, 52 insertions(+), 60 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 72e973312d203..c5d490afa981e 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -102,6 +102,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 { @@ -583,21 +584,19 @@ 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 @@ -606,54 +605,34 @@ static int imx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie) */ 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) @@ -666,10 +645,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, "Failed to enable PCIe REFCLK\n"); + goto err_ref_clk; + } } /* allow the clocks to stabilize */ @@ -684,7 +665,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); } @@ -1459,6 +1441,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, @@ -1473,6 +1456,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, @@ -1488,6 +1472,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, @@ -1500,6 +1485,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, @@ -1513,6 +1499,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, @@ -1524,6 +1511,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, @@ -1535,6 +1523,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, @@ -1561,6 +1550,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, @@ -1573,6 +1563,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, @@ -1585,6 +1576,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 May 28 19:39:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677228 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2078.outbound.protection.outlook.com [40.107.21.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B73EC17B50A; Tue, 28 May 2024 19:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925200; cv=fail; b=jJR0ehBCY9YQ3AMOftk14stS2ERw9Hg+rYJHtquz417LwpMNkWrNhDgTmBMc/yGW55B9vxsIHt5AyZ4uSXPwhX0IVoHyEqViJIYbCpOLIX+0ObBVp+99ZEEjP4zw496ip/UYNyLsFI8yq5HrVGQvX5TMB6pZV1T7XYYWn2c3rL4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925200; c=relaxed/simple; bh=xzQ/sdh6rUEzBlHbjXDB3BdPseMVFXbJTzuQD00Xw3s=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=m+nt++6wwhZcrf+BXlpqoxlrj0VNxN2EuGRGOJilNE3UFDT7SezX4NQUvt3cu+7/S0/HV/E7H6rupVpzy4DSHOoQ+AI10PQGeF4twD2Sc4g2TLNXdvXuoSlQvR3T8LkX8MojcYvw6/VYlgwr84z7zT5BrIdi0TUP3aYm8XDuXEc= 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=efAkKEai; arc=fail smtp.client-ip=40.107.21.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="efAkKEai" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=npoNHR3XknOGHEdtS/dMnuCsG6cA7A7oTP3UCfon5RpYoMuzs/FUepl41hG4cRGvZUtDOCrlINyUoGI8SrK+R4DKf1KoPldvB6uS2hNaN5k1AR042gWVFfn2aU44OB/OzBXCwVSPfUQCCePvyycUBYJPsDUfbHYjYNLCtpbQoJYDRtVT+CHx6838ytuaDoD5EU7HAeup+DaZo/rZJ8D7PSOqfhPw6/JELVwQnm1iIT78g4ojItoZNNH7+IPFoQjzf/tPcHxWc7dW++BJ1+OLElPBqehe4YV5C54Kvu6X5ql9wxJaRvyA6u4aVxAw7pLJa/eikIlaY0rkgVOmiwulug== 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=Nc47JLvApIG1K14sltKfahrWUjVx+VnkoPE/T3p+JSs=; b=jTYui36vrniRrLLNmfIe/qd1qKbGJbye/5yp75xshzfjcIX2A8Rs6mCAqFep0/ICUu5oB3ZZtbsUNVp0bYkHdSknYvOpYR7iD4x7Eqbq6/lRsd2yB8J0maUyfuR+mWhtCP0SjC203IDL0axwBYou/61uU0sVYz8kdyjZ/HgbKIDB6q+lI6Rr09Ez2DHDvwozyJ8mBvLDZu7sEoXnCoB/6qyBge4m9iqvI1tdoGFMUPqsbpNaLotSfLnanTRL/EIIq/GCS3fjiR5gXjqNm9Tan/erVJB1pFIPQ0dMLa58oc0IbwylGtO2k9ebWpDSAXLhE7Rrv+THAey2jLRAqw+2EQ== 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=Nc47JLvApIG1K14sltKfahrWUjVx+VnkoPE/T3p+JSs=; b=efAkKEailpJp4T2vVn2zHi4jqPBj3mN0tIWXDXN6qNJZTcXC2SI8+Phvrnw9ZfBOMAlBK6erMHF15cI9AFgPdVIvH96eAmbowmDRVYbzaky/Z39eeCmtv1V+y+YnPDbE8DaALt7j+DsAHprPcX6jEBzypcfns1wn8edAC7lJl2g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:39:55 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:39:55 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:18 -0400 Subject: [PATCH v5 05/12] PCI: imx6: Simplify switch-case logic by involve core_reset callback Message-Id: <20240528-pci2_upstream-v5-5-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=7024; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=xzQ/sdh6rUEzBlHbjXDB3BdPseMVFXbJTzuQD00Xw3s=; b=/IFX7MJ56McmsJfPS4f8VHp38XUN2x1PUemrjH3NqoRV0CVgd2Q0Yjx46mNVyxggFkFKiT+P5 ulpCC1SK/j7AF0MMHw6GRf27ieJPwGRKbag1PSufJkHwnjTYoF3PlIF X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: 57dd02ae-a9d1-43db-2130-08dc7f4df3a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?6ritbmCMZmDE63/FOKTy34QVgrG6SdE?= =?utf-8?q?hw0PM3XBqrqtY7mki9W3n8aGsAqQocPM3Toa3e5lxRqRqsJVZxUtZHJzlUMQnJeI+?= =?utf-8?q?XlFA+kKjVu0bxcWsgksyaq9vuth5hkVozsQ9KT6iLQuAyDkujQeQ08sCI8stg4foy?= =?utf-8?q?pWk6MJRkfYCNkAFHwtKXrwAo+dUwBsUVpQx0qVvZ+MN+e48lR3wdOvp8JLzqMNjRo?= =?utf-8?q?nrjWVk2ab7Z/sL3XCW7o98APxXbYMflFqC54Pt0gXuaHa2VkiTuRUl4hIb4q6FhxE?= =?utf-8?q?Fa0aG7CUXQipxjES11LXho5/t+To+hbIBIuj0ZHF5cebBb7iaygrq25OBpnA5PXQR?= =?utf-8?q?jtwNdo+AyvaseeVN88mWr17uCkjJlWZ/arzhonrnJEQbS43BeiGahnfRPz+8E+2HK?= =?utf-8?q?vVbw28WyqC+R8jdcL0o7djyLPRoc1JCNaCsg6juP00k5ZvFSXczVz+XW8AfZAX0x1?= =?utf-8?q?/WyNnwmALTtJxQcekMD0m7tcEsttPmL+Ave8eHuCuvVwOZabvx0RR42NZ2vqDtpBn?= =?utf-8?q?zLVEnQdbckO1G2ttliXmFAcMXVuVCVWl2DfN5hkBrFPG8K6jQtEOEhpyo/+yidimh?= =?utf-8?q?MbhCTLY8xv4eSGvQEYwyZkK3CCEv8DyV/XHsqE5GbIeIUppkDgX9KgacOZ499F+oB?= =?utf-8?q?6H2ErAbZ34EEI/G6gMRAzOBAbQUDB4UMNKCxqlZGYwsfiz5o/aaZr9MyTiMMemUNe?= =?utf-8?q?2eIds8+iXhCGBiH5JqpSY3QCsA9eF5V9/NDZgLYAvgAfCXC+9Dias31gt/bEGslGg?= =?utf-8?q?aCqfkuPq8+IuDXXchEUbjdbVqCzQv+IX0U1Tp/goBn38cw4xgsxUBu+xGv4x9P1sV?= =?utf-8?q?mdBfGBaJgWjj2EM+KKfz1QvtEMW1DUt5sCUpKRSoNcckMK94bSLskg5VVfPXbQT74?= =?utf-8?q?0kH2ryFt/IPzMu+MKVaQKimiACUjWATd4I6CD43qC08AwNtPScueDw3I8ZzzbFWYD?= =?utf-8?q?aAPFX755uPvXs7xmii6j1ki64yRK6JNErgzCJiAhxIG9zqv2jd92OeaPRLihEXpqy?= =?utf-8?q?5MJK76VjayNrtHnR0lRv6UV7eB1cgQnH762QCP2SuM2V4iRpesGXwDZ0dWq1cMsK+?= =?utf-8?q?Jfhu4vO2ehGmhtPB5PSBHNptV60nGpWY0IE0ueRwBOav40GPpaQEt4zHsyhVUzbtm?= =?utf-8?q?TswOYFrYm7yUGNqzm6RgA8XZE8Ysvlk0D/zvG3ZBgcmxkfcdhBhhtsuIozOxES7T5?= =?utf-8?q?91TISGGbHgj/d8rJbc1YkVRfJeMjXb56xYiFQ2CJQ3RPViURg2Jgat40DekG0gpyF?= =?utf-8?q?Qm/dsxw37CKeJekbiO95vPD1VRQCE+8jV4gWcWupTwDckUs53yf2TCyw=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?N5BcbjTfXnVILHPmMAvoK8mhiocp?= =?utf-8?q?0OSxzc5pF/0HAcKoIJqkIog5ysrwDqjk5qhIe7qW+9WaCvg8okELX7eeEXEsKMe+t?= =?utf-8?q?Cjco7pBxI2FrswUZuoJhmREHg62q1DwecSY4AYt9CcwhGO/Fo2497ip0DHy87J0ZJ?= =?utf-8?q?Jsfv7HbI4nIfntNPoHd8i9+cPNo0EXVDQXzic+d26igLckxO+9xO4hNeUz5dzeMPl?= =?utf-8?q?UWjmyRzT2ZDEQhXoU8An14T8/Weso9ZGZFs3nEVHqSxVF9QWp8cFrg6wCPq/YFg9u?= =?utf-8?q?LhrO0QD/z/HzkWJtaDwVixalhsg7Z0b3+qTR0SdDKwkVq7ulUFUh45krGGalDFkCD?= =?utf-8?q?0fYN95uYLP4tKGL5nkowHlDK7OqmslLXRq1JhNI+azY8+e8ywz8TYSd29Jv1sywk6?= =?utf-8?q?QuB1IazM0eQkl+wiFG40kvXRaWaisp58036fSplpNnD4vMc9PFxGyC1pwb2rddl8w?= =?utf-8?q?wk/+A00P2QJ7gTJEVWlcD5ZZNTggK2KAejHXv0XPsKk4idiccxVHimWMcQfONqIlD?= =?utf-8?q?Qxqx3LsigUnF0Up2oljK2j+mv4+jTOuB/vfh4YmG3iVhyTxvynDPxoz7mNXDr/Vk1?= =?utf-8?q?jXKc+lLGtTMme81/zBBck/gYHb8O1Mu2HVXBhwih0FhxSznNCP5XQgkzXU7TysO8G?= =?utf-8?q?owawQeojuJa7o7+thkkaq+AuCfFm8huRxjWFD/pmKvjJtJwTLT8y9wPscDwqJr8NG?= =?utf-8?q?bjpwF8Pn3LD4XTWspdecSIagOcnL3VtChTX3gJeZDCi7L4uXxpHbgyMehYkeEKtoY?= =?utf-8?q?trE0fbBJetgChN3iFhvP4YSs5BnxH0FtBwnlrjCs6CeViOMFnJZWAb5ZIiau7y/Ah?= =?utf-8?q?f7NsSgRlm4t64WB5Pt/y7xqVoFPbDuVldDxpgZX5gVevIo7kgM7IIR1aCGuyzHNb+?= =?utf-8?q?sIIgtiLMsPpE9RQzN+FXBtxfXuC16skjEkwTrwvqasTBZdrGMHXNHvaxdKADKgWzU?= =?utf-8?q?TQsJvlJ6Un+GSHaBm9mJcaeb65ll3lSkC2KO49q8yevjwee1NMj3xxNXXA/ufZTIb?= =?utf-8?q?sBFMgjw0uIwdsC1xHrplx3CZacPWr76CQGph20x+S38JAmvUAkoVouCW06bN/wCa7?= =?utf-8?q?HKiOSqnlq0u6g1KxFO0YsVtOC0aHOl3b1ZhhBufh7mto5IXrW4e7dwe0fCVRf95+S?= =?utf-8?q?0DkoNPXpIRObTA9SUlmJc+FodZ5Al60QWGRuKesNPS0kf/BhumeeiDGQdwn3IiSxC?= =?utf-8?q?7K18aIRsnKoPSQgc564v9ukww4DZFdB9ku/FOPPLqM5DFTytRSzLoi/Tfe0R/TgCY?= =?utf-8?q?6/VRyjXHMR41/cg2LWKzB4qNciK4zGRFup1lL3IajYAsCt2h+Vaf60m1O6UXOSA5O?= =?utf-8?q?rl/daNabAwoIOMsg6We0YyC8Nq2Ku+cCdLtCJlYvYfckLjVyfTvo4l+FyQEWFdfNS?= =?utf-8?q?hiLuPXdNp8OIEWzqSLGDqwHRC6EhrETTCU02phbQqSF5BWPlNOYhIQa9KpCS1Sn3+?= =?utf-8?q?Zgl4wjlqSR4hche7ZRNVnYimToNdEtTj4HQ4zAWTi6LrkEOaeyGVcDXE=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57dd02ae-a9d1-43db-2130-08dc7f4df3a2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:39:55.7303 (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: JKDnMsHbXnIzYKgIHOB3OD+pUeO+2mVafYHJ3gz+1W1BcqCOgxbJItR7vn8TtNQoQ750cV8b3qabA8h7fvMkaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 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/pci-imx6.c | 134 ++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 63 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index c5d490afa981e..5e21fc942e90e 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -103,6 +103,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 { @@ -670,35 +671,75 @@ 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) +{ + if (assert) + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6SX_GPR12_PCIE_TEST_POWERDOWN); + + /* 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) +{ + if (!assert) + return 0; + + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD); + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, 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. */ gpiod_set_value_cansleep(imx_pcie->reset_gpiod, 1); @@ -706,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 (imx_pcie->reset_gpiod) { @@ -1442,6 +1446,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, @@ -1457,6 +1462,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, @@ -1473,6 +1479,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, @@ -1486,6 +1493,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 May 28 19:39:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677229 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) (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 0FF5717BB07; Tue, 28 May 2024 19:40:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925207; cv=fail; b=Cv4buc7CdVZUs0rRPMftYXhVEnxs7E57yh8f6ggn3MKDyPqWZQjHv1q1KCV894f3dRx3dUpB49tPL+JE042qXOT+fTbMGmjtFF41STFBb1sFC0Ug0i9uHb0qvDLxp+n9teqbvDO0NLdCRtgf/3UxV68xnAH7NasznKVuIiGMoAM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925207; c=relaxed/simple; bh=8xOc8FHVDA5CYg4ysfXUDK0s+odx3UuJLqh5Cmr2E2M=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=PFw3YpE0pEFC4OVnPrsW2ZNgfpfW8bpEwvo1G/slLYQJ+BgRyk3E0aGtj8bNOHxtpgaWoIaQhk4h6HTFtb2E4r9aVNhg0Pu6wL//nyT3bEm43jNMxNrrmIF6IjW1470kWpUQprWGF7NDKDHn7MgTiRws5zOPAPqVeFBYzwPE0Vk= 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=l5wwo/lw; arc=fail smtp.client-ip=40.107.21.71 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="l5wwo/lw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fXXe6d6mVPiAISQIfqPuCHXgumL//7EFDkQ5QlI6ANUEIFuplwxIIJr78yk8oCVe1P2erSaFgGx5W1GMGyX8da30c52UaPuSmIfgkplnGUzReT8pf4O8pw87gF7Ub3Jqtmkl1laI8F8WYtuArNdM2yBXjM4ArKLkVgfM30mrHmHTG47tanLRO/Pdm8n4WJpCjR0sjn7CEGhRZl2ptpk8xdyP5GNgIDtK/oUUiZTm7e5QSFnjXCisnjaJZrcwO20AQdQasMbifLb8rSNpWPtaY6TrElndLifZ5q9Py63aYkxwTP/bdVVPcA7KSxmACtnkUQttDvEMT1k1LxG1vm6SAg== 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=0M9WIgOQl4llIMpW1aAUyGhkZhEC+Fe2S4zElR+oQH4=; b=fX+2qevUZTVeNkyQHu+954ym4TZFNS3zGw+FFre+d7iNIyby4Xsrh1++O3D7FQh+QJCrMmA5clEHaxYpqSrg5ir/WQ0yS3ZjrJouZb6dUdNGSlyCKV8KhIQ1J4Ej8+g8Z+HicGn8cpjuLtO/SID+zSCFINb4XdkTrwuysxCtBVyAn8R02JtB+yWVG4ErhAEoI/b7oZyqUOOwlVwFa2/lekvg6w5tUhQuZ/Dn5qsQHHKwRaSNc2vQbeK4bHoebo5CVJPYinCapkJ1XMBSCiRg8PzRaoRShuy5tdiNA1pWFWs/BcycXXfyYScS1rcBed0QZgOi+SjVbZu+cDtl9LT2qw== 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=0M9WIgOQl4llIMpW1aAUyGhkZhEC+Fe2S4zElR+oQH4=; b=l5wwo/lwpRAM+156in7bfpjWHomt6EQQVXq90UOYCsGOSHxtT/1GVT7p0TNYjnz8PLW48GANhJ7T2ZEMmwfI9Tma1S1IO5lftAQMjhsUHKFY2lPJJMMw2jKfTu+m01OH8WxxonG+XIjtQtjAH2HqABxB/Bgk9yPQJSjBHYd5QaI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:40:01 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:40:01 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:19 -0400 Subject: [PATCH v5 06/12] PCI: imx6: Improve comment for workaround ERR010728 Message-Id: <20240528-pci2_upstream-v5-6-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=1779; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=8xOc8FHVDA5CYg4ysfXUDK0s+odx3UuJLqh5Cmr2E2M=; b=QJZ6JJZw+iCIa2mgfIFRpS8hV4kH/8cpSYH3EcOuAOFnJXzcbPqQjw6Fm+W8j8cx1XHxfp/kz Npf7iy0FkYKDZnAoUvNE+eYkZ+Iu3t/3tWG1BYffA89B8TlIHyFyXPG X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: 67a2e174-b692-4404-ba16-08dc7f4df6f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?MQEpnOnsPtgxdMZATKHc1dVEPX9rjYG?= =?utf-8?q?VtVlk0JNH+4/AsTrTNXT0gzIO0m3yTLice4FLU14aMDSBi4utAn1DDG18rjnhuPlQ?= =?utf-8?q?Kl1z+nVevhcYH94UHXjdgiQka/M8krIfc075wecMO1FIWAtzFXUGbn7V4LocLymvi?= =?utf-8?q?yx9F6235EiXsiesbtuQl/8FQOh4q0/3CzaM6YrjKALIpDd9MwZqAp0RwtPhI+0nKb?= =?utf-8?q?EzsimYBrm3PtZB3DKmSwEyYayzcCnZeUFH5aZl6VESVvozr1rj7q4fO5GZTFZxODz?= =?utf-8?q?a297Lqjt9Kz8r5UeMBoLDrLmyRI9De1HorVANtYnCcaH4Gc6m2Su8cqVQUc5QcTPM?= =?utf-8?q?tctTV345gI8jvlAhlRoc7NlFgGGQe9xwkJOD2UiFz69P8L74vqrETTm/4k/Vq4Bqo?= =?utf-8?q?6093FYBMgaXMRf7dObNnengCQ21zg1BAEHZEIshkdPJm0AOU9PqVnQeBt9dSWlkan?= =?utf-8?q?/0vp2zVKgC0my8wbgYM97hkq73KBboWFEXZ3q8fgF8EYCY21L3xxmuzg68L1UypuT?= =?utf-8?q?XojKU7xOwglqfcDQwlIuj+mGtduKewqwExgp+qypCg0miZsN0PCVQA8VFQjSoXI1l?= =?utf-8?q?OIQoQLI5KZ6+n+cWHrhCI9MiIS0mddavM+OHLnyT5Av6NqUNDdBMyrVp+ATOsOWf9?= =?utf-8?q?kLW28EDTiqgofQtNNO5ox3dt/oFCBsDhMTol7Pu3TCBUnko4MlmEFtqfgNWWiq2Eu?= =?utf-8?q?D80kst6JSH6vqwxvZBhBeIW+hM5rpsCC/tuletR4QgzzTIIp1OHSm3Vb6nXC8vmsp?= =?utf-8?q?UcpfNYTwEzHvPQT837CdCgaXG9nHOYdxwnqaq2WZ7kx/EscSAQwR4w60TSk+9AWTZ?= =?utf-8?q?HmqclK9ZYYXspLB5NE1qdrQESPSzBznLABYB8P/y24XNXqI8kS5gnsBbCwfSfMNyN?= =?utf-8?q?yzg8DolaFLexTtCbwHAc+R0FgKJjREA5ATqa2pY65/K97XzHttBxdLqpdGIzzSEUs?= =?utf-8?q?6Rz8tov9/7KSLX5FhCnl9T3u1vAWADv7SGJ3StBL0+CKvIf1Fx/FkDpYl+Xjdi/5h?= =?utf-8?q?wpkHIlS661Xry12UetEW9SsNys9TxrujgzPDiMqLunjo0St4sL0sE4X5Xd5xUrMQD?= =?utf-8?q?yQr+XYcYvO/eC7vnNpPCe2EDHDUvlPa6xG3cggtFVneSqvuamhZeXkqol4nikEE+P?= =?utf-8?q?JS+rkpaHuihRkQHHr0OXuDbOGi+vJwkFLJUcDWbH02XaHIY4cBLDrVz1SWPKf3QW/?= =?utf-8?q?9i6OocFTBfwPyfKtWPMYKLoa37Z2TZBmQoj2Tn4xxqnDYs6gcv1tvEvT/lZfdQgdt?= =?utf-8?q?v9sbE040VcppYPwDCIh+gXzOvxN4VnCepjw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?cwyObQj6krrWMAqwoSnC/E6ptz4T?= =?utf-8?q?4FCJn54OKqeIQYsl+KiewpVbOm8bCHKJhOGlRpnplMIP9HJE0y/Fn1yVCzqMy1amw?= =?utf-8?q?AIMtLZZvHwgoq9hBN+p+1b7TA2Yp8EMZryhQjJAjzQBZBcIorhqD7J3t+13HKpq/W?= =?utf-8?q?W24fGqFco+Ug83RE+IIbF6uXjHORbmzQOXS9lud1UWwx0GLGOGyFyNTCMr9WutQxr?= =?utf-8?q?MVGWKY6P1oxBTO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BErmW6FxnaifztcO3q3PbUhC5CezIBY9IBukKoPZjZSk/AbRa5?= =?utf-8?q?3cjv/X/OvMrgDmymT85VDGIWhXcp+Krwttux0bx7hucUJr+J4HAxZnL+0JmOPk4hZ?= =?utf-8?q?plmuqnT7mZ3SCxIQdObqBK6F0BLk5Uy4OQBcn4cF9MP1QvqhX67mLAn3QMfcbcRZZ?= =?utf-8?q?CkGz9JgmcX5V2dDqPY4AhyDhfH560GMt3pAun2QStNKOQ5iMqmi76Yqa36YxW+xd4?= =?utf-8?q?vTha/qOTzhzoylVwoJnTJudeKBRjUX9rZgyW5amKs2pf8PZeASBu+7mpcmQA1eMSt?= =?utf-8?q?Vs+e4OprrIAxb28ovsRrfgB8RKH7sQDFYQt6+xnaxDCDKK0PHIfbER9wU7A/UQoWs?= =?utf-8?q?mDLJrDGJ31y1KuatdlpAS+0fuP8Xwoxt6IFWFQxNEwiTfnMeKeWzCAcY=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67a2e174-b692-4404-ba16-08dc7f4df6f4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:40:01.3175 (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: pbsX5tOYV2pupuol3g1juA6zmN6BU/9PjpSBXRewclZvjc34VTjRbdYDbITmDPRP0/egFmON8148tDQ9e6r3TQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 Improve comment about workaround ERR010727 by using official errata document content. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 5e21fc942e90e..5533b7ad0f092 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -713,9 +713,25 @@ static int imx7d_pcie_core_reset(struct imx_pcie *imx_pcie, bool 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. + * Workaround for ERR010728 (IMX7DS_2N09P, Rev. 1.1, 4/2023): + * + * PCIe: PLL may fail to lock under corner conditions Initial VCO + * oscillation may fail under corner conditions such as cold + * temperature which will cause the PCIe PLL fail to lock in the + * initialization phase. + * + * The Duty-cycle Corrector calibration must be disabled. + * + * 1. De-assert the G_RST signal by clearing + * SRC_PCIEPHY_RCR[PCIEPHY_G_RST]. + * 2. De-assert DCC_FB_EN by writing data “0x29” to the register + * address 0x306d0014 (PCIE_PHY_CMN_REG4). + * 3. Assert RX_EQS, RX_EQ_SEL by writing data “0x48” to the register + * address 0x306d0090 (PCIE_PHY_CMN_REG24). + * 4. Assert ATT_MODE by writing data “0xbc” to the register + * address 0x306d0098 (PCIE_PHY_CMN_REG26). + * 5. De-assert the CMN_RST signal by clearing register bit + * SRC_PCIEPHY_RCR[PCIEPHY_BTN] */ if (likely(imx_pcie->phy_base)) { From patchwork Tue May 28 19:39:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677230 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2049.outbound.protection.outlook.com [40.107.21.49]) (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 98D3B17DE03; Tue, 28 May 2024 19:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925213; cv=fail; b=m5058LykTXselhRgXfjUwjxhOl8/jNEDafY2ZE3zlJYrTab7MSj9ZsmGI6mjVnBDB8wkd7EbOHrFNXp+ORyjDSqUoDQurzT/wh+9Dj5VwS9MYpIdWc2ATwbM8+4+/ihi1nxUyvA+vcyPQFmSC7NEHAh+Xn2rK6i7tpvicFRgUqc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925213; c=relaxed/simple; bh=xoXNJ0fJHAePQQUrByL1t4DV7f1MdI9LvJJHe/ZdxUE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=TbzdeytQD6fgtpRdjtp5be2caKgkMAZZuHfvc4hhYzkRF1H9L24CkaN8HiWds/2AduOijnBmY2bRoE7CGZKC9BFnwxSJA1jOkbWarGT5rEmKcd2EuziBEihM7HqKvBlEbLlUK75cWRVOt2eaocUs0AjnqIDZKJ3NhTrQAh65/zc= 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=W/fU7AX1; arc=fail smtp.client-ip=40.107.21.49 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="W/fU7AX1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y2yDaDXATXVcGLNyzT3ulkXB871m4a9mAWpvy26TnYKlPKBTFY/IH8JkzAl1AkJ74zY6E9M7L60A5Vm65IM/f8RqbOWYgZG4yEJmLpTK3sEtuyeK8WZd/VtOjV1N2/s6ax0PneiCxoGklku0quTD73ISzoZMqKRu910KtELWPMip2+WX3o2csSiPBApvUh1+vGL0dQwNr1e0gtaSVSxAg97UM99ZDVKzxrTOFsGlabXRggVNev3wADsBSA5tUe+Z3G7vUyJc1vm1Sd+GTcs3iO9EAl0XBG3zd8iFofbV94RevDp6FGByfE37fp9kTetz6BXJHJUMyf4Zr1qI2BHJLw== 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=fmy4S6QhQEeuj7lBEuawWfjth1Lb4DCHggXuxkqA3C4=; b=DE38Df9OjSrjbFAhilYyaxKSOR7igcu3PQPJ6QqCqwqGMbs8r+ws7j7g3Hgj+Iw5GkpYtYygQKCWWtWjealQ3DN6kaQTPZieKiNvkHzvsL2TBJpKuU5IRxq0SSR2KknAtZBp/wphP/UcjUdgvmY4lboNPUQVEnjfByOeXuFFtY56zCBbOZS03fl+ZxUUvC/dP0PYSBLhq0kF08cTWbVx4fBHTJcZXPVd0szH4oaDiUbuNLIIEcM/7Usod7LVGd3aADmkkEmR/LRsUBsT0WEZaVFAOLDXat++Nce3qeARVhbD1iALEsgej7j1vsAKkYarfYT+cCmCFeQg+hpn1qchRw== 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=fmy4S6QhQEeuj7lBEuawWfjth1Lb4DCHggXuxkqA3C4=; b=W/fU7AX1ZzwaP4vuATHF2gmk49dJkhAVEk90R1LG/GnWwmQWufTqfsu5gTfYoT8k4ffpsr2b6Bf/Y4MngsX5yzhUOyWhbt0XyqA3g5zpymzi/rOI4uZL4m8fCrztUE2vd3AkL5z1hY9FL3ZybnCZ1cCBMEty6dfiLz9tM0EZH6w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:40:08 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:40:06 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:20 -0400 Subject: [PATCH v5 07/12] PCI: imx6: Add help function imx_pcie_match_device() Message-Id: <20240528-pci2_upstream-v5-7-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=1526; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=xoXNJ0fJHAePQQUrByL1t4DV7f1MdI9LvJJHe/ZdxUE=; b=iUXNXi/woPUDP+oGO6Q9Pn1+lQPpcpgZwDats1iRa5nh59rW4giMit0kwn+KvaOrg6XL1wpI9 f+ohjdOSOCFAVTEGj2uWtQINpzpRAjeZPz2Phtrt2y0bNHh0/sGVOSB X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: baf21619-a6ec-4473-9924-08dc7f4dfa4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?v/6AWM9bEAyjn54FJVN37uLsl7DDeUv?= =?utf-8?q?4dMcdSV/r6VXzK0reMcB+N++JVfvzH/6NkpHy0m+U67hud/0CHhCI1NiMQyQCSpCd?= =?utf-8?q?mAjpClZ+qD3MiEe5IT3G8TlKEMVbzt5n87yzMwYb12VON8R11D2fhEcWlYinh2zPH?= =?utf-8?q?hAjOFOAkQ+w0ARsNXBLWXonQFPBBfi+WZQwJLe7L0YdHdKI+p+haF0BzgmUy7Y6/S?= =?utf-8?q?Ug7Y2GgVpiKfu4u7Sm5t5EQsOEA6x8FiNBPMMq9zqa/ZAeUjwqOv01/a1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iwOlBTmknyA0/OcX?= =?utf-8?q?43vldDkiY9+3j3wtC38GooK9+zEcFelGEyhoHXMkcEhqGLCu0KoMlY16DXydGuvNq?= =?utf-8?q?zlRIo8SAeFk8eXFpg+4LiEOv7O8/4gwW6tgTlHnvv/k1S4+AMdzyFyDwcCS7qXe4W?= =?utf-8?q?z5w8ZxL08WmMhwjWNLI4LAE0JJHAi2K5EYesQxOx7lhQnE1Hz7G1c8u0=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7hTpDXzrsmINjTSZHvt3nPFgeB9v?= =?utf-8?q?/kduRMxsspuoKLcE+D+dapXNHVrZCeEsYPn45R4E+lmeB6j3nUUg7Dl36MrIDObSu?= =?utf-8?q?/cB0T90e5AbT2Cxk1ZzLu2R0+mTcIgzU/jfo+m1LqBifqM867YRF/9alrA7Jim+EX?= =?utf-8?q?GyfM3NDYew1HC31dhdi5pVtvpcPWoWuNg9ueM6PeaCvB1DRVZJTzxJ1pXxDZEwMBh?= =?utf-8?q?KnyX8FJOBwxb3UId8L/f3ZLHHsD7L0bJZtQzJ0lUjJn5u5T9w4CGJJxrKbMd3tiUj?= =?utf-8?q?b42gAldQxJyK4x9sTvsicDARcLEoNxs+0stJlY7M0LFwIdR3j8ZrCinyci2fK2w6e?= =?utf-8?q?gVBvC9x0PAz3bhbsdvfl3AfUWwQPstNd7n/1s9sOw4EsxXb1UOs/ziy7IYxywxdxB?= =?utf-8?q?Gk0MVUhD2TOlbHMULbHPCEF09JQC089CPSTMwVotZJ5M7knbVlvOmjZcTx1IX8qdq?= =?utf-8?q?l0xP+JnmTb7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NRBWO0sOXBSc64FOCV02q07GQ9iWxfgQXBHAUNWKX1o053BTSkLnWNm?= =?utf-8?q?M5xLghX5+M4PGibj0JMy06GhTY0nBoMF6s67egHO6py3SUoNUzAcbsvz/mse0F3K2?= =?utf-8?q?LAlzXLiIayKUunJIgFHoLASaBfAInrWcQRHag86iv9zdavf/0HY0S/Ns=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: baf21619-a6ec-4473-9924-08dc7f4dfa4b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:40:06.8941 (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: 0jL9DGuE8hboVwFs01ZdqUK2dz7MLzJhPNavv9vzpw7ewJsUP/DusJnwQXUCS2ogZaQppMAPKqegQLuM2KWrfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 Introduce the help function imx_pcie_match_device() to facilitate imx_pcie_quirk() in verifying whether the device's bus driver corresponds to the IMX6 PCI controller. This addition lays the groundwork for future support of ITS and IOMMU in the IMX95. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 5533b7ad0f092..29309ad0e352b 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1646,17 +1646,25 @@ static struct platform_driver imx_pcie_driver = { .shutdown = imx_pcie_shutdown, }; -static void imx_pcie_quirk(struct pci_dev *dev) +static bool imx_pcie_match_device(struct pci_bus *bus) { - struct pci_bus *bus = dev->bus; - struct dw_pcie_rp *pp = bus->sysdata; - /* Bus parent is the PCI bridge, its parent is this platform driver */ if (!bus->dev.parent || !bus->dev.parent->parent) - return; + return false; /* Make sure we only quirk devices associated with this driver */ if (bus->dev.parent->parent->driver != &imx_pcie_driver.driver) + return false; + + return true; +} + +static void imx_pcie_quirk(struct pci_dev *dev) +{ + struct pci_bus *bus = dev->bus; + struct dw_pcie_rp *pp = bus->sysdata; + + if (!imx_pcie_match_device(bus)) return; if (pci_is_root_bus(bus)) { From patchwork Tue May 28 19:39:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677231 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2072.outbound.protection.outlook.com [40.107.21.72]) (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 AEC1117DE1D; Tue, 28 May 2024 19:40:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925217; cv=fail; b=l3z+ByZ3IuznMADsbvigLUDRkntUmSjpGJat4kaJwBkaKUSR1114jVeLd57+9qh8paevEWKJjLVbTpjCc7Ywmu/n1f7bFYo/OJDnW2vJkQfvfYf6hoe1LIPKHhxfAiCMZBiqHHUkfYlFwdXtkJWntFf/XtKZy2dsOT0B+GEk2CQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925217; c=relaxed/simple; bh=4Z/jtzADCobosRpqG+x9r9Q2NIoYvwiipmKvOkgwitM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=WIVnJaXd6ta4/f56R8qGSJmWnOR7ryeXFU0onvGQfsZxnQMM4Nc3MqaSbALNqoCt/BHgEhCdax8fXtLmvvr+fxGwqbr+JDd/nXLLom9ENuHtRl55p6A6Cg9HSo3citDRCYsjOFG3UYVoV31ME+tosv1tnSyKepNLyRSCKU7AkdQ= 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=oB7fY5JN; arc=fail smtp.client-ip=40.107.21.72 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="oB7fY5JN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DPXUT/xRc0h1/t7ttkGLbqLTT8LRTXClCk2/tKwgZpeMHdUbNejLSvKInY1i7yf8ERe1a4Lx1sPyZU3GNwX5NeTkkRWveXlFPqZuQck5mYrbvRS+z+5GzgNs5Z7SWuqujiNNYQCeYjmGMuLWI4f5QeY8KBs4B4011NEbYaL1UrjYjHfc5r3bQ3vbHQaKthzMFaRZMq2OKQQQ16rVwE6XtismIqjoM/korCE/B0BXT7aOUva5fHseeyMThJ7ydvR+KMi8zqFspHw5veJgddYkkkuGxyD5WQ5IuqKZlPdXYN/q5EONZ/7a/AZT5L76I862RED6TmMNRJP05pv+e5j08w== 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=p0JhgvnJpQxFaI/hR2haZinhHcelur0CB3uuFQTrWMo=; b=MX4IQ9VzlS80z7F65OoeFbTuFm2MBUxsthcewPizKWXnreJqEMEGasQY2MWKlzyeG1mowrNu2kCDBFANxnIuFC4aKbTq6WOmrB6Vhpf6xWZnPJdGfDOQUkjgwFruAbpGVEr1xMySxzkqnztMD1IAFRqCz8KQiI7d1rxry6p05pWHz2yiy2XOPY31P7/up7XjaIXZS8kw0wUg2AkbhOjNMPXONpVGG9dqNU8stogAOyjKu2wqWKaFSLkNH76XA1R1vrSo7auIXK3fmfr47UtFBuIw1/HcQWxpR0Vwv/Bz8aOab+e34nJ/DTvJIWCDqC7VLzE0wP+4sFzXRzfNXVFNLg== 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=p0JhgvnJpQxFaI/hR2haZinhHcelur0CB3uuFQTrWMo=; b=oB7fY5JNi3arscSxLQbuJRByo9SV7aa+ThY7HunkikX4aOKQlOhOmMNZfN0fU4brOlcj48IMJqcFa2RykA3UiwKCl7zDDiCKieRLTPiSgjK7/JniMWOLjpOl+oDLaP8gNLpu0b90ROPE4gboTmLCZANeyhzCjj6sHD7vKt97dJ8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:40:12 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:40:12 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:21 -0400 Subject: [PATCH v5 08/12] PCI: imx6: Config look up table(LUT) to support MSI ITS and IOMMU for i.MX95 Message-Id: <20240528-pci2_upstream-v5-8-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=7874; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=4Z/jtzADCobosRpqG+x9r9Q2NIoYvwiipmKvOkgwitM=; b=Uw1Wl9+TsOatrqdwWVMpCTuvwQFy14QL1sJI/Y5TfyZYNjtnTkAM5o3ieXFJ2yYm7A5nZQkBs FbQEY7sl2TFAcNNWXvK2HHt7Etau0Cqaw2HrquN+U6VqLGeuYhowsz3 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: c085ab92-9185-4cb9-5490-08dc7f4dfdb0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?R8QdEnhnkA4KHy43C2+9SP3LncUnUxD?= =?utf-8?q?Za7Qt3w5jk2o5h1NPB/vq8+2XWtxWNxUIjx8w3mt3yWQR6wNM4blQ/9S4gxtfLnsd?= =?utf-8?q?xhE5nEdR7aIt6YFMfOjQ1pZRHZ2vXQw8SB7Jyjv3Jyp2d/UVventEaxbFzJovOFW3?= =?utf-8?q?qXwDsq7b34Yv3RUF9ezb5UXuobb3AUWMWqOWU4qcqdIfx/qEniDm/Ks+n0yzklHJ6?= =?utf-8?q?Qg0HuMN4wUa4Hm1hVz1ovWzqiSBQQ2xFO8MesVpB55fHGZ8eXE9B8sSXtoKAj92AH?= =?utf-8?q?PmX7AJwm5/l6vJBjYceZ52Gr8usLDtb0QODeFB+Zv1OoWgOGf4FltMy7PGeqnt5F9?= =?utf-8?q?lPIUZ0fSGnH5m7qCDjGRCA56G7YXDsbGocDR3VzwIi7O7PhGCalPY72xBLtvgN4hl?= =?utf-8?q?8TE0fe3ccU4q7V6gOuIFp9rWtezhGg5Q5tWDVjC6LzOqllv8Lu1bRbTlSGQNhsNMg?= =?utf-8?q?NOyZTCZNakDuO7RoYEFP7HgIrPuVmA8Uazm8x3SV0peByFn8OKqt5Vww0XVco212j?= =?utf-8?q?4lgxbqapcTXJe+WRmAsZdaFG5Ifh3/Hf4ZQPO47s5aK6npc2aJCJJGXGgX5m8oXY+?= =?utf-8?q?i8u7aOU08pwBLQPrqM6irXlNKMgkwObGamVhveC5R+yNsHPiWHMlok1mEuZr4DyyT?= =?utf-8?q?cAXIfTyFooTvZYdTy/vsj1+SANbK6pCo40qAmBapVnmVQaUhAGVFcwr9Jf8NcQo5E?= =?utf-8?q?VZjzIbpdEf7zzHHmvtzzWzxff+zIqHMg2FMPMzTWksCq53utc7nxFpRlzaI+ZAbu9?= =?utf-8?q?MTTmwHRBGop5iA0DAQFILDV5SS4FyZtumQ0/GY3PCicPjFY5kAe+BSLa7eAmkTC1D?= =?utf-8?q?wzljjBTKBXglr1roEvjKRElX8sp47pzvjgPBoCD1F0qHK8bQwxdXCrTWZd5JDFI3v?= =?utf-8?q?s46rGjALWKZ5p4Q+eympXSAmzQ7CK0YqSSTFkC7w7sTAb2ZebJSqaLVeQV7Gn2FZ0?= =?utf-8?q?41SYsVXwpLv7QFr4WxZlG6PlnHUMiwL+57O54wLp4+4JBzfZhvPQofg59vD89MJG9?= =?utf-8?q?2D4+3T6ZnjPzTSUHK4gYTsQiyL2YxbdDz8SVq1rt+KFO0NMSGJXCoB0N1yvuQRoZX?= =?utf-8?q?PZRPGiHoTd2BUDhyywaBxiQ3h0HKRG9b7yRHSC3wTQ5ZiJOEw+8wdDBjDzk6XIvjj?= =?utf-8?q?jco7kQk9LmKUVkGLbCoNXYfB7/BkNQALbeOk0wJfm8VmczgS5a21ZUagckLjJ26o3?= =?utf-8?q?+Uo0hThGnonNKLOJPXl9UZjPUhil4MQsCKFxUFf5uiPW7yfPaeo13jDlRimGk12i4?= =?utf-8?q?IFYWbhP6Ox8gD7EqBSXQq+k8HzINu24GLcOkbehU1rH3B2/PU7BqjEWY=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-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/34xEyHsXzSKfWk+1S44ARsUHeRY1qCOlvGrVOnzzXC8tvcWjnG8/xX3u?= =?utf-8?q?qdGxcRSDnudk7eQQdvgRT3FSqHav/ewU7JF+6VRG7qv5tJkkTWuKZRn9TjhhNx9/n?= =?utf-8?q?aCrC980e69KmS+q8kCxsXyAHZJ7emB6ORQ+say60JBIPhMmA4PiyTWWd+/cu9Yv3h?= =?utf-8?q?XKQFFq/K139ppSXJeZheV+3R/KyGSQp//vTzXxzdrpwnRcgWC9T7aZVca/5JZfyMJ?= =?utf-8?q?zPQCtkxVYK146PhxU8q3UcRFhXx30CHgqywcJFM/kRmRaStZMoThx5zMQwfo5aGD1?= =?utf-8?q?7hk43Zd9n1J38LRvBMwLti/QXDejqJ7DXr8jy4fiXChz3XkccsHte4Cu04ppBSgWv?= =?utf-8?q?dUEw+dcGT8iX0sKbAzJFBpyGl75DTatq7kOctJhqbSCBLBqIja0MCnlbQ95YiH3lT?= =?utf-8?q?/03rn7jDnSeha+ks70DDPcSbwym4gyKw3FABEyS5oib27k1ga3d1mKv4sZIQjwdGX?= =?utf-8?q?3+0dIHB4XwqlU0hxrYU3zW8QJ1yM03zQysSLHgS6Wr/82UBUYem4HDTovKZpLCpcJ?= =?utf-8?q?A6C/dOBZVYFqkBTEaTxiGuYlkbJY27gLsPhJpinl+KfOak0km3a6VDe2m/NX+ssRW?= =?utf-8?q?K95t39tlZKhCP0/9WFiCFfkGTrm0db0LRDiEmxDWDkHGDAL/9MXto0QQ=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c085ab92-9185-4cb9-5490-08dc7f4dfdb0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:40:12.6075 (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: LcJ/MdDzbLU+Tn575ABpigb21tACcs7Ivp+0n2L5iBg+bOJOoWrqEpcwjXFDwNB5fvtpJXAhRRDo7nc1Rjreiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 For the i.MX95, configuration of a LUT is necessary to convert Bus Device Function (BDF) to stream IDs, which are utilized by both IOMMU and ITS. This involves examining the msi-map and smmu-map to ensure consistent mapping of PCI BDF to the same stream IDs. Subsequently, LUT-related registers are configured. In the absence of an msi-map, the built-in MSI controller is utilized as a fallback. Additionally, register a PCI bus notifier to trigger imx_pcie_add_device() upon the appearance of a new PCI device and when the bus is an iMX6 PCI controller. This function configures the correct LUT based on Device Tree Settings (DTS). Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 175 +++++++++++++++++++++++++++++++++- 1 file changed, 174 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 29309ad0e352b..8ecc00049e20b 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -54,6 +54,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 { @@ -79,6 +95,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_MONITOR_DEV BIT(8) #define imx_check_flag(pci, val) (pci->drvdata->flags & val) @@ -132,6 +149,8 @@ struct imx_pcie { struct device *pd_pcie_phy; struct phy *phy; const struct imx_pcie_drvdata *drvdata; + + struct mutex lock; }; /* Parameters for the waiting for PCIe PHY PLL to lock on i.MX7 */ @@ -215,6 +234,66 @@ static int imx95_pcie_init_phy(struct imx_pcie *imx_pcie) return 0; } +static int imx_pcie_config_lut(struct imx_pcie *imx_pcie, u16 reqid, u8 sid) +{ + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + u32 data1, data2; + int i; + + if (sid >= 64) { + dev_err(dev, "Invalid SID for index %d\n", sid); + return -EINVAL; + } + + guard(mutex)(&imx_pcie->lock); + + for (i = 0; i < IMX95_MAX_LUT; i++) { + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_ACSCTRL, IMX95_PEO_LUT_RWA | i); + + regmap_read(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA1, &data1); + if (data1 & IMX95_PE0_LUT_VLD) + continue; + + 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 = 0xffff; + 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, i); + + return 0; + } + + dev_err(dev, "All lut already used\n"); + return -EINVAL; +} + +static void imx_pcie_remove_lut(struct imx_pcie *imx_pcie, u16 reqid) +{ + u32 data2 = 0; + int i; + + guard(mutex)(&imx_pcie->lock); + + for (i = 0; i < IMX95_MAX_LUT; i++) { + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_ACSCTRL, IMX95_PEO_LUT_RWA | i); + + regmap_read(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA2, &data2); + if (FIELD_GET(IMX95_PE0_LUT_REQID, data2) == reqid) { + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA1, 0); + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA2, 0); + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_ACSCTRL, i); + } + } +} + static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) { const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; @@ -1232,6 +1311,85 @@ static int imx_pcie_resume_noirq(struct device *dev) return 0; } +static bool imx_pcie_match_device(struct pci_bus *bus); + +static int imx_pcie_add_device(struct imx_pcie *imx_pcie, struct pci_dev *pdev) +{ + u32 sid_i = 0, sid_m = 0, rid = pci_dev_id(pdev); + struct device *dev = imx_pcie->pci->dev; + int err; + + err = of_map_id(dev->of_node, rid, "iommu-map", "iommu-map-mask", NULL, &sid_i); + if (err) + return err; + + err = of_map_id(dev->of_node, rid, "msi-map", "msi-map-mask", NULL, &sid_m); + if (err) + return err; + + if (sid_i != rid && sid_m != rid) + if ((sid_i & IMX95_SID_MASK) != (sid_m & IMX95_SID_MASK)) { + dev_err(dev, "its and iommu stream id miss match, please check dts file\n"); + return -EINVAL; + } + + /* if iommu-map is not existed then use msi-map's stream id*/ + if (sid_i == rid) + sid_i = sid_m; + + sid_i &= IMX95_SID_MASK; + + if (sid_i != rid) + return imx_pcie_config_lut(imx_pcie, rid, sid_i); + + /* Use dwc built-in MSI controller */ + return 0; +} + +static void imx_pcie_del_device(struct imx_pcie *imx_pcie, struct pci_dev *pdev) +{ + imx_pcie_remove_lut(imx_pcie, pci_dev_id(pdev)); +} + + +static int imx_pcie_bus_notifier(struct notifier_block *nb, unsigned long action, void *data) +{ + struct pci_host_bridge *host; + struct imx_pcie *imx_pcie; + struct pci_dev *pdev; + int err; + + pdev = to_pci_dev(data); + host = pci_find_host_bridge(pdev->bus); + + if (!imx_pcie_match_device(host->bus)) + return NOTIFY_OK; + + imx_pcie = to_imx_pcie(to_dw_pcie_from_pp(host->sysdata)); + + if (!imx_check_flag(imx_pcie, IMX_PCIE_FLAG_MONITOR_DEV)) + return NOTIFY_OK; + + switch (action) { + case BUS_NOTIFY_ADD_DEVICE: + err = imx_pcie_add_device(imx_pcie, pdev); + if (err) + return notifier_from_errno(err); + break; + case BUS_NOTIFY_DEL_DEVICE: + imx_pcie_del_device(imx_pcie, pdev); + break; + default: + return NOTIFY_DONE; + } + + return NOTIFY_OK; +} + +static struct notifier_block imx_pcie_nb = { + .notifier_call = imx_pcie_bus_notifier, +}; + static const struct dev_pm_ops imx_pcie_pm_ops = { NOIRQ_SYSTEM_SLEEP_PM_OPS(imx_pcie_suspend_noirq, imx_pcie_resume_noirq) @@ -1264,6 +1422,8 @@ static int imx_pcie_probe(struct platform_device *pdev) imx_pcie->pci = pci; imx_pcie->drvdata = of_device_get_match_data(dev); + mutex_init(&imx_pcie->lock); + /* Find the PHY if one is defined, only imx7d uses it */ np = of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0); if (np) { @@ -1551,7 +1711,8 @@ static const struct imx_pcie_drvdata drvdata[] = { }, [IMX95] = { .variant = IMX95, - .flags = IMX_PCIE_FLAG_HAS_SERDES, + .flags = IMX_PCIE_FLAG_HAS_SERDES | + IMX_PCIE_FLAG_MONITOR_DEV, .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), .ltssm_off = IMX95_PE0_GEN_CTRL_3, @@ -1687,6 +1848,8 @@ DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, 0xabcd, static int __init imx_pcie_init(void) { + int ret; + #ifdef CONFIG_ARM struct device_node *np; @@ -1705,7 +1868,17 @@ static int __init imx_pcie_init(void) hook_fault_code(8, imx6q_pcie_abort_handler, SIGBUS, 0, "external abort on non-linefetch"); #endif + ret = bus_register_notifier(&pci_bus_type, &imx_pcie_nb); + if (ret) + return ret; return platform_driver_register(&imx_pcie_driver); } + +static void __exit imx_pcie_exit(void) +{ + bus_unregister_notifier(&pci_bus_type, &imx_pcie_nb); +} + device_initcall(imx_pcie_init); +__exitcall(imx_pcie_exit); From patchwork Tue May 28 19:39:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677232 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4ACF617F360; Tue, 28 May 2024 19:40:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925223; cv=fail; b=umd6P+33RlRLUgt5hdJBOdPnsZ9ylzOqakRkV2Phw2Jk/lvlcFyPSNs0SZrdF8kWQBgf2FuHA7QKP5epwUMvLkSefRCO6ss53vvncDeAxIxODq1asDWS+Dw7EKD11v9jpyIIhgdvv9yY7abO6yYxix/GK5JXhbqOyLlsEUajYCU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925223; c=relaxed/simple; bh=ySu5qHk7hIAcbcfDqEd059/E1Yj5995nHxkvFfStadc=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=hCBVM/P9nI3mqA51HXMAbhahSU936T4YBlT7WBMTPhy5wLh4cGIcTU5iH1zzGSWzF8Y8c7swcNd68gWfluTDtvFYUNvcP4XC4xIuBFlgGzTddupc6G38TJleyenhWngBtCY8KtoyONzhLHh7fORwXqRWFdxiZE2owByaCShi0YM= 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=B7iZDjEV; arc=fail smtp.client-ip=40.107.21.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="B7iZDjEV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZV92XfYtOBeaA/YefcwVJk8KxJMRA6i3zK+HuqSNhZotoVaT9a0dihFDBrp/Qx/E99vksrZZd6ssi39DMlFfLgDc5CQZV01Hx3AzSKwCNZWVYYWt0VN+nHtQRX+UWJEWgHxYyx3AoLm8RwNzaIUQjUItSNucXno+0voAYDRDv+06qfbC4DmDaLCTDSEXpBbq/59tMQxeRhhO32Z+JGEUPVuVXytkOrZGnQgbwgtG8UZKaV4duB4Fpq23R0T40bMStrZyVrxwWEaL3OO0gQpV+X4CF8DlJgTzzW+KDyv00yg/zUo5aLAN3TISYDzthoJHojZ4GaoQQh9lfZ2cKmU6xw== 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=XDJN2Q663bcenqdW6HOaSCyJ1hJBvHmMI8fJTReImEw=; b=VOdsGVKwBmkqJV6gaLJ3aRKCObIzKTPJnLir0/IkqlkMv5v+TArV/NXGKeyzmWVTrrG7gd86bwILS8QqsfqnjjcjYMhHgdWUF4/KF2gDZ0axpZ2W5tFUuUwTtlmofY8LbJYK2+B5D5gDuIRrXbqPJyWNfHks8UiN3fFsSDiOoknFwbYP3WZ5+LJ+XyQ5Pf5jVbXCADt9caAONVGK4Aw35wckIO06KyxMbS2OFEqF7tdfFXaASBbEu2xstCutv+ZpkrGiUR+KEnBfWQXusXKe69yRuU5HQEuuYtKM8RynvlHBaCwBbKouXFbjCjowDcAfkkgnrRIw6OVKEDergi0vPw== 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=XDJN2Q663bcenqdW6HOaSCyJ1hJBvHmMI8fJTReImEw=; b=B7iZDjEViSwHavdsyg0nWo9g6jPYk7SSRCAQx6lAIHUBXay8QNt+8K+4Px+QWbSHcz0tPhVoHkMkCuQj3kEquJAmTPF7TqlEKcdmyyvm5Sg1Z+0wGSqGKPRE/uE7KyiECAmoTBYw1L4n/9VQHxC9wCUP0gluBNmh7IXn2AgYxPk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:40:18 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:40:18 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:22 -0400 Subject: [PATCH v5 09/12] PCI: imx6: Consolidate redundant if-checks Message-Id: <20240528-pci2_upstream-v5-9-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=1050; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=ySu5qHk7hIAcbcfDqEd059/E1Yj5995nHxkvFfStadc=; b=UWIOyHZBdzRyNAfFu912U7je8+f0OrDQMMthCa8FHcdVVr4G87i2v3rjnhQ2F/eYANJTvpcLz wE60yGwuD7wD3IWM9KgFNJNszwn7cGyViVkiUO1/x04n+I+gPqbyJg0 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: cb5457b6-c835-45be-3058-08dc7f4e0125 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?AThAnTqx+RCWhUPMh9XOdByiY1uTgoa?= =?utf-8?q?pQ4/QheM2xU+wH3tBULqRqlC/Tmkr7VdBM6msDVhMqSFSdvWBKCUETf+2vIhcltD/?= =?utf-8?q?xf6o/PqSdi5u1gYDRKv3p9U9svOYcuce28APfpb+GB/GpCRTPmQj3nM55GCj04hU9?= =?utf-8?q?Is29ci6ixDdZdDqT3qFwbI/fAPnTXFG81XQGnxSsi3HgOxHkTH1dIuhlfUFIDl6wV?= =?utf-8?q?2i9xR4I2FLIlVi8EZjMcj8cJZNSQya/0tcTLYKOU9Yr9mWKupGBsfyw7yLzsaHbzO?= =?utf-8?q?vDSdnLh/yPOfzQQoYTyEaCQXHGX7n69t6jQKt1YYlS4JsjyGaxEtHArRo43OZ/DVz?= =?utf-8?q?byb284nXiOnaHplU1Tnz4g2F+ANhAW8B7ozaWHJ255+V1awdlsFsND3CcnYKQZsV8?= =?utf-8?q?ndMZaSH9TfR9ezlENE3/3N8F/65LAN+uzZxMb5ar3sXNe6nWah7vLfYlVt7G7JsAS?= =?utf-8?q?jl2R7nkeek2XxXU3CKBsghjyPSd5vdacUwjWBbbZgWYcgM7AMwPXfBHQZR2k8ORX8?= =?utf-8?q?j4HhKSKZneyQ8i8y62NIPqk+CbVOrtHlOxMNJzHCpNT9ONE3B/PRi82SB60AwU1+P?= =?utf-8?q?yrE4ed2A/bKbVrwVSFM0jZaOREyguvMpjJDOG2gAAa9kDxm9gleItU8sR6reoDZHP?= =?utf-8?q?K+SP59FEeIqw0d/Qf738lurMSvlODkNP0jFRRKulUBOu8DseCxWvdnPo+GPNcbQa4?= =?utf-8?q?l7e7kXFf8E239E3JevnUZgbpLzWRTqnfLf+ghpSbrCNtWYxgN0lBlerfLhWUxpnCn?= =?utf-8?q?OyWROc9wihwtQjfG4nSZO24hcwb1pGbtrwv1AbRH4brKgYwgHjnwMvPBIgQWjCsr2?= =?utf-8?q?M3LU9+SaC/iI/x60AgZiRwPC3zA6BtxFfTkIDrBy1POd/RZ3qMMUaKuMRg++WxtRR?= =?utf-8?q?fhMXGwcPzERVkBbGULBtc2j5j/Y1rYXYbfbNWZz4w3b21iX2PcNDY1vGY8czPcesS?= =?utf-8?q?vL9qtPC2xg/4+htJ7zZUY/uVoV7AtynKT04wZbsQwJ9b9WZ9F+5HPeMtSja2ArYyt?= =?utf-8?q?tni8I8tc3cklnL8qWEVnLoIsTB/cRWZqrl+CV2/WXnK3PhcX/jXfS/r2LNV4k7WRG?= =?utf-8?q?jyFR6fhIQBy7JOKj0reYsuNkH75mPuxF+DrlHhu+0MvRTmQJUJI8bpOl03S+J7DuY?= =?utf-8?q?vYNuszFZlVgNvrgBKwda2bSEU2acDcVnSAnq7ltTHNLn/J2cPeMQfe6SEnnjaCLfM?= =?utf-8?q?RJ8G2NxXKn9JPLI3y7DKh11sthennwYPxhu4P1WcTPkEzz+OehIuiJoZfKR0FENhY?= =?utf-8?q?ch/w0hO80kGrQwY6cOIgg+5Cmk1Jq4NB1aBtT6T4AMg4SFdf0gpAuvQc=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?A5tFnfk6euhjpTzQBGSNIuUCsuuR?= =?utf-8?q?2Xl21n0aykRFdhJSWCrChy0jPQMFsoBvp3M93equ5o/Rd3lINTuPZQa8CVqq56LdF?= =?utf-8?q?jMSwaVIJjTRXyLvDEG5s1RwXTRttSdnbWQ88diDMv79wK+dehNv/n6mZNuncPn+T5?= =?utf-8?q?9qQA2+uI1fDMSwnOFkYhFHR7Bi7oVVCddImBn/6xSW4K4BxJMJF95kO20OqyeqzH3?= =?utf-8?q?dI1OJcUWQZnrw+1Yct/kLkxLH/ot79p3vPrxE4SpMivTeha/GUEiZ0iIlXSDiupZK?= =?utf-8?q?yezeSR+ejwQqus22wss90XUnid+GJfLm2Jsf6/HpjZa3A7Vat8nRaZk34TaN2w3FA?= =?utf-8?q?StNDY1USSiUHhIvkNUeLxOdqeXT1ffnppFFrI+hvCAJTblii4I2bJ7mKIj26u8/QT?= =?utf-8?q?2THcsKCNs+aHn2ny0IFvOyhp6gvxRsjBzLPuWpyG0/HCCPmTBNwc0ostYlRNShqlC?= =?utf-8?q?UUHYTy0kEqDNzbJNTgoXzdOXgAYxzxcgOw1rsUV7SS8LCrkzJDSX8wqpcSInC+v1v?= =?utf-8?q?Hn6WOKtB80R4aF74uup33AJYiWIrCzchmAe96QiNzGRJccGn/i4FNDDZ16S0VFuiS?= =?utf-8?q?jxedfonldaQtTAWn+Hv2NpgkYCrk54mrYV+nk2qaTktu5eAd4e2d3r2vHOJvY6zZC?= =?utf-8?q?PczlQ/91dsq2HVLIKAUndHiv6asa2NVXpjhFiISCLQR7vmFsrp3rGLxGqi2lgRkW1?= =?utf-8?q?D6xYJy479jzNaGKNG5vl9n+l24KLHTIJzue6O0dnIsuRtWrm1VhimIFeqAUTSSW3L?= =?utf-8?q?yviv4tV1eUCegQO8r+/Gh1PUzEClvPb268YivPp/78d8mQ1RhICQzwKrigEhNSWkA?= =?utf-8?q?m8eN1YWipLmXaxoO61NXk73dCVbiIthH+nyc/3e/veeF85Ti24i3VpkiY3d9r1OEJ?= =?utf-8?q?GPj/fIBpTG3n+W+PGq7PXEGnQIFDVorJT8UQnLoppf/vJCyOBKbtoeLiTyVDh7IOI?= =?utf-8?q?nasfJgk2imnp87xIDOp2cCxMhGTra6BARfdptOJHushsWsXEbKnn25LPpuBm5rybP?= =?utf-8?q?lp54t32DH/BqHefy2Z2MNKlZY3SmJyfLpHzy0OUdzZYdfieW1DQrFjhuxDbD/Agmr?= =?utf-8?q?AkV/DKnrQ572wvVJOCEtvYhu/Q4eTOo2J3DKqZXN15h40YO5APoAKyRfSjQtDa+tm?= =?utf-8?q?ZxRVwaVherBaOc7S9bqxnL7YmjGYwnAAMmIdS+hWzSjKbJC2hZyp/564Oczvug2QS?= =?utf-8?q?+n0VXwisIPHsVtdYqFvo9coNH5ptjQ3wTBvfPt614DEk/8OX4cg9QHC4rEUaTABEw?= =?utf-8?q?BnHE+GFrKOhjb4chemyskvJUVL8YqsV7FWZTjhTdQwg7KqZ/zLPmZzrWITK7+eZEn?= =?utf-8?q?d5+Q+XnbT/0SbnEtIQSgs/vf36VP1LuEg40//IKN3Px9PjLCTRpWzZCr2ECYfggpU?= =?utf-8?q?F7TlWIVu2QxMatu5C6iKBynaZi2smiGkuqqCRNC6eSeoIt1jwP2ZySVx/LONF11Z3?= =?utf-8?q?wH9FBKELYxoFqfHmtSDTQ3zB8Bo65XApHeIjcil9xHnIhfQoXxUYX3os=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb5457b6-c835-45be-3058-08dc7f4e0125 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:40:18.4119 (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: Nl3j9YI2d3JMiSMGcctTRcpAvHfJKMx7lPQS74zq3+4dba+5baTuVGPSc6ooGgAXw7yCtMZW29pOqcxcBmv6Uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 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 } Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 8ecc00049e20b..c8d58481f80dc 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1028,9 +1028,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 May 28 19:39:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677233 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2040.outbound.protection.outlook.com [40.107.21.40]) (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 AB11617F38E; Tue, 28 May 2024 19:40:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925228; cv=fail; b=qdamRBYRLe0zYKF6lxrdPH01AC1Ujr2q+nGygMXD/B/+4bULBG9VEwXqMS4AeHvGnZdk3rjL8GE/fSCmR+LB8kcgCZPEIfAzIhVB4V0mPwQsxciJ4JZS4/5bZWrBJ9/9T1lLADl4Bz0KJCEu3JNBHec4qaQnZFK81fTzFCUR+8s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925228; c=relaxed/simple; bh=rdBX9SAsLGGVokztvn5vz/ebdrIJ20HWryji5UtWJnk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=qTHhn5TZs8lcvBdIpSk8bUOuNXVSvhjc/NGg+sSzIciLujDelV/Ex8vO6sLqFYX1bj32+zu9nZivn0IhYI0xBThYH5L7e0y46zSY2YS2ekBdLl1zupwH1PXiuVcgM3cMt308yp9LlO3x2+Gtogyn/WhjxmibX3+MQefc2wgJ7Ok= 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=M5Eg3D5e; arc=fail smtp.client-ip=40.107.21.40 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="M5Eg3D5e" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ljZ6c0NqyRbcG+PVpzMDWIYlKZRPFlAee8c0u916uUI41qFEyZpBf5qSn3vUHxDvS64v+XyB//bePVtAucLnPeysx3JnyBzFVuGLEuGn4L+P5dXTQN2uBc4XweOjBhxk0BVGxz6/lifPjgjT7aWOCu9dTPZCu5KBUvzZ7FRllU6Q5ZnnZ9bhxjW9kPHc8SH/UNB4u861lRCmC8SvG8mWo1fp0IRKLYkH96VB4HEnolKwsx+P5fxXKpWmZoQt16YJq0HY5QQm7BZQWAo+2qqQuTaf4yhZTNnkuedJTltNZ2w8YLviNY63xUixLUmQQip1wqkmOY4Clz2/hWyiWcl+Aw== 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=9MbpA0y8LU8HRpju2DUmQSRJX8UDOWjSKuL8l04o6lQ=; b=P54knbKrJLT2e0rI9n4yTrrKPpS974E1DyvFfvDT1wZGMJy7hdFNdM3FDhr5SdFFTvODuBzz7c5OZeaL7JJLBHrrTxHex0PhgEfX1cYVQc0wUVZgVWpFcaupjN6xZ0hoI7LyzYly5nCEUhWgaxmJiHNhi68inogQtt4eRD0qjl3mTd5mVB6AdKVot9Y2Zd2VtVedMbVgqDb986YaPG37y2yoJdkOpO/InOBsB3Cqz5I1j31a81H8G6Nlxec+4y21d8fbSH33ErApTiW9vBpC+2FM6H/pdn19Bx/xnbsthK5sgWSPUle3Uawqudkl0X+GKcDas84txwG7PYJ0UbjhCw== 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=9MbpA0y8LU8HRpju2DUmQSRJX8UDOWjSKuL8l04o6lQ=; b=M5Eg3D5e3imO+nqkAeeRqEV50UvAqHIfjqlk+ObKAKNGc9P8XzWrIpUPdDo2sQOx7r8Eu9/HOMUJ6mJR8NScvlSU1yhfg+/crGXd5VxMdH8BMZRdTkAiMHS1vk07sqRrN0/sI9+WwPU/beAMh1xCMVcps3Pj4BRKDpCeVoXvVuI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:40:24 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:40:24 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:23 -0400 Subject: [PATCH v5 10/12] dt-bindings: imx6q-pcie: Add i.MX8Q pcie compatible string Message-Id: <20240528-pci2_upstream-v5-10-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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 , Conor Dooley X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1716925161; l=1356; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=9ZkdHDkA+jFfsgNpx5r6KX8wuw07nzBbE/IHsRQRYtw=; b=ATTTasnX2YyZwjZgfC2m0blhrkHyfy34FsjGOngfdH1Oh4V8ofrVqFw8UoHrF3hBiRLbyn0Fw cw7mFkCyUCfDrB8SqG0pFso4IRnQOhKBzFYqDPg7Zhe5p87OgWHAzMw X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: 1294184a-b1a3-4b51-3a27-08dc7f4e0499 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?PIU+ILxBklHsDm8cdqVkjZMafX9Ggxt?= =?utf-8?q?v1ACFU4+KbGQV7Xd7rAElxr41WJB/gNPr7vTOZT+q4iRHX/YGYBDV7NSqIMOwVW8k?= =?utf-8?q?knSb68C+mhw7qi3A8gtrdBsFhPzM78L+PS1WpMvzkAhsBQrv20v9pRo2MYt7b8A5L?= =?utf-8?q?5KOrh61MXAMhg8pwduqMCaoUnrlKkXw8xJGMeCvEZrBx+2OJ620GcRTaCxiGhvvpe?= =?utf-8?q?Q3JAAZWhD1BTxvsSiULNV9xOM7suioT4b60c8HFx5/aUDZj44JPV2Bb126AFKwju+?= =?utf-8?q?mtFI8dJI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sBiDT/N1zfMhsAoMkDYg5jA7cA0hi3s67wWPhOrYZH+25Gyxmuhf2XsT3H?= =?utf-8?q?kOhty1lqemMDJ3ZUA/6tdojyeek+X3t9etBi0oeGfylb6QuaePRxhbYNzhlAMrURJ?= =?utf-8?q?/9md0xuPBUt3wtH9cU+VjrmQsxeSggCNj26RBqBo5i+CfBVzPf97jn8g=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?hHiDmiBxcoshNPzIOICfb7rMsbCa?= =?utf-8?q?l111IxLMrU+Ia9mKGjUS0L8MKJdm8VRGvPhbI6gWVAf+B+1xu7g+2ERa4D+AOaf5p?= =?utf-8?q?q8WIZVod+iEjq5b28vNrv7bdNfTrzl6dHpQssnvhVhYjfeGZIRxbrunDCmYJjcs2w?= =?utf-8?q?hgH07cBigi9VtJbufo/3Tv/+rSQKGFag0PMRZFv5ZkHCc9RwKYCjH0WX+uvqDZ/xu?= =?utf-8?q?pomIZJmJ6OOtyYHrKeFzJnztnhYQGHcXnMDZ4+qY+iMxXsR1pKKwgPWAYko5Fu3qW?= =?utf-8?q?8Ax3RjVRzlxLWXwlyDCWC+TIkGOnz8yAp3RMTFiqWlFHkpGRoRKlJ7MXgqrGTvOQw?= =?utf-8?q?nqwKxbfqbsZzmYOBu8mwCugw0TniW1aOH5nPN1LWDxkdMdF39phlLGmTpxogXcwO7?= =?utf-8?q?UX8y4asYFwCvHk7Y6w7zo4dIPCterzWhrMnjQrk5XOBzPb8brzQ+CivfFPJCSnbMz?= =?utf-8?q?kLPVaT50Brdia1w5M1CwFzFILSdI0c81cM+aDqDA+nRJ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hAt05sNAhRfv0a+80lthR4KCIWWMS2N6tmF?= =?utf-8?q?9X/KUxf9w9lnignkWFdRoQHi58CIq3EKQ65sUsGTuVSvnwOjyDdTw/gkefCXT9Ilu?= =?utf-8?q?MmNBIDY+I+sfIzP2oiLbK7hqY48NbTQQdMsbiBzR/esGKZmhOk/2Jg5M=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1294184a-b1a3-4b51-3a27-08dc7f4e0499 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:40:24.2066 (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: mFmwn/pZL7y4L9EqXofeIMIXX4HWxGjtVqVXttFotUiTPQT/4UC/3mIdW87bUqb6HY3Rgtg+Y2b2p1mGWCBKgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 From: Richard Zhu Add i.MX8Q PCIe "fsl,imx8q-pcie" compatible strings. clock-names align dwc common naming convension. Signed-off-by: Richard Zhu Acked-by: Conor Dooley Reviewed-by: Rob Herring (Arm) Signed-off-by: Frank Li --- .../devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml index 8b8d77b1154b5..1e05c560d7975 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,21 @@ 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 + unevaluatedProperties: false examples: From patchwork Tue May 28 19:39:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677234 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2066.outbound.protection.outlook.com [40.107.21.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7C4A1802AF; Tue, 28 May 2024 19:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925234; cv=fail; b=f2umooPj86q8p5tbd4yn36SFH1UpVEYILs7ZbCbBZ5rYSjRBHBV78aU1cFHBmKYGBpxFiJIAfAl5tK6Hqvmp/v6TWhdEHdhllQWlHAiQBnQUtskad0YMcQCUhRe7kioTg+4zSQhY62BJR/maAGpXApP2mDmip5HSbRzeCsBqceE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925234; c=relaxed/simple; bh=yaBb5frcbXHTqJflSEnujAuuV0Cuk9LQ2ZU996mjQOw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=OIwk7cbWaxO89xrHPVrichq7qgC8rhldM/ofzuXlo5D1Ra0uBVQcnrnfZEt2J1c0wUaaZpyowBJt0Np/Mw0pY+9gN3LoVibS/RScyT1MD89faQWqnO/M3mf3qSIxwUOoNbIgcsn8/VvKiKu2DYkhc6zu+ywMkACv8BUqlAC8tyk= 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=bKliTQbM; arc=fail smtp.client-ip=40.107.21.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="bKliTQbM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dQLIDBdpoAia3qUGiDigeW7fO+Ayas2wXzCq/m9z7kN7gfDfy6rlYxZyImY6v1JTzGLbfbnsna0mG/3w5NMTpEVreB57aWj/mu3jiyxksEkzaHoTM4IuQSGO+Ncf9UGdbGxjfsvuMWSiGAlK1FxoqJDo3Po0PoVORVBYlyBrIBYMydl6Nx27qrHAYGBiaJkBLkkeYcObzudJkkbJp1v9dr6CqtSecMOsaog7CIbzpQvIlCrBy7CxX05Y7mYboglV5qDc3O0XdA3ud3FiXa+k8Amnv1yGAGNBJ4UiyiZU7+bCivibXS7h8zA9iSVVvZA2HZAb9SITRbu0BXPgE+6Ysg== 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=cr8a2OtZJWrim4Vtd8B6aDZmDsKq+lJ4vIK5XEvazZc=; b=L0kiOB1BjAFFGWXBZ+o95NSQntxJg2gsLI3KLkO9JSM8XVqsYExxve7YeIFiaReQRvpa57v/oNCtSP4Q6bsHw35U0Sf0+cmEKi5zCv5UaJMUmWup5Il/KTj3zMNygT+TZASnYgYdzhY97sTliqLcn5OSTNC45Z3ATojHjfoora1l5Ck9OMjkS8fgNBPHJCg1pleHHfJ2VUlibyGsSbKtQYY8BQMjqVeCDtlPlRfj6Gv9P1IbQSTKkVzHsyAQOeh94tb2DVPGtQ8sjExYTJDo2nsM5XJ5K+yf4NhH7DCiNTcua4BtS1sLBikxkeNKs73wHuvtmzukvMKLyaPANIPS2Q== 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=cr8a2OtZJWrim4Vtd8B6aDZmDsKq+lJ4vIK5XEvazZc=; b=bKliTQbMrikkrjbRNsm4p5jjeSpttim1LdCdJGqiKzQT2l1S9wsy/th33vh1aIT5BdFUWm/5tL1bWoIGMBnIx13Nx2DJCe9qLRonng6PZ1Oh9iS6wn8VmRo/xq5PZGm6fMTwvf6KuvpDv9dWCf51ufMGqEVVUuk4hEGT/KOANWY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:40:29 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:40:29 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:24 -0400 Subject: [PATCH v5 11/12] PCI: imx6: Call: Common PHY API to set mode, speed, and submode Message-Id: <20240528-pci2_upstream-v5-11-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=2344; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=yaBb5frcbXHTqJflSEnujAuuV0Cuk9LQ2ZU996mjQOw=; b=KPjigMZM/5Tck8+akEzRLrnGJhJjNlccMhb3gLqFSW8FURwFBzwVk7GH3yEkPCsvjMdX8eeJv gLunL1L8gxRA6LQECfgvgYoAT06G3txiz3oSuAIZ9+xbhHxzz9gJN1T X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: 79fd5fe2-77b0-4cb4-8cb7-08dc7f4e07f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?240oed+vLWBO4zu2oMIPQh2Z54dcrrC?= =?utf-8?q?ksPtMYvN25tTN7xFZ1i6UftErVqtGlTpvxbeF8H0bSdseCcoScs4Oka77DvDxIPEp?= =?utf-8?q?UyeAC7X+Rv5kT75YpGnBJY0Lhj9bih9+Kw1axm01+bmOKwNr1XCAWoX1WrEq0Ec9G?= =?utf-8?q?wDgEDsoJ5nQ2DPoIwJOJoipzf/zfb5HY0Tjog/iWZDP4eqg1jtwpFHFJX4S9Zjdro?= =?utf-8?q?L0RfTU1lztBU+Wb0KnUzoH9nknIvhVjyyTH+DSHTMCqC9jPV7wDStw3rd/nbWUcTL?= =?utf-8?q?DgJz5h7mdHpf4MTm2E1uAS9HJS9ZsvlDT17BOlgX273Cv0PahhMJL1JCvy0+PNxWL?= =?utf-8?q?HRXeFH5n9IvAlNRkjrb8ggZkmht4kMuy9n0Bk2mZfxslLvlawhscmvlSjFME5Hgwz?= =?utf-8?q?lr1uNLDyq3nyFukezZJia4CuzOlEVvXK9hrD0Jlth8x8Qypsacn45qlZvaYdMnIzu?= =?utf-8?q?I5XeU0wcYh/xgdP6TYQ2hWgRSwL21DHEnen6FvzeVlc/2W4PP2nQCatwKFDA/fqkH?= =?utf-8?q?xMhMNrsnxL8r0hQQCBATAah7HWh1GaUNkDvZw3o4x3PUv9U204yndviOi2oKiq1vf?= =?utf-8?q?98cIn1WgSwwf5ut3zfpw1xWDrwv/Bdk1SJScN2nR0WRrr+0CGDJPzV+HTA6SCXND8?= =?utf-8?q?hPge1YF2q6clKXhzQgXSSU3+lVKc056peQ0WoAAbty2CgYar2Q0Jfg7IkDO0wrJfe?= =?utf-8?q?+RTcZCKlyD3wyjIMYTjmnOQsdRhSCqeEl9JtNhZod8CjfEhfq+LiPTIbOCuBqRfi/?= =?utf-8?q?lwYPGaiBA0Q406ylzAce08XJGWeO20hUIWq1iePH8HFCVy0I40MNRqtDUI2wvN0e7?= =?utf-8?q?GveC6dN5TEnf99DnNnZg3arPQLEO8BobSrVXjuJM4Uwv0I9jG7bru51WU/Vkfp8aq?= =?utf-8?q?1oOUzHYi84u03jFpJgdD2VdeNLzfdP/ZlWxdX+JjP3AmIKzS9m/L1R/1MZry1rfoi?= =?utf-8?q?N0wNy/dzN8XjcCdrPCaI+Dh0zhHG/mm2WSpX69D58xm8S+nPWjlqf5OTPi1fl3M8k?= =?utf-8?q?0sCaceWPhlRevoixDPPBvTy0ReRxvKSFUJA3p8PEi2nuw80J4Qf3dxy7e588vCgCF?= =?utf-8?q?f4if0Z74f9X+2uJcYp8SQVSnFTtGzFwCJZK7245QwuWcMnsLkkqTkcPi3NA67zEUw?= =?utf-8?q?nP26camw4pTD4WNLuz+a7mIEBRtz+adqrtKj1Q7okpdjOb65rTFtixd5fTCxIsjNm?= =?utf-8?q?JN1sxrDe1y4hGNaAPgyyCPbh1VGbOn25B/0uXS/NnhJW3InPTIURde0JcLHY0/T5q?= =?utf-8?q?03YMuZFhYRvfmAqIokY/P4zLQf84/ZE2SMVjkAfkCv4tg6SWElV/k11w=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gMHtOzXaU7SQ09xWg0wDb58si9xO?= =?utf-8?q?N7ykbYFZCIS7SpRs8IAXb2LvZwdp6TBXkOX+3WIm+x31LW1aLiV74hjjKvbhr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+y?= =?utf-8?q?YCeZ1P7MEHPIK0RPNTjGzhaqaYvDPvcjkn9LzOXVBCGPICR7UsP9ei/p8wRf2QF8N?= =?utf-8?q?WnVbDM5N6YzMBCjkKN1SfxXRFyhlwAzNGYiRoW0Df7uwzsBPSUouNRjZ5Ppf1C3X8?= =?utf-8?q?fG6dJ3AX0LehIZixA8f2LONDT0BCqXOjJddgfqc2ze7IrYhSPzuDyyX9XfQ6OE/5o?= =?utf-8?q?f8nugUrNniFposSzqU8TBdmh+3qXU1XcaWJ8/IGRVGA7wgjdYNzcwcuOzAjDjuJEC?= =?utf-8?q?/PM7mmMBQrKRD6BNr9qG81Ax2DEtjVApSPmQSzYyHXZAMHJx8yBy8Md6n+BQhu1rY?= =?utf-8?q?Gyv63vxKXK4F5EWMShY4PQoeB6YOJUPgNEkn48ZX3wYXwNlWwRMtMXQ8FA8O0LdNJ?= =?utf-8?q?q5osCy9FvGD8Fb/rofWXRtef7OB1h4CWMe8HnQtVqCX6AiDEP1U0hPUdyGXWGGmKX?= =?utf-8?q?cqFNjGF+QjUCiezcI6AYHoJzmIkfJ0yyHdSEG0//HY09LarQwvPS1yjlFqCXus6Ct?= =?utf-8?q?np0vFNJjvldtgrg0B1rqKQ+aReXqUIUCYcPBvG8Fv1ayqv70tzgXrNV8=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79fd5fe2-77b0-4cb4-8cb7-08dc7f4e07f6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:40:29.8185 (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: h1VQtrhDKX2cmpwiC2F3hAPmxFkyoyZNh71uU7qhoSny+UEVCah9BVIWqLzqIyPvYTF25eif5TC+J7r/GkkiJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 Invoke the common PHY API to configure mode, speed, and submode. While these functions are optional in the PHY interface, they are necessary for certain PHY drivers. Lack of support for these functions in a PHY driver does not cause harm. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index c8d58481f80dc..5a725ef6ed0cb 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -306,6 +307,10 @@ static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) id = imx_pcie->controller_id; + /* If mode_mask[0] is 0, means use phy driver to set mode */ + if (!drvdata->mode_mask[0]) + return; + /* If mode_mask[id] is zero, means each controller have its individual gpr */ if (!drvdata->mode_mask[id]) id = 0; @@ -882,6 +887,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); @@ -894,6 +900,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); @@ -1029,6 +1036,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"); From patchwork Tue May 28 19:39:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677235 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2045.outbound.protection.outlook.com [40.107.21.45]) (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 5CBC41802C9; Tue, 28 May 2024 19:40:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925240; cv=fail; b=oE1fGXyDqvmXPmQCIRs/H3wZ0+hSVHnwWWew7sb6nEAz/8WRVSCZWZcKHTBqyIggvD1jRqQo6v4C3wBYKijMnnaLMRpFVQt3vQoLIGvXrJFYa7y1zcRXkO1PtUdzptq7RhAQHBpvNtjoLvdFA8F6nxYmQ3osE9vxdD9c5YwEccw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925240; c=relaxed/simple; bh=9Km3u9aBE/ZVY+SXd6a188LIRuhze//qBUh8r3MmfkM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ihTQLKAeRbrVF0MKwOxdbMnHTXyujgW40iZ5OWyMhgyG2qo9NX9EHuL3XPQMdnf7PCLxgC71Yu4X0ducHL9lBAujqa0yvhHI3RiFjxGxZi/kTRonQwwu1VkLJc1K+pdzNhKDwOO0/R7yKmphNErS74sj9VBMfG84ew942Xol/wk= 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=lLpdlxGQ; arc=fail smtp.client-ip=40.107.21.45 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="lLpdlxGQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DzN6BUiqBXaKGAE3JUap2LmC6R3stJvbhsJLr4Pg/7d3kaBPzXcpTFQjT4dqk3EHRxXCukBuqiJ4Rz2T2oPs1y8xY4n3jGfSKMzTVnu28upoLIDZCHFY1jE+ffLQXhdV5qQW6r/Lr4/IohKi7y+EApo8xYEGh89Hoa69E9xvFmfe4MYy1IV7ZiVqTz/Eu/jDQfvzCOSwkzZi1ECZsPTUAeoU90H93t++gji51WYOg7eiPKaE8RkqgxHrSwdPmxA7a6QcKpQc6B1PY7ZgLMOf/A7BNDKSLTQJ7AvLmXoPDYCtwviSVpQmVaXilqLUbWU2IK++e5zUQFqrbEiRn/4QAg== 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=sC3OeN8RuPZv2SL4sTYPyf2DdoTtNb7wVHnPKUFLeOU=; b=cwh0c3Pq/CHDuOhft1DsKJ5KwA55Q+mIYJS93mbYIB6WWQ0dayyyGbnc8/V7DR/Jn+JUesF37dxRhtho9vKLXXj+U2boyVAjs2+XcIDJYXNl1d+fADfaS7PWgQEDMxxtLoaqOeqxPPKcpBBSpqeDhcIRuxgAff43Fjd76LTJ1o8yJfOZrxt8piaFrGbeYKXFRm+XOWQE1J25ZIRaUJBb7i3KMrXEySMXJzr9/rhPeyOT6QJ19KsA+v5LvVaPBm2A3aDiHORsEQykEDeg5xOonjdbkk5mxwpIGhMoZbWmPmL5OlmwWGJwXbk1CZJQam3olkL7ljCCxa0rmZ4oT0Rdnw== 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=sC3OeN8RuPZv2SL4sTYPyf2DdoTtNb7wVHnPKUFLeOU=; b=lLpdlxGQQWxWIYykn2Qa9QkudyjbFKIG0O7ZF1ZIhM7sFWZYZu8pFCUM3q+MDyxJMBSKMUm9l8ovSHChbcA7TdssajTafYtBuuFmLsUoZDBbesWfHuGU4VO+DH67ubdQoLx6nfithOPpB4efbhvOEAn9ouJgr7Vss/UTo5zsJP0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:40:35 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7611.016; Tue, 28 May 2024 19:40:35 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:25 -0400 Subject: [PATCH v5 12/12] PCI: imx6: Add i.MX8Q PCIe root complex (RC) support Message-Id: <20240528-pci2_upstream-v5-12-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=4309; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=DnYV5g+L/9C8UBBjY2j1EWTxEjBk72r1qGX5/5qY8s8=; b=nafkjeouL4yNTUHEZE68/rAO6X+XSX9GRj4hQIvrgpB+XcYpfm3f3weOO1EWfi+kdiYwOoi5g bVxawtsrgOzCTIKcEcUUWJGlg6m5sP5WRw2Ebhu0tkA8E8uKRVKgIgR X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: 2de7c32c-c21a-4396-1c74-08dc7f4e0b46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?fju5WsT5QUKrhhMIVeWPMtH2gQXqtSw?= =?utf-8?q?TkBDNnq57Ihieydqpr9yM1pwYsGRZ3u4TFec8DqGGbdEpfC6KVI8ziAaErsK4L9MO?= =?utf-8?q?dr2y6kU8w2oAnCblqk6/W3Bqq9eNSnoPaENA/7y+VdRprrVd5sHtQT+prHaqLxTh9?= =?utf-8?q?bGga53waZHOSwX5AVESNxNW2Jw+hDJbNnBWZL11706QW7heOCZGzYxa87LBubfqRB?= =?utf-8?q?j3SIRb5QAk54kSKX/hp+DXkYJEQ7J3sa2+RLwprXF2NsXcYlnZ3kr5X559ykpnNaI?= =?utf-8?q?fxaUPea/DCvOY/jANloy+AA4/J+/480eVRJyPDOxQaN2MznrlHx3yATMj/hHJOUGm?= =?utf-8?q?fmlb5HGdjD2Zbso1KiMGz/DGfT9NEM1qP5xFFjNb6ESeCLsd+Ie/zgb+iQJDnoeIe?= =?utf-8?q?O7mGI29qYv8s7LP8t7rLYVXPVZkt3EkSHbm7ArM7tlvXjkKCavOkxsSFBfGis+vFK?= =?utf-8?q?xeOKg814bOdDe9IumhP/KfBOqSl6IDYbiz8NgvQyZf7KlnY060g+0L73BuuV/X2Xw?= =?utf-8?q?whUJpUNAt7ijuxJN6XuR9XETYG/arZ+2LO0/nyWAjruAsLDhFwHCBaccolmlANI4w?= =?utf-8?q?MTNek1sdoYlDpEQJ+JRWUc2hlHx/KMndF4BGp0wrapYBR5h8EnqFURi2FWHADr5g2?= =?utf-8?q?YPcR1hDniRb6xG+8xVDqqrxQfgjSAVHrIFfwkK1o9UZIR63tZ9IopKbcIaIiE/5b1?= =?utf-8?q?xMjjIZAgKA7pxlVjhCM2rZW2kRE2QDsZzenBigrHHkQG0OME92ZtLERclLw/OMvVN?= =?utf-8?q?VE2OLYcuidhuPsCXTwSk6MjyOPU/OreIr49sJtOpervPSb+teUTtSPcdUSOSQkjgI?= =?utf-8?q?POq6GCtZu3mC4nw6Ku/ibOT4MdqwQQpho/6Cyh3AbPuTTlWYVQP+ktVw9fkXPWaa3?= =?utf-8?q?GwcoMm8xtVoKG93jrtEvZviwPWi+5wtgzGJuhkFD46uUbP5a7oiHQ/ODD81mWYKIJ?= =?utf-8?q?bK5l2DUZN52AUaApqjWwubwO4PJU+NfOQJhP8lo8a60EB/jwNM5Czh94PLLbf2QYu?= =?utf-8?q?Q/C5KMOKb27Xh/gY3q44zQFE3kqYXWCmKYhotOFV1fDM09jINQODh7T2fZKxmK89o?= =?utf-8?q?MyAVExx2i5sco9C43TCVVLk/bJI7mMSTmoGyvAbQWPnzEvcvwlcoknlmqJz2wDcvZ?= =?utf-8?q?A6dyQkhft1kmue1GDJHmTTxOROmD+7O1wxHCMDVQ1atcB6baTH/od94swM7VJ/xQM?= =?utf-8?q?8A3wvXRKYSZBgpLhV9TPNrriIstAikvm4uv14px6iuqUG92RolV5xQXFFiTP2nqUg?= =?utf-8?q?8Q2jDtHY7P1FiQjem7abu6+7XqYTDCZ/6cw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?vixc5RDOqg+ZgB+uUttj/xBYuWpj?= =?utf-8?q?y+N9nOaFMyKkAL2GL7LwHHKLUb+25YCNVeByFjp5qbxYqrlTm4G7zbvcYufa5uAxn?= =?utf-8?q?T7Zh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?utf-8?q?BZAUUfT99ZEblMANU5QvQbylLMSMBuBheAG6mT+NRaaSU1i8IYqY8rT5qitgWl9om?= =?utf-8?q?fJ1UZ7rUk16DwwBDxTxEWryZzKSNwOZq/l7TbGJN9KFzldLLWF59dLRBkfLBmcoj0?= =?utf-8?q?GriTScJ4ZhBAycigyK/tuGadBNqSLlSoszirzt7RVJEOtvF85QYPz7lTshO4FtFyY?= =?utf-8?q?b97+/KSm5srbQUhwXGvFF7P/EKGrO9zEKo0jooKFtcBfh7LvyXkfasQQJtMzJWIwK?= =?utf-8?q?aoKRznrZ3diAyupjiMaF6Kdr6l+L/1pifdKgBFUAqbzMMFZ1xtPA2tAZODHlqstxZ?= =?utf-8?q?WSjlO42UWt3wMMhkUG2MEH1oPwi54kKHQICgC8I86ZHznSz+JuzthcheJTN1uK62D?= =?utf-8?q?6Z2Hl+Y8Lcydu7aqhQk61JcM5f/NT63Wh6wMNmHfjRCklTWmZ56fjpUsDQDHCeP4w?= =?utf-8?q?5PStE1pKJSEKUZ00LdCYdNimrNZZztkj1rFyqdtJLa2Fd4VHMIQg1VPb2/+mT5pSX?= =?utf-8?q?20JHatsQIKLb1LsymPVyW3aRjC9fYBdxbL1th5cn4eTMJBxkfaU2QDJU=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2de7c32c-c21a-4396-1c74-08dc7f4e0b46 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:40:35.3963 (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: eeZ7FL5p46O0AlHYHM5QxEf0dM3OpQbI/0cE8o3pMJQSdqTlybTqJkgYtsOidld5xxkDnmfV0tO3uHUzujFOUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 From: Richard Zhu Implement i.MX8Q (i.MX8QM, i.MX8QXP, and i.MX8DXL) PCIe RC support. While the controller resembles that of iMX8MP, the PHY differs significantly. Notably, there's a distinction between PCI bus addresses and CPU addresses. Introduce IMX_PCIE_FLAG_CPU_ADDR_FIXUP in drvdata::flags to indicate driver need the cpu_addr_fixup() callback to facilitate CPU address to PCI bus address conversion according to "range" property. Signed-off-by: Richard Zhu Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 5a725ef6ed0cb..62713a0e381fc 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -81,6 +81,7 @@ enum imx_pcie_variants { IMX8MQ, IMX8MM, IMX8MP, + IMX8Q, IMX95, IMX8MQ_EP, IMX8MM_EP, @@ -97,6 +98,7 @@ enum imx_pcie_variants { #define IMX_PCIE_FLAG_HAS_SERDES BIT(6) #define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7) #define IMX_PCIE_FLAG_MONITOR_DEV BIT(8) +#define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(9) #define imx_check_flag(pci, val) (pci->drvdata->flags & val) @@ -1086,6 +1088,22 @@ static void imx_pcie_host_exit(struct dw_pcie_rp *pp) regulator_disable(imx_pcie->vpcie); } +static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr) +{ + struct imx_pcie *imx_pcie = to_imx_pcie(pcie); + struct dw_pcie_rp *pp = &pcie->pp; + struct resource_entry *entry; + unsigned int offset; + + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_CPU_ADDR_FIXUP)) + return cpu_addr; + + entry = resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM); + offset = entry->offset; + + return (cpu_addr - offset); +} + static const struct dw_pcie_host_ops imx_pcie_host_ops = { .init = imx_pcie_host_init, .deinit = imx_pcie_host_exit, @@ -1094,6 +1112,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) @@ -1593,6 +1612,13 @@ static int imx_pcie_probe(struct platform_device *pdev) if (ret < 0) return ret; + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_CPU_ADDR_FIXUP)) { + if (!resource_list_first_type(&pci->pp.bridge->windows, IORESOURCE_MEM)) { + dw_pcie_host_deinit(&pci->pp); + return dev_err_probe(dev, -EINVAL, "DTS Miss PCI memory range"); + } + } + if (pci_msi_enabled()) { u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); @@ -1617,6 +1643,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] = { @@ -1720,6 +1747,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 | @@ -1798,6 +1832,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], },