From patchwork Tue Jan 21 15:08:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13946408 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2056.outbound.protection.outlook.com [40.107.247.56]) (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 353A71F4E3C for ; Tue, 21 Jan 2025 15:09:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737472156; cv=fail; b=ucrSAjGTQR/N6gCnxPCuBy/uKDazGvTRVcZL1SnCgzeEtT1gW59KZO15YmuXvpWsDt9D1QbFTrOkik0guEXxOa3HkYcd3dj6y1n+9P+12xUQIIOwgWZPuhLN6F4CIX72EmmZ62O08FpelczXxmEitgWi0ScLsoBQj/bbAIiF8NQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737472156; c=relaxed/simple; bh=zFM5EZlhecv3PEUXzYkgnc2uhCHaDA+0hhH4EngkZCE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=q2feywdhcqa+ysIXxgxkH497Memvl50ckGl1H7hq8ES+F9b40jH4qKas7kzZxsWmblO24ZLiois7RdVRTbrQcHX27L36hEMExZny8UIXlCalJLd+IbPPpUzVlUcnz1R5CTlVgaiy/+vrtc/Qj+EEGGLFrFEON9kE4RbC019Ta80= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=nqrFbHHV; arc=fail smtp.client-ip=40.107.247.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="nqrFbHHV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v3SdggGsVrDOonn8opsUfI1wFoubg2qDdbqXsX27hDzSeRzGfPesrIv5KC2hqT4fiZ3trpw5/qDskND4NaZpkcuGJX/o1dkXgvGMCqGX4uSOYNHV1Zv5GvgJuARDqFZbEk9o4i5OPFYp/hHQLbtKYoDxUhMxtwWM676w6Gn1H4/Z/Wj5zVCPszb0kY7NSqY+ZAqUB7psQsEye13IZbTbahmc9p1rCfnPCd1sDUVflG67q7XcWQH3L0zKht5hDHar5k1DdifBWOkA6wjz3pZrjcuPaqZLWQnxv6CCmjzDjJRZ/vKMpAOfsM2dEarq008EZodA1tcG6AxToGtwM47kdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Wjc0oQ/xhCGWnB7fIEBzQc2hN9xjk1NDtcDqPN1XjRM=; b=KY7OIfymePJEVt+niu6sJ8SoUuji4qR2u3I0pNgzO2kxcDJrbCTWltZeT3IX6T67qPm0boQ5zoPOeiqrL1GdvvvMyExQrwmcmt1DXCe6A2wFkweXfabXUojpVa5hK9nClWTEwJ46/q8e8se2ZxyLX5NfZ9FaiL+cNf6Db8CqopxAvKDpoUex8R1JfCX5D63C3vrNIwtzRgKeEz4bXAOJLlq+eS+n9APk8+HadTyiBWqvs8K8MSuo1vDJOjYxWDz+/htWRGdvHuYAaq/TEw7/2F1RA6Og37x6C/3R3tZRFv+BW3t4hyGvxgpDdb+r3y3PA2+6cjIzDQ1brlrzs2/4/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wjc0oQ/xhCGWnB7fIEBzQc2hN9xjk1NDtcDqPN1XjRM=; b=nqrFbHHVHYiJkYrCHZLys2bHbCAjIE9/YeZlqLmCjze61Wi7jTDKvDz/E3BSquyvW0oIrxepUdPhRN6fn3YZb+Fp3gDpiTphUMMbk2q/9G/bmf7Vy05/vPXtlNdsQzqkUDcEznqYsuWnvK9nCxjegrpau+eYsttIFLX3LpCkQAyrRLtntKXCNch8WyMmrw2HDhKExt6UkjJjdqn7keET1g7DBJzAkjkfSuTMfs5m/sovGTYgC+ezMnRg8/stH4akeDkK+tOYbjZi9oTEwYj+FKinoVjYn17HkkvQVP7eblUrqVAbxgdb8K9br7JbB898BX8GJNBN3T42cX09li6VDw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by AM8PR04MB7891.eurprd04.prod.outlook.com (2603:10a6:20b:237::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Tue, 21 Jan 2025 15:09:12 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%5]) with mapi id 15.20.8356.020; Tue, 21 Jan 2025 15:09:12 +0000 From: "Peng Fan (OSS)" Date: Tue, 21 Jan 2025 23:08:15 +0800 Subject: [PATCH 5/5] firmware: imx: Add i.MX95 SCMI CPU driver Message-Id: <20250121-imx-lmm-cpu-v1-5-0eab7e073e4e@nxp.com> References: <20250121-imx-lmm-cpu-v1-0-0eab7e073e4e@nxp.com> In-Reply-To: <20250121-imx-lmm-cpu-v1-0-0eab7e073e4e@nxp.com> To: Sudeep Holla , Cristian Marussi , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Peng Fan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737472103; l=5658; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=LE4iOrB9OtD+h22ygNfRqzjPFijIpsANyO5ImCS2MNw=; b=Ril7/DStIucNVCnAZszERCRMF/7uSJdcvF/ThHhms1ALU0ZvDiSwnI2fy+SgQmAysQYBdlPMw UE1j0WPGyKNCiKd9gan2MhsfPNfpf5rdUYOGbkhj9YnGJ/P624cR1zZ X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR01CA0045.apcprd01.prod.exchangelabs.com (2603:1096:4:193::19) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AM8PR04MB7891:EE_ X-MS-Office365-Filtering-Correlation-Id: fe12ba85-3a79-4476-7f45-08dd3a2d9008 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?a6i4lqupaT9tzy7tztcrThEaa6fsJEZ?= =?utf-8?q?LBFfw1YbgjGM0I8Lk04jj1Ivi0xn+LORHdRFBZbKuzuj8O7ernuXcknWK/bXTtHMc?= =?utf-8?q?ALx3EIrX+XFHxIdTMv67giRRwPYaFNR7dBSCoY2+TLsFhIH6KjD1vbu19kD4PXOgy?= =?utf-8?q?04m38x6Mgivx+gDTINuu+4OGZHYMJUibq01Mq+2kUxend+6E+b0i4Q2iDZ0X240sO?= =?utf-8?q?uax7CiNOkxroxwOrSG4zMVVE5kEuB7SIF8Hk7Sc2qAMtSn5Y/u3ZYTS7Wj4TeDTSs?= =?utf-8?q?FG3cvVotpP8KUmi70Lbu73mZzWji6IvqrW1t77urtfXnzeM+EJbXyvzc1xSGHJgpq?= =?utf-8?q?ah61OrYK4ynDrYPmIweuMfo3xiGsIXFPKCLfKKOfsmFYBNk4+yiPPM7zF44qgf6RW?= =?utf-8?q?Gd0F8m/SjOLhmECiPGaQKeToifcNZtSR4dKpCv3PVIZD56h+GduwNyAeXgU+KDujk?= =?utf-8?q?MO0WkJIECJSeQHVtgxThwSY3r+Xo0RCnf1XSKjZ7P243ZUJPGnNJNoms7rIFIldob?= =?utf-8?q?HRcZabKOLdTImN7RZKEQvstkKh/ztIVsM+tt14Rckjf9TFj3Uz0paRzpXzJZyiyky?= =?utf-8?q?CjgWxpRuTOoujqHSzYE1S4RwPywJGzZH43rR1B0Ba74KmM9sDwkZQ+qYryL3xQcaG?= =?utf-8?q?LC34O5b7Cw8mhqiEBC+9Iq67ZcFa/qCAqowpRHaM5rasKqnf/tosuzKQNwMmU3g4G?= =?utf-8?q?mcx7Hi/dVxRMjiwVpzG2wRKLE2O+g6mS+SvWyEZObC3UsNAYgtTjtZMZZq4grvVME?= =?utf-8?q?e/XIWkRLtV6R/MyNOn+Fk4xW7Gue46l/XhBgabL0qvsIuhKhsFLldztmyl/whZV9A?= =?utf-8?q?oqsoUuJi9ZJPVJKZbK9jdArRRnMEPFLOJaRG2X8Q2VWIGwSaH83StMJUBKG6xYLc/?= =?utf-8?q?OQvkXFfi78/TO1T/rQnxpwpuxTbyMad7L5/eiT03rGiQudv5ZIwgRLyWJej4olSyc?= =?utf-8?q?QbFCWabtKt1gO/keqmerIEbYggkZ7GCL1seqc9/IMRb7O2MfvTtXB9HyDQ1/SXu5k?= =?utf-8?q?I9lsAjwcklbZW4P6LoubS4kf6kfJb54Nmstaftee4kl1FhCuJJI60/Ov1pz6L7FzZ?= =?utf-8?q?7CGZsYZ/+3ZlaGkwX2rwqE8R41Abt2sEcgCX0wtn/0ozvn4EAlTN4KaADPemej9Fu?= =?utf-8?q?zvnPxmf1CF5Vm/U0PbG4WzG59WZ0L0gqTQJ+HEW/24YUu2JFczp7zs6JgvnlbS/3o?= =?utf-8?q?TLt0VNs/5Y+WOVDVEwFMdWjrhaRiKFxJOUHLBLyCgrM8xP2CY5bs8LvXPFVMb4AmI?= =?utf-8?q?6Y2nlvb/0nQfzP0DByylNEGSA4kC9tFNmWd7eigDoELQZDukKIrfvbTLTTU49E7Nt?= =?utf-8?q?ADCH5GTQ0Y3A860jf8l+fmEaCw8vN7m5cUd6Q3g/pl5CfmF+Bh6lS30XRgzgbs+sQ?= =?utf-8?q?eX1fr7+n+Ca?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YDwwZ4D0HyHu8V7dDsaQPfBi0nBk?= =?utf-8?q?Wi05kKWH5z0K4MbQzWMa7W43SAkK5MF9Dkx0zRapfGmdo3iamy+Iu/Pi71XPst2bi?= =?utf-8?q?zU7jHC2MklFULoIer0GdCiyhzEwQtrUluNmE2KBsnBg4XzMfZMX9krf0CHp8UfCXl?= =?utf-8?q?l/r98QGKGLNFdmslOtHWt//1WUamNlwIlAUcCkpVNY89CBqN7yqmraFHFeK5I4OEC?= =?utf-8?q?RFx7+nN7WgNtV8OShXKkqtJLePJ7sP1wxa0rNPdwnUYcgvJJD6sdoc67B7elLig/W?= =?utf-8?q?VRiMioJzdCzI0VFy4NCVvTJs9FRsW71l1yxTDNY2sHLWRhWP1TlfV4aIV/uqZD2FL?= =?utf-8?q?Mx8J/OrEiVJ/ZGUe31MFBNwoQML8lFjhq4rO/suZuNRBbs89BWwItdlQQIx5wqejy?= =?utf-8?q?rK0ZqlTiRYrMkvO1lcv1h7F0kN88SiIAZuSHfWeUI3bXNN4doQ19bK71iVAIHaR9K?= =?utf-8?q?2X6QvzBnAjYzFEiXxXHRgZuV+BzMX3DEVvKMWzl1LzaAN0REVthWecUg/B521m0ik?= =?utf-8?q?axaszRuoMUI50zlyyJOQ1FMyKB5s/g4YVfMmVUZLEDVdmaIdo1XNtTPXaX55Z/DmT?= =?utf-8?q?KDBlvEaZDRKpwn8PTcEGA7AdlPPgHlzBJSuRW6IFTayS2YZFNIt5h5O5SYGCjQtNN?= =?utf-8?q?qKYxVWll7iSFnjBvruHpumYvJZ07DeXecammemcRgcGnVw7i2PjEJ6RrdlU1y/JN3?= =?utf-8?q?2DkhRhC4KOj2sVVVfc9DGERM17EDZRdJWbZPa7q/+iy72m8CKZ0bnR48z8RfK1orz?= =?utf-8?q?n56LUnRcds1HxXc7unEHoAeVcOPJtyk6y0U5eKbynjWfh7eoRoTygWrxptsQabPIn?= =?utf-8?q?kz5QO9nNrF3QYwNOmWAWbVg33K5hpOgedJxsNleAmhEtMGPZe4FpAr+LyoNgRAR3L?= =?utf-8?q?XM0JitG2LNPkgmxpoVoKW7G7zsXH5pKQcoISC7kBpDa0E53/JB51oZPfO0mLhGkSi?= =?utf-8?q?BcnjCniNBaICjqsypR++aJYSwJLi21QQcNKD7OA8e1BGeAnfIafiMLJFM3djHpqo4?= =?utf-8?q?YjQmgYeJl1lHxm/+UnaDcgYsunXuSWaMFuYnXjJS7GyymTjUsd7rvcgZzQbx21J39?= =?utf-8?q?0nyliVQPrVylmtb+Z3xRnN9J/+KBoHc/1pVRL5dG9wwIrlwJdyJx6ohup/WsfXu69?= =?utf-8?q?uuIAPqmH1DknZux+5ElRuLxf78gypaJd3a2I4thr2y51VyPsc80RxImCYSnwGDsol?= =?utf-8?q?WFih4BEs8ZlaEdsgiuIOYTOhvbjcZtT23vWX95+SzFYVE+8DEu0uxU/a9hXFHnpen?= =?utf-8?q?eFGebEQakvVPo12bZA46LrR7F11xz6QjYPxQk4fE30qtwRN7hwG9jW9q1xCQ3/qNo?= =?utf-8?q?/ldP/u/YiVwatpMAYZRAkTjoYndNGzfRCsPM0fhapuWnOKNy7HmlsyxD/x2qDedYk?= =?utf-8?q?9ZNjc7BWbXgQxnFRZDs8ih9aaCJ0IqC4/G1zI0mi/TlBS9Fdu2cpwG6zjFTUMlEyi?= =?utf-8?q?boYnzT+3yuMRzHTWlFIyUj+od4n3xr9lkayrK2nS2BlhswTsMqyekUlj+m0UD2WmA?= =?utf-8?q?SdUVawe5VUd6?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe12ba85-3a79-4476-7f45-08dd3a2d9008 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2025 15:09:12.1986 (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: nlMF+YVa4VX0ExoIU2CIaxWwLdRWufRY57QDrMh5iSZmIRCsNlwHa7OG9T6j1g5KRr62lpz9jkGiF6mFQTf5Mg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7891 From: Peng Fan The i.MX95 System manager exports SCMI CPU protocol for linux to manage cpu cores. The driver is to use the cpu Protocol interface to start, stop a cpu cores (eg, M7). Signed-off-by: Peng Fan --- drivers/firmware/imx/Kconfig | 11 +++++ drivers/firmware/imx/Makefile | 1 + drivers/firmware/imx/sm-cpu.c | 91 +++++++++++++++++++++++++++++++++++++++++ include/linux/firmware/imx/sm.h | 29 +++++++++++++ 4 files changed, 132 insertions(+) diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig index c3e344d6ecc645df1f0e3ee8078934c47f347fd7..91c753921dffbe16ced8c10565d44c15b66b2797 100644 --- a/drivers/firmware/imx/Kconfig +++ b/drivers/firmware/imx/Kconfig @@ -23,6 +23,17 @@ config IMX_SCU This driver manages the IPC interface between host CPU and the SCU firmware running on M4. +config IMX_SCMI_CPU_DRV + tristate "IMX SCMI CPU Protocol driver" + depends on IMX_SCMI_CPU_EXT || COMPILE_TEST + default y if ARCH_MXC + help + The System Controller Management Interface firmware (SCMI FW) is + a low-level system function which runs on a dedicated Cortex-M + core that could provide cpu management features. + + This driver can also be built as a module. + config IMX_SCMI_LMM_DRV tristate "IMX SCMI LMM Protocol driver" depends on IMX_SCMI_LMM_EXT || COMPILE_TEST diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile index 7762855d2a771169d4f1867d27e0d51be7c9ad03..3bbaffa6e3478112638ed031375602389f18ef09 100644 --- a/drivers/firmware/imx/Makefile +++ b/drivers/firmware/imx/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_IMX_DSP) += imx-dsp.o obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o +obj-${CONFIG_IMX_SCMI_CPU_DRV} += sm-cpu.o obj-${CONFIG_IMX_SCMI_MISC_DRV} += sm-misc.o obj-${CONFIG_IMX_SCMI_LMM_DRV} += sm-lmm.o diff --git a/drivers/firmware/imx/sm-cpu.c b/drivers/firmware/imx/sm-cpu.c new file mode 100644 index 0000000000000000000000000000000000000000..1ce694a34b22843db5c1697ecb33c0479edb2ed9 --- /dev/null +++ b/drivers/firmware/imx/sm-cpu.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2025 NXP + */ + +#include +#include +#include +#include +#include +#include + +static const struct scmi_imx_cpu_proto_ops *imx_cpu_ops; +static struct scmi_protocol_handle *ph; + +int scmi_imx_cpu_reset_vector_set(u32 cpuid, u64 vector, bool start, bool boot, + bool resume) +{ + if (!ph) + return -EPROBE_DEFER; + + return imx_cpu_ops->cpu_reset_vector_set(ph, cpuid, vector, start, + boot, resume); +} +EXPORT_SYMBOL(scmi_imx_cpu_reset_vector_set); + +int scmi_imx_cpu_start(u32 cpuid) +{ + if (!ph) + return -EPROBE_DEFER; + + return imx_cpu_ops->cpu_start(ph, cpuid); +}; +EXPORT_SYMBOL(scmi_imx_cpu_start); + +int scmi_imx_cpu_started(u32 cpuid, bool *started) +{ + if (!ph) + return -EPROBE_DEFER; + + if (!started) + return -EINVAL; + + return imx_cpu_ops->cpu_started(ph, cpuid, started); +}; +EXPORT_SYMBOL(scmi_imx_cpu_started); + +int scmi_imx_cpu_stop(u32 cpuid) +{ + if (!ph) + return -EPROBE_DEFER; + + return imx_cpu_ops->cpu_stop(ph, cpuid); +}; +EXPORT_SYMBOL(scmi_imx_cpu_stop); + +static int scmi_imx_cpu_probe(struct scmi_device *sdev) +{ + const struct scmi_handle *handle = sdev->handle; + + if (!handle) + return -ENODEV; + + if (imx_cpu_ops) { + dev_err(&sdev->dev, "sm cpu already initialized\n"); + return -EEXIST; + } + + imx_cpu_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_IMX_CPU, &ph); + if (IS_ERR(imx_cpu_ops)) + return PTR_ERR(imx_cpu_ops); + + return 0; +} + +static const struct scmi_device_id scmi_id_table[] = { + { SCMI_PROTOCOL_IMX_CPU, "imx-cpu" }, + { }, +}; +MODULE_DEVICE_TABLE(scmi, scmi_id_table); + +static struct scmi_driver scmi_imx_cpu_driver = { + .name = "scmi-imx-cpu", + .probe = scmi_imx_cpu_probe, + .id_table = scmi_id_table, +}; +module_scmi_driver(scmi_imx_cpu_driver); + +MODULE_AUTHOR("Peng Fan "); +MODULE_DESCRIPTION("IMX SM CPU driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/firmware/imx/sm.h b/include/linux/firmware/imx/sm.h index 1e58ffaa81acd757d9e6a992a2f2df663681c08a..d12d5323cf842343e5d470b2aac01a9e4e269c30 100644 --- a/include/linux/firmware/imx/sm.h +++ b/include/linux/firmware/imx/sm.h @@ -21,6 +21,35 @@ int scmi_imx_misc_ctrl_get(u32 id, u32 *num, u32 *val); int scmi_imx_misc_ctrl_set(u32 id, u32 val); +#if IS_ENABLED(CONFIG_IMX_SCMI_CPU_DRV) || IS_ENABLED(CONFIG_COMPILE_TEST) +int scmi_imx_cpu_start(u32 cpuid); +int scmi_imx_cpu_started(u32 cpuid, bool *started); +int scmi_imx_cpu_stop(u32 cpuid); +int scmi_imx_cpu_reset_vector_set(u32 cpuid, u64 vector, bool start, bool boot, + bool resume); +#else +static inline int scmi_imx_cpu_start(u32 cpuid) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_cpu_started(u32 cpuid, bool *started) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_cpu_stop(u32 cpuid) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_cpu_reset_vector_set(u32 cpuid, u64 vector, + bool start, bool boot, bool resume) +{ + return -EOPNOTSUPP; +} +#endif + #if IS_ENABLED(CONFIG_IMX_SCMI_LMM_DRV) || IS_ENABLED(CONFIG_COMPILE_TEST) int scmi_imx_lmm_boot(u32 lmid); int scmi_imx_lmm_info(u32 lmid, struct scmi_imx_lmm_info *info);