From patchwork Tue Jan 21 15:08:11 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: 13946401 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2085.outbound.protection.outlook.com [40.107.103.85]) (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 B87A51F3FD2 for ; Tue, 21 Jan 2025 15:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737472143; cv=fail; b=urpDkcVbH7J6gQg4TR2C5Y2F1QYibAmpKkRIQk9XVoaIn6scV8FVpKPvkZnMxD/dS6Za9ovptP3w2ZQBtOR+fcy8heYEbv7q5pw25xYQteO2Bp1ihk89DB3oRlTwPnaom74oNLeT8Dttv0TGUDJwG/+rV9FEmC5XSJUtu7rXGio= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737472143; c=relaxed/simple; bh=w4R9UMOdk5kPMASY79OCtlw8Xo3C5+4PM2wRK4t+hWM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=CGRFO004TXBLNsvmrSm2+eoObibNj06ykXyCyUpAuqFgguueWrQqUfPHO/s9A7XTmqKb4KoS4GDMXgEfDtKeN1vT95WWC3QK5RarA0AsfwWH9cm9C92Crmx7aaJMkkwRO/GTvKatQ+vKwGj9flW3KoMV+qg5QzXLhB0Z5A2et30= 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=qf92HbgU; arc=fail smtp.client-ip=40.107.103.85 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="qf92HbgU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=evHDAmcq5YUdwM3t7Q0fYYv5CdD+s6gmbENqjiY/NDyDGNMLd4J85252g6Trxg5bQnw7z0QJ3M302wZaVjwuE72KAmcNIGPC52jMHyzPohR+KhucyGRGKGeUYVIerY7otf3Z2K5gVW4w0LOZxeyXM8+D+nVl6KVPvlk/3wCsRw/a25rcJ4wX6hZzrIUHy3D5JznFfLwmNQvIKUVetOWlhi+xG2KhhGQc4VQGzsSs5VO5OSRwu7HutFU7Z+l5kuqpYSnyxO9llZbJNlBkc5CZes8c8b5gHEluoSTJIpbf5gZlbd8azYBx38VGQ4ysyYevDO1UKJ6pzXuHxoDw94Fztw== 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=x0ARC/RmMaxo8ILmen/egoAknRkBKuQNt2UgoWny2e0=; b=GMM6ohMdhC+zdb2eUToJ8MRahWIdnEfihFoiROA7xQe35aoUzzfBDDKabjQX+A/Dh7J9uvLQWoOaDi6qauS49FtPvXwx3r274gd4dhxzJ0shNkDNj8eOJFJUlMtMXrahLBa6CXZlJsizVw75jza7c3NTGfGK2fYk2CkHvjp9JJftuapJEAUZSat1hmUHKpcZOmFIOfHwWnQgp4jeQCYcR1VcEeBiktYyByZK4lV7BO3YBiTD7hkbWsdym+lI3fHCgn8v1sSmQJmBVGgpDn1THHk9E6+QJhCXIFBK4+v4w4fRkYzKVQjhYc91hcxbcmI9FREbMlXO9TRp8zqktVFFEQ== 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=x0ARC/RmMaxo8ILmen/egoAknRkBKuQNt2UgoWny2e0=; b=qf92HbgUh6773EF6spW0hjhyD+aqNLKUxMa851r0jP3LvAnl4zvsJjiAwiuxomWSDgr+5Ft2OCkIU7IiP9bg9eZ3nQTAI/op5tnA4IC20F+40ouX8HxCvhiYL5yNH370hei2zhVxbnxvJzUVfgvJlCUk4xk6DXFOalBu30BAymEW2cVUpNHWNrhosemoHwtyusN4yjG2jExL/DuRmoItNt3koHeU2opU9Gexp4obtgkGgkZ7fxEuaIRcKH0vB+Zif1Vs3QsyF6hDh0slajvT9YTomlY7K6smSTt9YT3yqveN75wqJ36JGC6VwJDyuQOCC3P/aWC9XrMB9sPLZ7qfAA== 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 AM7PR04MB6853.eurprd04.prod.outlook.com (2603:10a6:20b:107::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.22; Tue, 21 Jan 2025 15:08:58 +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:08:58 +0000 From: "Peng Fan (OSS)" Date: Tue, 21 Jan 2025 23:08:11 +0800 Subject: [PATCH 1/5] firmware: arm_scmi: imx: Add i.MX95 LMM protocol Message-Id: <20250121-imx-lmm-cpu-v1-1-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=9570; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=3VXrTHu1D4IdJfg6JFOee0D8LNmoa9UQv759Ph+nEo0=; b=sJ353smbiuenU1Xdfe5BlRH9eg9yS3af1RHhBTBU5F0ChPzlhoXgdCV0uFIB5CdNcXEqLQ+UU C64moMhnOG6CYizcBAp7xg7uX7O9zLN/TWlkfqfmdGieRpGbgnSJDlU 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_|AM7PR04MB6853:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e3a68d6-d74e-421b-1331-08dd3a2d87dc 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|366016|376014|52116014|7416014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WF4u7F6cXIwLs8iyChRtawnB3zrEtqS?= =?utf-8?q?dB5iqRCgHWIzGyO1eQFuIOhc2pKLTBdwSmnwrugQ0+DFUJ8nsSxNxO1Vbouk5Lk33?= =?utf-8?q?Nvfv2ipEAJNOyhSX2unzXm57tpWCA1efAmejB+09HlIb0R6mvF+QcghCkIIakvNSj?= =?utf-8?q?9PLWZvyu3a8EG/sQxqtW2k/h1cE7Z3b2FhEAotaDwVzfCKJxjDSMUrifi63jKHE6C?= =?utf-8?q?TPF8w9SlNxBM+ZBduIbNSvTyUGRKUtm3djN1nOkzLCCpHL2j3u14MhbQczc65+4ie?= =?utf-8?q?dUQ0LklyS8Ml19F6jJPi9SinJE+InMDpfEPdgN3h81+zF0mZ38ZR2QuXFMbLBwsEX?= =?utf-8?q?iOqYTM7YACPkMp3RUu+glbal4/5r4mguVXpc1SlwhuqZ0A0pXvXnkYOrl8zbB5Gmc?= =?utf-8?q?VFez76mecEA9b7GRUcRyTYx/riW0OtiQ5VjJfB1btFCnYNPNzLIlWGm328C8opv21?= =?utf-8?q?QmwFS52PxaiFOGKWAgns2DpWMGkCKqszdwxlLQk1H7Qz2ROYR1Bat1oaU29L133F+?= =?utf-8?q?4poe5YLtuVX4RMgaiSHvZVsypP+sANfuun27L/Sec8cQqHTn5Votx82pSvZSXtwbs?= =?utf-8?q?IFlkS0V5p+AkkO3ufW+viZ6pFOpFtUqXZjlK6KkmOTrEorZIXveIgpVxDFc4fl6OD?= =?utf-8?q?PFBbWXCieN/Cq1ZC+PXTiLHOKZAQ9XyhvEdrFnd/TDf9ZWBNp4ZxvjGvqCEfbOq/x?= =?utf-8?q?kHz6bTM4DktGLHsVgqXew60uwCOXySnlyD1h5L2+vPqAsr2rL0WfEspuwxHr0lBUt?= =?utf-8?q?Xgt17nHsPpVfdwIIhU78FSLdFQWjjhaAa+pD31KlWPoLjO6Jkm15TTqiUbhpGInYO?= =?utf-8?q?K4e3zxkW7UU1ozAGRk2r1ncZog7WivLUdDPUvQvSMTaOEshrQHrpmPi1EWcXC8Z87?= =?utf-8?q?5YSfDSlf0c9+o3axLanskF2BrWHnCDp2YBm97SKcawzXrCTnfE7rF7tUvY4FfV+Ag?= =?utf-8?q?qj28DK8meLTu6ozpv0Ii/GGzO3PE+EIhz59o5fhp5ohJZuDfGn/MjPpAbaEoeyXgr?= =?utf-8?q?n0UR1xS/4z199LOSVsYd1Nnr/RzLhcTZXkIVE5kWx3i5k5miQeaqCd2ptksdaax7z?= =?utf-8?q?ug6eZTMEnPoXlPs3dVAdjlj2WDFTL3E+/MTvoOKj+572VeyZL1V9r5Wu6q1YmmZYm?= =?utf-8?q?WhC45jrB5p9zfNDAeUGhwBuGaJ5REYS3HoBNiO/LeqQC58TsOPnqsUf5NTfRi0BqN?= =?utf-8?q?xlrBQDo1hcpJrlS2D6B5GBZL1D/L882jXcmEI8AomBGTC9nrZg9P9VYJpCFGZHljV?= =?utf-8?q?L/NSwcBnDSH4/Is3ESz38N6Z2oay9VULG7AfiLYiO/3wB1QSc6WDAAwc49Cdzb2jY?= =?utf-8?q?CkJ3yXKgDS8Bq/lDAs+EBuYZ5A7J7zCIgrNmCc86r1Kd+5Wyvr6qF0rdb5gWnF8ez?= =?utf-8?q?nWSxoVY7WKT?= 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)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?qLcLo1B2esXd94bqzNmze2fnV8wb?= =?utf-8?q?QWFuo3fnYc4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AnFIDs1kZYJxELjtLEZZgigDY4oTdNZTnPMJNFZI0cipulgO7N6/?= =?utf-8?q?PVTkCoz7dTmsv4pRZoObhUDhtvt2KkrQeRpdEphqKHCsZDu0qjl92iFDHySqRbRM7?= =?utf-8?q?5kqu4hW483yGWcbolCv+SvKpiCIEmdyEHQt27C5cAvU7RDs+rOQ6uKqNvIwoo1eS+?= =?utf-8?q?0z7QbNBq1cljfwdVlrwjXIdV9AOsAgjMwqLle30gOuyLE5+cqvkgebfv0mHaKgpRn?= =?utf-8?q?A6Gk345X/kKa7vljQFr+vrjkJEQjBgGDnNZg0N2kdJcFo+YIGm9MhJY9dzaajqu5A?= =?utf-8?q?a7qKNcrpwfWw5mJOwdM7QX/F72Qh5zcXamKiLZia6Q8XoU6hLRYj6bvTDNY83k+q/?= =?utf-8?q?36v1tPM1zJq2BGmDOG/OPYpAXIXcrtqtp1axr6AkuvnkFAiDVfWZ9o4ca2Rc3LNl/?= =?utf-8?q?0FVM8WbmQTFRbjgFqsaSCAHnBa9Ysfb4IpK0uvM6YSzaiLPmE6u0Tl2hwrTyQn4im?= =?utf-8?q?LEtnhAVI1zmY/3d/dWzGQeCk718T9IfRZR5jH6ZDxslfqJVaAF8AZ+t9sJSsCBKuC?= =?utf-8?q?w9btfA0U05irup1DmRVCQcDMdMdWT14IiF6sanp6e/3I7gaIDLM2QtkR4M+ZCI8VC?= =?utf-8?q?shXv/fIDKMF4?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e3a68d6-d74e-421b-1331-08dd3a2d87dc 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:08:58.5643 (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: 0QCqyICgt2rW97iSrf9VnGZrqrCnIPRq0z5aUsA8HGUkr6mWbzkpptuZBdNWWCgpy9s+b037WiCbhVXXqoDgJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6853 From: Peng Fan Add Logical Machine Management(LMM) protocol which is intended for boot, shutdown, and reset of other logical machines (LM). It is usually used to allow one LM to manager another used as an offload or accelerator engine. Signed-off-by: Peng Fan --- drivers/firmware/arm_scmi/vendors/imx/Kconfig | 11 + drivers/firmware/arm_scmi/vendors/imx/Makefile | 1 + drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c | 235 +++++++++++++++++++++ include/linux/scmi_imx_protocol.h | 29 +++ 4 files changed, 276 insertions(+) diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig b/drivers/firmware/arm_scmi/vendors/imx/Kconfig index a01bf5e47301d2f93c9bfc7eebc77e083ea4ed75..1a936fc87d2350e2a21bccd45dfbeebfa3b90286 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig +++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig @@ -12,6 +12,17 @@ config IMX_SCMI_BBM_EXT To compile this driver as a module, choose M here: the module will be called imx-sm-bbm. +config IMX_SCMI_LMM_EXT + tristate "i.MX SCMI LMM EXTENSION" + depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF) + default y if ARCH_MXC + help + This enables i.MX System Logical Machine Protocol to + manage Logical Machines boot, shutdown and etc. + + To compile this driver as a module, choose M here: the + module will be called imx-sm-lmm. + config IMX_SCMI_MISC_EXT tristate "i.MX SCMI MISC EXTENSION" depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF) diff --git a/drivers/firmware/arm_scmi/vendors/imx/Makefile b/drivers/firmware/arm_scmi/vendors/imx/Makefile index d3ee6d5449244a4f5cdf6abcf1845f312c512325..f39a99ccaf9af757475e8b112d224669444d7ddc 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/Makefile +++ b/drivers/firmware/arm_scmi/vendors/imx/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_IMX_SCMI_BBM_EXT) += imx-sm-bbm.o +obj-$(CONFIG_IMX_SCMI_LMM_EXT) += imx-sm-lmm.o obj-$(CONFIG_IMX_SCMI_MISC_EXT) += imx-sm-misc.o diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c new file mode 100644 index 0000000000000000000000000000000000000000..808cbedba5de4b4314948c06c60bebea057efbe7 --- /dev/null +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c @@ -0,0 +1,235 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * System control and Management Interface (SCMI) NXP LMM Protocol + * + * Copyright 2025 NXP + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "../../protocols.h" +#include "../../notify.h" + +#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x10000 + +enum scmi_imx_lmm_protocol_cmd { + SCMI_IMX_LMM_ATTRIBUTES = 0x3, + SCMI_IMX_LMM_BOOT = 0x4, + SCMI_IMX_LMM_RESET = 0x5, + SCMI_IMX_LMM_SHUTDOWN = 0x6, + SCMI_IMX_LMM_WAKE = 0x7, + SCMI_IMX_LMM_SUSPEND = 0x8, + SCMI_IMX_LMM_NOTIFY = 0x9, + SCMI_IMX_LMM_RESET_REASON = 0xA, + SCMI_IMX_LMM_POWER_ON = 0xB, +}; + +struct scmi_imx_lmm_priv { + u32 nr_lmm; +}; + +#define SCMI_IMX_LMM_PROTO_ATTR_NUM_LM(x) (((x) & 0xFFU)) +struct scmi_msg_imx_lmm_protocol_attributes { + __le32 attributes; +}; + +struct scmi_msg_imx_lmm_attributes_out { + __le32 lmid; + __le32 attributes; + __le32 state; + __le32 errstatus; + u8 name[LMM_MAX_NAME]; +}; + +struct scmi_imx_lmm_shutdown_in { + __le32 lmid; +#define LMM_FLAGS_GRACEFUL(x) ((x) & BIT(0)) + __le32 flags; +}; + +static int scmi_imx_lmm_validate_lmid(const struct scmi_protocol_handle *ph, u32 lmid) +{ + struct scmi_imx_lmm_priv *priv = ph->get_priv(ph); + + if (lmid >= priv->nr_lmm) + return -EINVAL; + + return 0; +} + +static int scmi_imx_lmm_attributes(const struct scmi_protocol_handle *ph, + u32 lmid, struct scmi_imx_lmm_info *info) +{ + struct scmi_msg_imx_lmm_attributes_out *out; + struct scmi_xfer *t; + int ret; + + ret = ph->xops->xfer_get_init(ph, SCMI_IMX_LMM_ATTRIBUTES, sizeof(u32), 0, &t); + if (ret) + return ret; + + put_unaligned_le32(lmid, t->tx.buf); + ret = ph->xops->do_xfer(ph, t); + if (!ret) { + out = t->rx.buf; + info->lmid = le32_to_cpu(out->lmid); + info->state = le32_to_cpu(out->state); + info->errstatus = le32_to_cpu(out->errstatus); + strscpy(info->name, out->name); + dev_dbg(ph->dev, "i.MX LMM: Logical Machine(%d), name: %s\n", + info->lmid, out->name); + } else { + dev_err(ph->dev, "i.MX LMM: Failed to get info of Logical Machine(%u)\n", lmid); + } + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static int scmi_imx_lmm_boot(const struct scmi_protocol_handle *ph, u32 lmid) +{ + struct scmi_xfer *t; + int ret; + + ret = scmi_imx_lmm_validate_lmid(ph, lmid); + if (ret) + return ret; + + ret = ph->xops->xfer_get_init(ph, SCMI_IMX_LMM_BOOT, sizeof(u32), + 0, &t); + if (ret) + return ret; + + put_unaligned_le32(lmid, t->tx.buf); + ret = ph->xops->do_xfer(ph, t); + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static int scmi_imx_lmm_power_on(const struct scmi_protocol_handle *ph, u32 lmid) +{ + struct scmi_xfer *t; + int ret; + + ret = scmi_imx_lmm_validate_lmid(ph, lmid); + if (ret) + return ret; + + ret = ph->xops->xfer_get_init(ph, SCMI_IMX_LMM_POWER_ON, sizeof(u32), + 0, &t); + if (ret) + return ret; + + put_unaligned_le32(lmid, t->tx.buf); + ret = ph->xops->do_xfer(ph, t); + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static int scmi_imx_lmm_shutdown(const struct scmi_protocol_handle *ph, u32 lmid, + u32 flags) +{ + struct scmi_imx_lmm_shutdown_in *in; + struct scmi_xfer *t; + int ret; + + ret = scmi_imx_lmm_validate_lmid(ph, lmid); + if (ret) + return ret; + + ret = ph->xops->xfer_get_init(ph, SCMI_IMX_LMM_SHUTDOWN, sizeof(*in), + 0, &t); + if (ret) + return ret; + + in = t->tx.buf; + in->lmid = cpu_to_le32(lmid); + in->flags = cpu_to_le32(flags); + ret = ph->xops->do_xfer(ph, t); + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static const struct scmi_imx_lmm_proto_ops scmi_imx_lmm_proto_ops = { + .lmm_boot = scmi_imx_lmm_boot, + .lmm_info = scmi_imx_lmm_attributes, + .lmm_power_on = scmi_imx_lmm_power_on, + .lmm_shutdown = scmi_imx_lmm_shutdown, +}; + +static int scmi_imx_lmm_protocol_attributes_get(const struct scmi_protocol_handle *ph, + struct scmi_imx_lmm_priv *priv) +{ + struct scmi_msg_imx_lmm_protocol_attributes *attr; + struct scmi_xfer *t; + int ret; + + ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0, + sizeof(*attr), &t); + if (ret) + return ret; + + attr = t->rx.buf; + + ret = ph->xops->do_xfer(ph, t); + if (!ret) { + priv->nr_lmm = SCMI_IMX_LMM_PROTO_ATTR_NUM_LM(attr->attributes); + dev_info(ph->dev, "i.MX LMM: %d Logical Machines\n", + priv->nr_lmm); + } + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static int scmi_imx_lmm_protocol_init(const struct scmi_protocol_handle *ph) +{ + struct scmi_imx_lmm_priv *info; + u32 version; + int ret; + + ret = ph->xops->version_get(ph, &version); + if (ret) + return ret; + + dev_info(ph->dev, "NXP SM LMM Version %d.%d\n", + PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + + info = devm_kzalloc(ph->dev, sizeof(*info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + ret = scmi_imx_lmm_protocol_attributes_get(ph, info); + if (ret) + return ret; + + return ph->set_priv(ph, info, version); +} + +static const struct scmi_protocol scmi_imx_lmm = { + .id = SCMI_PROTOCOL_IMX_LMM, + .owner = THIS_MODULE, + .instance_init = &scmi_imx_lmm_protocol_init, + .ops = &scmi_imx_lmm_proto_ops, + .supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION, + .vendor_id = SCMI_IMX_VENDOR, + .sub_vendor_id = SCMI_IMX_SUBVENDOR, +}; +module_scmi_protocol(scmi_imx_lmm); + +MODULE_DESCRIPTION("i.MX SCMI LMM driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/scmi_imx_protocol.h b/include/linux/scmi_imx_protocol.h index 53b356a26414279f4aaaa8287c32209ed1ad57b4..456559f021696ae51f40ed11e6f85089d430ce71 100644 --- a/include/linux/scmi_imx_protocol.h +++ b/include/linux/scmi_imx_protocol.h @@ -11,8 +11,10 @@ #include #include #include +#include #include +#define SCMI_PROTOCOL_IMX_LMM 0x80 #define SCMI_PROTOCOL_IMX_BBM 0x81 #define SCMI_PROTOCOL_IMX_MISC 0x84 @@ -57,4 +59,31 @@ struct scmi_imx_misc_proto_ops { int (*misc_ctrl_req_notify)(const struct scmi_protocol_handle *ph, u32 ctrl_id, u32 evt_id, u32 flags); }; + +#define LMM_ID_DISCOVER 0xFFFFFFFFU +#define LMM_MAX_NAME 16 + +enum scmi_imx_lmm_state { + LMM_STATE_LM_OFF, + LMM_STATE_LM_ON, + LMM_STATE_LM_SUSPEND, + LMM_STATE_LM_POWERED, +}; + +struct scmi_imx_lmm_info { + u32 lmid; + enum scmi_imx_lmm_state state; + u32 errstatus; + u8 name[LMM_MAX_NAME]; +}; + +struct scmi_imx_lmm_proto_ops { + int (*lmm_boot)(const struct scmi_protocol_handle *ph, u32 lmid); + int (*lmm_info)(const struct scmi_protocol_handle *ph, u32 lmid, + struct scmi_imx_lmm_info *info); + int (*lmm_power_on)(const struct scmi_protocol_handle *ph, u32 lmid); + int (*lmm_shutdown)(const struct scmi_protocol_handle *ph, u32 lmid, + u32 flags); +}; + #endif From patchwork Tue Jan 21 15:08:12 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: 13946402 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2085.outbound.protection.outlook.com [40.107.103.85]) (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 361E81F3FD2 for ; Tue, 21 Jan 2025 15:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737472146; cv=fail; b=DnCTians2ILt8zsKBU9j/JoTOg9fyyRj+4DkC4IzyIvEAnuwL1dYnpmQTjB+JW+1+LFpmiORIfRxKVSu7r49/Y1DpcI6p9StKszHhp2MrXHzbLagmuXmAnica8TNEumhkQhIwgXg+dou2DEDVUr0fWErxZSBusohSG6oKz5W0KI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737472146; c=relaxed/simple; bh=D5N8sM0XcIGJAHlmIbuPX24MHLF/Lw1gFt5AbxcLrXI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ILKqoMcpBrTVKgzn0dtsbw5AUJEbgcgzAEE7AKY/5RXWup1rOvUx48sLzMIqmsuN6Q27A9h/UD3FX6R8KrSdaKcpfasFHkj/uWHt2FzVax/ggaA+92MpoQNLDnM7v8v7pUwfreTygNAcSzt2NYec/FAmq43dCg+eLyetWfOWwk4= 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=fdVSprAU; arc=fail smtp.client-ip=40.107.103.85 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="fdVSprAU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DCpHkrH32LrC06CwLFg8YjoKj9OQ85GyqhESVQ2uAaVF+HHmRc+5dltBnEEd+XI53ui1ynCc2rJBIj0QWsHzmRNrzGZQGgNEH9XPIrGSSELpKsihP2d3GMOSAQJE8+RQbPtV6v/Dk10rcLjSHWe6VPq3RkmzQv6e/Y2AdNDQmXNYyJ75EbMfyw2mEoRVTQiI1qrzHJy0Nuc7Ch+5N0CRHy3gXLZh27cODZyHX/H9p+f6X58v/Bsgz7zUgeExyQTlZDum7VQ02URVunPfdM4d37e9eN56xb0rSzh9s2rot30VGxkvlg/sb2HGR5rn43I7Zoo/7QqNGpdDca+9Bghbbw== 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=j9edP/JrVA+yShP9vIcD/4dxX5YBpcITjaG+fntkc3k=; b=IHGh632A/7+2zjpRHbugKHqNoqlm22SVyfMDwcPeTGoP5FCiBle2IgF5J+UsDbGiNnY47ZYZgjSjmZW7ObDdFjHFpBIUnUynPu38MtAl0TG06+/f5buO4FjCdH6MvDOFOKHJ7CDBq9da3qI3TYD6VUthx5vQeDMYELsrKYvJw21Xlie8G3OgXoo7RamdO+hwUhqyrsGBmgv7O45OdZffbTbA41I2xQ408UK5E/TvN4a34ZPlhSeDaCuKNXTkeZFZHSKXTsHSuckXZ8Arwq/2Wr/gCK/yRr/JbxCHanAKiYH6gR81TTHsMQVtWnaTe7oTxc5IKT9umcs2iI9zleLFKA== 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=j9edP/JrVA+yShP9vIcD/4dxX5YBpcITjaG+fntkc3k=; b=fdVSprAU4Wjv53nySBdTQ6Y5sPqXuBrBDckfB8VTT0/yLjrLnczvuq6vMYc2iqlL+RjKZ3qD938Z1hCJc33Xw1HNZuCnis0HjipFje5nYG2o/mmE6QSrFkxf34vFHBmf0pcdWsdB36RlSrN6fGpJvLYklSGyhJg+TT+5KhqRo5BEaCptatV7JB/DcPQq9mk3x8aqu9MDYa+HjUEO0SAj8ECifPxBvrVA93Zs87Hfx11J012x8zG82N6UjK4X8+ziAuIqmbjZ7L2slcfJkAAHuVxkL9Uhbc6QG6TwyuFLrmBr2arbIrncBFxS9NzHunRavC2YRPf4EYIefxfA9LgTKg== 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 AM7PR04MB6853.eurprd04.prod.outlook.com (2603:10a6:20b:107::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.22; Tue, 21 Jan 2025 15:09:02 +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:01 +0000 From: "Peng Fan (OSS)" Date: Tue, 21 Jan 2025 23:08:12 +0800 Subject: [PATCH 2/5] firmware: arm_scmi: imx: Add i.MX95 CPU Protocol Message-Id: <20250121-imx-lmm-cpu-v1-2-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=10603; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Kis3sr9W8URwEQj+n9s61NGQaShBcfjbC/o6ISml5Ds=; b=0RveYEMSiCz43jRP4XSO+cZeHzNmT7xTzkLXccuSQQpRF2zBy13Y+D5onQbR0X+N+OI11jZGr jsdap3xQyB5CRLZ0yCpARrEMhA5rZxvazsEwvypALQM6NN6Ll1GXheK 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_|AM7PR04MB6853:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e16932c-5d3e-4282-b756-08dd3a2d89e4 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|366016|376014|52116014|7416014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?TqkHnuzKlQ3Ztc4pfhtu7mFtntX6w1g?= =?utf-8?q?GLgTXGWtDAvEtWPuGuWuMp91Bmvm4I0/ikllkAn5j02JlpNnvBmTTe14DZjlbdlxz?= =?utf-8?q?U75+5XZsbO0y9/g6+grpz9FnripdpmxB3miI9CkpO6Ack7qsbnMVMnYZAAs39CSKy?= =?utf-8?q?7Zsg5/p6azzZNdArUXc81VtHUvRWPA+T/r98PLTqy9FwT339Ldjg3DreWv+FJKoUV?= =?utf-8?q?0XBCW2j+rmEGkreR32O1qwKlIz6WGjSbI5xJsioXmXHCcXG3tA3wiJmHHy1gSLeax?= =?utf-8?q?8tdtNnayF9bTI2v5/pYmupwLrCCCKpGcgvu9cnPu7iU6zX57UfuyH6ljnfEHban5C?= =?utf-8?q?Gyg1fu/tm4pWcUp2O771jBH6byv6Kp0s2HVP4sjr+OZMz9BXm9sB5cyShiqaSpg1Z?= =?utf-8?q?186p9FjXknAExhF0TbQ540Y2gId9gMnfxSXVKFveGsiR9ikWFCEdzU/Y9FWdNzhWa?= =?utf-8?q?OmYqldiI1aR9NzmR0osxfQaqihTNQJoc8ROlWf3HsuK9tOwBUskDoghDBnrNxkh0L?= =?utf-8?q?KLaYmZn9W5Kez1g1wfBmxLlYgG5gnK8K9ZDsKHEaFtv2wdd8x5r5QZ4hJ6xOE5fFL?= =?utf-8?q?UJydq29jeWTCuCTXucwX5/3MeSwQ4TyEzrcFptiM6kzDm7B2PT/P9QaNhF51tBdoc?= =?utf-8?q?4YgHTvPYVaeDZNMrTRuKIBA4ZypSrA3bbDGAGVhCGgZPsSYLiB/UpmKK3KLHlvjSM?= =?utf-8?q?Td9vRNGZ9/ygaLh4/B1G4kLM6UydboJMrkWaEM70+dWIMZYevp7mwufE+FcVhGUss?= =?utf-8?q?FlavKNCEpjXLz/iE7KKyLAWgJbsyUtAcigRIBs3YwoBHTfRAtZCfm+nJvvErhvZb/?= =?utf-8?q?esZy91XqZT6cCTvZgr4rU8UkOu4taVC9xY51q2IzBjAFCNpbwxOTg93oa3eTKUTv1?= =?utf-8?q?euclbTaxmwlSrrCXnV1Li4SvyNDa3e7RIix5JVIWVK09rxje2x0QtN9tuyr0mcFtb?= =?utf-8?q?OOb3KCzBVu2ir4DfR2cGfuAt07YWoRUAxGD2/yUo7lXfI9JYUY+jb2aVB/mJ0L+Qt?= =?utf-8?q?74HcYhY8zZj/c+nkogX01EiaWg195DcvxCHk08vPKD7z9zPocs73KsDEu/o7b69qi?= =?utf-8?q?wpN4y8O872GbFR3+8ZuJsgp4B7ACT3PymEuB4Vgz2kXwa+wcGxkv99qfh5ohNPtME?= =?utf-8?q?qjPBWFHP6NPANJNLZ0OWtm/TU/N1rHhFq8+8UJKpAkkK8ZYMD9ZrTnmeh/gHMYRQa?= =?utf-8?q?oiSGLSAwVbEJRCkVKJysU1YAppLgk3j8cIZirY7QuODGCEAYyDmjB7bc8l/vZo+y5?= =?utf-8?q?+3scDMgPYQs7oTTzeQSJV1taLMwwM70VOPYyC3DKFoac4t6MIYLiah7Dy6uZg/nSk?= =?utf-8?q?k7R0P0q4IeEhQ6M2ymsyurNhDcCN9L3r/kA7+hD+bevk++Rtwpa6MOqCukqHEmxdk?= =?utf-8?q?WwS+r42Cbcv?= 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)(366016)(376014)(52116014)(7416014)(1800799024)(38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/XE3ZywJe1lZ9AP5Uv636wIbMVwjgBr/kZJGMIFpApV?= =?utf-8?q?AIOdnpQdFMBhWrWemQe7pwUVzuu/HE2QJQMN6l+Z7RmSi1UFAKGAWspBeAaFQcLLC?= =?utf-8?q?Q67fz9bRVj9jjqtZHCB2YENhwW2Q8rgiPYyuWvnj8CVnMtZzYBXjfEldQ87YEK7oO?= =?utf-8?q?3futpLoucbXqYKbzVyCpKnzVXcm6g3hD5lTZN3pjIPKY1oUHDGyQt6N3BZB5Kv7P8?= =?utf-8?q?JHVFgvcsTZojk63AZKbLFZP5vkFmU968OiJH6E48i80dyVsjgiCbGF94HLSZSTeIW?= =?utf-8?q?+6O0tdYZG2i/d5fIPwroI16wf4bsge4/rtLezKPayVXEsdApmGSQnBuukzdNZydct?= =?utf-8?q?0DfJyQEwd7FWr+plaa94Hc8XlnV5yy/lt9nGapuHObRfon7jRpG6OTfPtFmSwfnQ+?= =?utf-8?q?gMNq4SZWL3IAsdvtuHh1zNGLsCf+OzDx12dhwXalfDYy2hF/lEPnHmrBwdxmzLCRS?= =?utf-8?q?Q7V34cY2dQv5xbJT7iGFzHbZ23fw0PaMMf/K6615sdsF+K2la7ERtO/Gi4R7JloLv?= =?utf-8?q?hsYxKcYrGvdBV41d7NCaihTctJErpUENOvx41YIvtE2fZSVAecE/LnLGnh4j6YQvK?= =?utf-8?q?y9Ia9GogzXMpYbIsxPXEk9Gw4B1+x3RCIYjM/WX6KRF/rEWI6ozrt6lTZtZg2IubD?= =?utf-8?q?+EXVd0K/UJ2rkBcsIhq3jXZrSHPE+wAfHGG7TySM6uFw6LOeNxUpixZ+pV/cfD4nJ?= =?utf-8?q?uOzHcPCU1Ond?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e16932c-5d3e-4282-b756-08dd3a2d89e4 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:01.8875 (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: ob8P+nQMbJeelvRTW4OGqbOZ8CG10iPu0xBbWE9z7xLXnPKfunUvXxZeH+2icoCLZvrAamHli3rmm7h3CgWrpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6853 From: Peng Fan This protocol allows an agent to start, stop a CPU or set reset vector. It is used to manage auxiliary CPUs in an LM (e.g. additional cores in an AP cluster). Signed-off-by: Peng Fan --- drivers/firmware/arm_scmi/vendors/imx/Kconfig | 13 +- drivers/firmware/arm_scmi/vendors/imx/Makefile | 1 + drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c | 283 +++++++++++++++++++++ include/linux/scmi_imx_protocol.h | 10 + 4 files changed, 306 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig b/drivers/firmware/arm_scmi/vendors/imx/Kconfig index 1a936fc87d2350e2a21bccd45dfbeebfa3b90286..9070522510e4d3f3d7276a7581f8676006d20f90 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig +++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig @@ -12,6 +12,17 @@ config IMX_SCMI_BBM_EXT To compile this driver as a module, choose M here: the module will be called imx-sm-bbm. +config IMX_SCMI_CPU_EXT + tristate "i.MX SCMI CPU EXTENSION" + depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF) + default y if ARCH_MXC + help + This enables i.MX System CPU Protocol to manage cpu + start, stop and etc. + + To compile this driver as a module, choose M here: the + module will be called imx-sm-cpu. + config IMX_SCMI_LMM_EXT tristate "i.MX SCMI LMM EXTENSION" depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF) @@ -21,7 +32,7 @@ config IMX_SCMI_LMM_EXT manage Logical Machines boot, shutdown and etc. To compile this driver as a module, choose M here: the - module will be called imx-sm-lmm. + module will be called imx-sm-cpu. config IMX_SCMI_MISC_EXT tristate "i.MX SCMI MISC EXTENSION" diff --git a/drivers/firmware/arm_scmi/vendors/imx/Makefile b/drivers/firmware/arm_scmi/vendors/imx/Makefile index f39a99ccaf9af757475e8b112d224669444d7ddc..e3a5ea46345c89da1afae25e55698044672b7c28 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/Makefile +++ b/drivers/firmware/arm_scmi/vendors/imx/Makefile @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_IMX_SCMI_BBM_EXT) += imx-sm-bbm.o +obj-$(CONFIG_IMX_SCMI_CPU_EXT) += imx-sm-cpu.o obj-$(CONFIG_IMX_SCMI_LMM_EXT) += imx-sm-lmm.o obj-$(CONFIG_IMX_SCMI_MISC_EXT) += imx-sm-misc.o diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c new file mode 100644 index 0000000000000000000000000000000000000000..e3f294c2cb69a5b5a916d55984f4a63539937d02 --- /dev/null +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * System control and Management Interface (SCMI) NXP CPU Protocol + * + * Copyright 2025 NXP + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "../../protocols.h" +#include "../../notify.h" + +#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x10000 + +enum scmi_imx_cpu_protocol_cmd { + SCMI_IMX_CPU_ATTRIBUTES = 0x3, + SCMI_IMX_CPU_START = 0x4, + SCMI_IMX_CPU_STOP = 0x5, + SCMI_IMX_CPU_RESET_VECTOR_SET = 0x6, + SCMI_IMX_CPU_INFO_GET = 0xC, +}; + +struct scmi_imx_cpu_info { + u32 nr_cpu; +}; + +#define SCMI_IMX_CPU_PROTO_ATTR_NUM_CPUS(x) ((x) & 0xFFFF) +struct scmi_msg_imx_cpu_protocol_attributes { + __le32 attributes; +}; + +struct scmi_msg_imx_cpu_attributes_out { + __le32 attributes; +#define CPU_MAX_NAME 16 + u8 name[CPU_MAX_NAME]; +}; + +struct scmi_imx_cpu_reset_vector_set_in { + __le32 cpuid; +#define CPU_VEC_FLAGS_RESUME BIT(31) +#define CPU_VEC_FLAGS_START BIT(30) +#define CPU_VEC_FLAGS_BOOT BIT(29) + __le32 flags; + __le32 resetvectorlow; + __le32 resetvectorhigh; +}; + +struct scmi_imx_cpu_info_get_out { +#define CPU_RUN_MODE_START 0 +#define CPU_RUN_MODE_HOLD 1 +#define CPU_RUN_MODE_STOP 2 +#define CPU_RUN_MODE_SLEEP 3 + __le32 runmode; + __le32 sleepmode; + __le32 resetvectorlow; + __le32 resetvectorhigh; +}; + +static int scmi_imx_cpu_validate_cpuid(const struct scmi_protocol_handle *ph, + u32 cpuid) +{ + struct scmi_imx_cpu_info *info = ph->get_priv(ph); + + if (cpuid >= info->nr_cpu) + return -EINVAL; + + return 0; +} + +static int scmi_imx_cpu_start(const struct scmi_protocol_handle *ph, u32 cpuid) +{ + struct scmi_xfer *t; + int ret; + + ret = scmi_imx_cpu_validate_cpuid(ph, cpuid); + if (ret) + return ret; + + ret = ph->xops->xfer_get_init(ph, SCMI_IMX_CPU_START, sizeof(u32), + 0, &t); + if (ret) + return ret; + + put_unaligned_le32(cpuid, t->tx.buf); + ret = ph->xops->do_xfer(ph, t); + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static int scmi_imx_cpu_stop(const struct scmi_protocol_handle *ph, u32 cpuid) +{ + struct scmi_xfer *t; + int ret; + + ret = scmi_imx_cpu_validate_cpuid(ph, cpuid); + if (ret) + return ret; + + ret = ph->xops->xfer_get_init(ph, SCMI_IMX_CPU_STOP, sizeof(u32), + 0, &t); + if (ret) + return ret; + + put_unaligned_le32(cpuid, t->tx.buf); + ret = ph->xops->do_xfer(ph, t); + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static int scmi_imx_cpu_reset_vector_set(const struct scmi_protocol_handle *ph, + u32 cpuid, u64 vector, bool start, + bool boot, bool resume) +{ + struct scmi_imx_cpu_reset_vector_set_in *in; + struct scmi_xfer *t; + int ret; + + ret = scmi_imx_cpu_validate_cpuid(ph, cpuid); + if (ret) + return ret; + + ret = ph->xops->xfer_get_init(ph, SCMI_IMX_CPU_RESET_VECTOR_SET, sizeof(*in), + 0, &t); + if (ret) + return ret; + + in = t->tx.buf; + in->cpuid = cpu_to_le32(cpuid); + in->flags = start ? CPU_VEC_FLAGS_START : 0; + in->flags |= boot ? CPU_VEC_FLAGS_BOOT : 0; + in->flags |= resume ? CPU_VEC_FLAGS_BOOT : 0; + in->resetvectorlow = cpu_to_le32(lower_32_bits(vector)); + in->resetvectorhigh = cpu_to_le32(upper_32_bits(vector)); + ret = ph->xops->do_xfer(ph, t); + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static int scmi_imx_cpu_started(const struct scmi_protocol_handle *ph, u32 cpuid, + bool *started) +{ + struct scmi_imx_cpu_info_get_out *out; + struct scmi_xfer *t; + int ret; + + *started = false; + ret = scmi_imx_cpu_validate_cpuid(ph, cpuid); + if (ret) + return ret; + + ret = ph->xops->xfer_get_init(ph, SCMI_IMX_CPU_INFO_GET, sizeof(u32), + 0, &t); + if (ret) + return ret; + + put_unaligned_le32(cpuid, t->tx.buf); + ret = ph->xops->do_xfer(ph, t); + if (!ret) { + out = t->rx.buf; + if ((out->runmode == CPU_RUN_MODE_START) || + (out->runmode == CPU_RUN_MODE_SLEEP)) + *started = true; + } + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static const struct scmi_imx_cpu_proto_ops scmi_imx_cpu_proto_ops = { + .cpu_reset_vector_set = scmi_imx_cpu_reset_vector_set, + .cpu_start = scmi_imx_cpu_start, + .cpu_started = scmi_imx_cpu_started, + .cpu_stop = scmi_imx_cpu_stop, +}; + +static int scmi_imx_cpu_protocol_attributes_get(const struct scmi_protocol_handle *ph, + struct scmi_imx_cpu_info *info) +{ + struct scmi_msg_imx_cpu_protocol_attributes *attr; + struct scmi_xfer *t; + int ret; + + ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0, + sizeof(*attr), &t); + if (ret) + return ret; + + attr = t->rx.buf; + + ret = ph->xops->do_xfer(ph, t); + if (!ret) { + info->nr_cpu = SCMI_IMX_CPU_PROTO_ATTR_NUM_CPUS(attr->attributes); + dev_info(ph->dev, "i.MX SM CPU: %d cpus\n", + info->nr_cpu); + } + + ph->xops->xfer_put(ph, t); + + return ret; +} + +static int scmi_imx_cpu_attributes_get(const struct scmi_protocol_handle *ph, + u32 cpuid, struct scmi_imx_cpu_info *info) +{ + struct scmi_msg_imx_cpu_attributes_out *out; + struct scmi_xfer *t; + int ret; + + ret = ph->xops->xfer_get_init(ph, SCMI_IMX_CPU_ATTRIBUTES, sizeof(u32), 0, &t); + if (ret) + return ret; + + put_unaligned_le32(cpuid, t->tx.buf); + ret = ph->xops->do_xfer(ph, t); + if (!ret) { + out = t->rx.buf; + dev_info(ph->dev, "i.MX CPU: name: %s\n", out->name); + } else { + dev_err(ph->dev, "i.MX cpu: Failed to get info of cpu(%u)\n", cpuid); + } + + ph->xops->xfer_put(ph, t); + + return ret; +} + + +static int scmi_imx_cpu_protocol_init(const struct scmi_protocol_handle *ph) +{ + struct scmi_imx_cpu_info *info; + u32 version; + int ret, i; + + ret = ph->xops->version_get(ph, &version); + if (ret) + return ret; + + dev_info(ph->dev, "NXP SM CPU Protocol Version %d.%d\n", + PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + + info = devm_kzalloc(ph->dev, sizeof(*info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + ret = scmi_imx_cpu_protocol_attributes_get(ph, info); + if (ret) + return ret; + + for (i = 0; i < info->nr_cpu; i++) { + ret = scmi_imx_cpu_attributes_get(ph, i, info); + if (ret) + return ret; + } + + return ph->set_priv(ph, info, version); +} + +static const struct scmi_protocol scmi_imx_cpu = { + .id = SCMI_PROTOCOL_IMX_CPU, + .owner = THIS_MODULE, + .instance_init = &scmi_imx_cpu_protocol_init, + .ops = &scmi_imx_cpu_proto_ops, + .supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION, + .vendor_id = SCMI_IMX_VENDOR, + .sub_vendor_id = SCMI_IMX_SUBVENDOR, +}; +module_scmi_protocol(scmi_imx_cpu); + +MODULE_DESCRIPTION("i.MX SCMI CPU driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/scmi_imx_protocol.h b/include/linux/scmi_imx_protocol.h index 456559f021696ae51f40ed11e6f85089d430ce71..6521199cdab67c7e751e850def221d89898cd0f2 100644 --- a/include/linux/scmi_imx_protocol.h +++ b/include/linux/scmi_imx_protocol.h @@ -16,6 +16,7 @@ #define SCMI_PROTOCOL_IMX_LMM 0x80 #define SCMI_PROTOCOL_IMX_BBM 0x81 +#define SCMI_PROTOCOL_IMX_CPU 0x82 #define SCMI_PROTOCOL_IMX_MISC 0x84 #define SCMI_IMX_VENDOR "NXP" @@ -86,4 +87,13 @@ struct scmi_imx_lmm_proto_ops { u32 flags); }; +struct scmi_imx_cpu_proto_ops { + int (*cpu_reset_vector_set)(const struct scmi_protocol_handle *ph, + u32 cpuid, u64 vector, bool start, + bool boot, bool resume); + int (*cpu_start)(const struct scmi_protocol_handle *ph, u32 cpuid); + int (*cpu_started)(const struct scmi_protocol_handle *ph, u32 cpuid, + bool *started); + int (*cpu_stop)(const struct scmi_protocol_handle *ph, u32 cpuid); +}; #endif From patchwork Tue Jan 21 15:08:13 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: 13946403 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2085.outbound.protection.outlook.com [40.107.103.85]) (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 B389B1F3FD2 for ; Tue, 21 Jan 2025 15:09:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737472149; cv=fail; b=dRHvyY4US9YyoQsgr7yWrs0PLFrmXEbs8huEV9IZ3uTIFBs3pPV75IVZhzcaDWiEsmNGw0glGkZfrfrknRLWow5xvFQ6WWlPVEOkfBFv/wjhHJn00Q5uAJgPIY2nOrtVktZb/NMFRC4bDrRSHhid2ynx4ab8lwbudzTbey7QkPg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737472149; c=relaxed/simple; bh=QJIKfl0mXBhxX6voMTkPVP1lJTY6KSu7ej3OjfpObLA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=O1HZ8f7tYijOqIYITif9JXrEjWdNj67SEHA83n40m3Z6AM+HPu+yOkLLv7JUa5G9ed6Wk+DHofRMqU5JB1XElMlrbPckUkl73hbTtgYrN+S+uE0fQoppqGxLWbyNkab5QRRwBpKhy6+VXf3pN4pQ8+aHCXdW26t0h8V8PbSAB7M= 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=RH8fbHo2; arc=fail smtp.client-ip=40.107.103.85 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="RH8fbHo2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yvxRrHY9fzuNzZ1K6tbC5sT5fqf7O/Hz8lYJKLUhL+Ze+1yl6fFkLukDhXlwZb2E2u+JJAR7vfXylCxS/t1Ry02sdWyVwhdUu6guYLkVbbEVyCFh3W9bzakB/HHYEI/Loshl0IFZhJz2FZ5VAyp8lvPYnx7zcvH35q1VccUXA9/V/onC716sEzE7DZzMdcVdWv0bULjfQ8j9dmZk3ZM+/mkhX2vySEvPmsF/wiYgdunGEWcqOBKxkDOMXwO3GHLhlUBS6nnkTct20+NPpGqKSXgOgm4EYhcQT+0EmVtobWWY2sj4Y8s0otML/IhcFyIzkhAi0yHhV30XDJHWXrwIJw== 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=pM9zzB6aeAwddWUvYjRSsDj4sKVB+qMmWDZSrT1KnH0=; b=MnZyB6RvOehfhRGX9PTInrEiCr/rufyIK+uW6WhBTHVQ2adqYSY4UBD9DrQPMdjdXqIvrwdu0fcwlVBgG0nLz9KaMZ8E225bwd33SE13hWfJBuP0TPvt1yr9N5R1RGd7XXIx02pRwO2X8cxykuo13sAAByA1avVVeOJcZJTx1npLzfj3jnaHPB+ElGM17shAK4keS2CT/ByLW5/U/DTOiJBrG/XYvIZ1kcpsVnYNhFc7emQy2Q2IJwdHvD5sb9CfDo2oS92cIXwXPJS2u0DO9IRfV6ycRDBYSuyifwWMxTkBOBYNbdDBXuBuwSaBJXzTrFw6mHqV1oS07uyaQ0WOjA== 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=pM9zzB6aeAwddWUvYjRSsDj4sKVB+qMmWDZSrT1KnH0=; b=RH8fbHo2aI70KsCWzIW+KQWhybrji8Ilq54KO653IlFgbWL0Igb1zDbGGhz3vNNuX32rw0rq8V4q1Q8WWvOh7Y+dEnW62mS5ztY+QxY/vgsRykULaFbkDjLV8TBXXzNvHS4kU3NTuiRzemayeyJ2d8s6NCS+lCnE8SOzukOgvIJUrCTk487uWJvSLDe87cOA4ztXsSj+n13aN+ikCun48hkiKgbRfLUL30FJVLtNdd84f+e5seYUQ6/v0jH4FrDjhE7aKNPVXkuqgAf0kVZtRo/9sisodvi7Loweu2jUpCVF6VtPT0JTKJbuaTuLm7ISRYp1ScwMSdc6MEm4Ln0ziQ== 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 AM7PR04MB6853.eurprd04.prod.outlook.com (2603:10a6:20b:107::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.22; Tue, 21 Jan 2025 15:09:05 +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:05 +0000 From: "Peng Fan (OSS)" Date: Tue, 21 Jan 2025 23:08:13 +0800 Subject: [PATCH 3/5] firmware: arm_scmi: imx: Add LMM and CPU documentation Message-Id: <20250121-imx-lmm-cpu-v1-3-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=44537; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=MeSuPpktTf9tUfV5LgTrNjhdwrtDpTgMVUPHLUYTFZg=; b=hGGv9RCRuj0KxgrY25QsXTQ6+xyybISfTDk+wF5T0IM4Iu+WbznPQxdPx0tWz8oEZtWy7/xJq LA02ZvU9yQ2Apq3GDPJDKujzlPUIslsFw12VJt4v/UDv06zjSUq3c50 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_|AM7PR04MB6853:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bf9d842-2614-4cef-2234-08dd3a2d8beb 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|366016|376014|52116014|7416014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vrfHnF1sGAAfFLXDLSLbyAe0sOsDlit?= =?utf-8?q?s7Z09vpZ5VI6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Oa7cARUZV7tb9B6EfaogPFr3NkyfTgmu89SVRYGjCxtFqz5p8SF?= =?utf-8?q?zA0Dj4ZldDLKwX/szQXfq2u1KqxOTYwofHySf+BQqg0bD+xT5ggsJGtx9jLD7/LrZ?= =?utf-8?q?jnqBjAc17XjL1quevxW4J0bqBesfythcgbX50IuQoLnEyGp3PzJE1KhsMp2gMUGB+?= =?utf-8?q?OWSaA9ox6Ese41eHbLGPyFGvlgaOL4XhwGCEDCB6acSAjyeBtbL889DdQBqZwPfjn?= =?utf-8?q?QGtRehjz7nWX5Zv845tgZW9+OQrGZgF0tvQ1O3B08TRwxhONoeZJmx2s7dET0boQk?= =?utf-8?q?3l7v0L8alLk96nrAenO2td+P3JGfAesvufNa3TqwFAURSGNpM6qPzAR8Dh2kxFV5p?= =?utf-8?q?1Q5T6mZBSeu2Dw91MI29O2MqCh0fgcDdVip7UaZIWYBNttK7MugR0bYAIfwVXL3gR?= =?utf-8?q?xt0rKtOCMe2K21f4+eu91mGI5e0bIq47RUl2BMTNrKNtvejMgaX3+FQRmPgRO2jGc?= =?utf-8?q?DXddry+0Tm2?= 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)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?59kxIEDYem1UfsrIcZ6kojPsV3mu?= =?utf-8?q?m1B/anzfNbczIIEDGb9WmFX7DwoYL5fmtDwK7EKEk4EWW5WKFNld0L4XG+y6LM8dH?= =?utf-8?q?qrVZm1hoxXTK2bbrKTkJSkRvDuw7lAbVULvGuyXghQtGK1UoLGWczr72noUlY2+5q?= =?utf-8?q?u+9nB0XS1rMfLlXb9e4sTksRi0rSAFPF89OoCNeMRUrDp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MBKW76GyWWE?= =?utf-8?q?T6eRltElLnfW2V7pb8PSZjTYLM6UbCc5yTmIdBgjwccrHo3jTX09/7SUbq8V4wsxN?= =?utf-8?q?WJO7nxWzL+erMxThY7u7+Ln/Lzr/Kxb4hY7eWQenYz+jSfSPxQvevn2+FCTX3pqdk?= =?utf-8?q?rNw+xmTHJ+fn6LZUYyrZj8WgGYa/eNGexOF+wySCHLSfE4DVthPFHJ2tolTSQVGvk?= =?utf-8?q?0gJAHDkyklznNAzYVznaoNSu/YChmMx0P2EpUAGBOPi+3kCZdRyzdWVPXPg0cqSTt?= =?utf-8?q?i8TrJyRly5yQeE1CKZOeTBNEtJ+YjeqkzjlMkrQhLKbJvhn+n+M6hh8ODbg8a0RMl?= =?utf-8?q?tOHcq+lhm9wRPowMmdBlVMNN6noMuq0uttZVqBZPD1qlhUJK2y6klTbaU1BnizEKK?= =?utf-8?q?VTndG1IHACdluXAuHbAwyA+moJEaZi1MvUYWZsraBWeTjk68q57cwM3dXj5SQKh4F?= =?utf-8?q?/PHJfzNOfywK?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bf9d842-2614-4cef-2234-08dd3a2d8beb 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:05.4121 (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: l7wRpy7ARyLloarJA2g2Xh56Cb3wl8+c29kAdzWiNLNLUWal3GO8xYoIr9FaB3H/CGZeg6F2w0KexYzhDpqsTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6853 From: Peng Fan Add i.MX95 Logical Machine Management and CPU Protocol documentation. Signed-off-by: Peng Fan --- drivers/firmware/arm_scmi/vendors/imx/imx95.rst | 692 ++++++++++++++++++++++++ 1 file changed, 692 insertions(+) diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx95.rst b/drivers/firmware/arm_scmi/vendors/imx/imx95.rst index b2dfd6c46ca2f5f12f0475c24cb54c060e9fa421..384d4f9c27e489a9c54cdde79c9f03a6f5979630 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx95.rst +++ b/drivers/firmware/arm_scmi/vendors/imx/imx95.rst @@ -32,6 +32,419 @@ port, and deploy the SM on supported processors. The SM implements an interface compliant with the Arm SCMI Specification with additional vendor specific extensions. +SCMI_LMM: System Control and Management Logical Machine Management Vendor Protocol +================================================================================== + +This protocol is intended for boot, shutdown, and reset of other logical +machines (LM). It is usually used to allow one LM to manager another used +as an offload or accelerator engine. Notifications from this protocol can +also be used to manage a communication link to another LM. The LMM protocol +provides functions to: + +- Describe the protocol version. +- Discover implementation attributes. +- Discover the LMs defined in the system. +- Boot an LM. +- Shut down an LM. +- Reset an LM. +- Wake an LM from suspend. +- Suspend an LM (gracefully). +- Request a graceful shutdown or reset of an LM. +- Allow an agent to forcibly power down or reset an LM. +- Read boot/shutdown/reset information for an LM. +- Get notifications when an LM boots or shuts down. + +Commands: +_________ + +PROTOCOL_VERSION +~~~~~~~~~~~~~~~~ + +message_id: 0x0 +protocol_id: 0x80 + ++---------------+--------------------------------------------------------------+ +|Return values | ++---------------+--------------------------------------------------------------+ +|Name |Description | ++---------------+--------------------------------------------------------------+ +|int32 status | See ARM SCMI Specification for status code definitions. | ++---------------+--------------------------------------------------------------+ +|uint32 version | For this revision of the specification, this value must be | +| | 0x10000. | ++---------------+--------------------------------------------------------------+ + +PROTOCOL_ATTRIBUTES +~~~~~~~~~~~~~~~~~~~ + +message_id: 0x1 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status | See ARM SCMI Specification for status code definitions. | ++------------------+-----------------------------------------------------------+ +|uint32 attributes |Protocol attributes: | +| |Bits[31:8] Reserved, must be zero. | +| |Bits[7:0] Number of Logical Machines | ++------------------+-----------------------------------------------------------+ + +PROTOCOL_MESSAGE_ATTRIBUTES +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +message_id: 0x2 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: in case the message is implemented and available | +| |to use. | +| |NOT_FOUND: if the message identified by message_id is | +| |invalid or not implemented | ++------------------+-----------------------------------------------------------+ +|uint32 attributes |Flags that are associated with a specific function in the | +| |protocol. For all functions in this protocol, this | +| |parameter has a value of 0 | ++------------------+-----------------------------------------------------------+ + +LMM_ATTRIBUTES +~~~~~~~~~~~~~~ + +message_id: 0x3 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 lmid |ID of the Logical Machine | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if valid attributes are returned. | +| |NOT_FOUND: if lmId not points to a valid logical machine. | +| |DENIED: if the agent does not have permission to get info | +| |for the LM specified by lmid. | ++------------------+-----------------------------------------------------------+ + +LMM_BOOT +~~~~~~~~ + +message_id: 0x4 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 lmid |ID of the Logical Machine | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if LM successfully booted. | +| |NOT_FOUND: if lmId not points to a valid logical machine. | +| |INVALID_PARAMETERS: if lmId is same as the caller. | +| |DENIED: if the agent does not have permission to manage the| +| |the LM specified by lmid. | ++------------------+-----------------------------------------------------------+ + +LMM_RESET +~~~~~~~~~ + +message_id: 0x5 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 lmid |ID of the Logical Machine | ++------------------+-----------------------------------------------------------+ +|uint32 flags |Reset flags: | +| |Bits[31:1] Reserved, must be zero. | +| |Bit[0] Graceful request: | +| |Set to 1 if the request is a graceful request. | +| |Set to 0 if the request is a forceful request. | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if LM successfully resets. | +| |NOT_FOUND: if lmId not points to a valid logical machine. | +| |INVALID_PARAMETERS: if lmId is same as the caller. | +| |DENIED: if the agent does not have permission to manage the| +| |the LM specified by lmid. | ++------------------+-----------------------------------------------------------+ + +LMM_SHUTDOWN +~~~~~~~~~~~~ + +message_id: 0x6 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 lmid |ID of the Logical Machine | ++------------------+-----------------------------------------------------------+ +|uint32 flags |Reset flags: | +| |Bits[31:1] Reserved, must be zero. | +| |Bit[0] Graceful request: | +| |Set to 1 if the request is a graceful request. | +| |Set to 0 if the request is a forceful request. | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if LM successfully shutdowns. | +| |NOT_FOUND: if lmId not points to a valid logical machine. | +| |INVALID_PARAMETERS: if lmId is same as the caller. | +| |DENIED: if the agent does not have permission to manage the| +| |the LM specified by lmid. | ++------------------+-----------------------------------------------------------+ + +LMM_WAKE +~~~~~~~~ + +message_id: 0x7 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 lmid |ID of the Logical Machine | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if LM successfully wakes. | +| |NOT_FOUND: if lmId not points to a valid logical machine. | +| |INVALID_PARAMETERS: if lmId is same as the caller. | +| |DENIED: if the agent does not have permission to manage the| +| |the LM specified by lmid. | ++------------------+-----------------------------------------------------------+ + +LMM_SUSPEND +~~~~~~~~~~~ + +message_id: 0x8 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 lmid |ID of the Logical Machine | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if LM successfully suspends. | +| |NOT_FOUND: if lmId not points to a valid logical machine. | +| |INVALID_PARAMETERS: if lmId is same as the caller. | +| |DENIED: if the agent does not have permission to manage the| +| |the LM specified by lmid. | ++------------------+-----------------------------------------------------------+ + +LMM_NOTIFY +~~~~~~~~~~ + +message_id: 0x9 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 lmid |ID of the Logical Machine | ++------------------+-----------------------------------------------------------+ +|uint32 flags |Notification flags: | +| |Bits[31:3] Reserved, must be zero. | +| |Bit[3] Wake (resume) notification: | +| |Set to 1 to send notification. | +| |Set to 0 if no notification. | +| |Bit[2] Suspend (sleep) notification: | +| |Set to 1 to send notification. | +| |Set to 0 if no notification. | +| |Bit[1] Shutdown (off) notification: | +| |Set to 1 to send notification. | +| |Set to 0 if no notification. | +| |Bit[0] Boot (on) notification: | +| |Set to 1 to send notification. | +| |Set to 0 if no notification | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if the notification state successfully updated. | +| |NOT_FOUND: if lmId not points to a valid logical machine. | +| |INVALID_PARAMETERS: if input attributes flag specifies | +| |unsupported or invalid configurations. | +| |DENIED: if the agent does not have permission to request | +| |the notification. | ++------------------+-----------------------------------------------------------+ + +LMM_RESET_REASON +~~~~~~~~~~~~~~~~ + +message_id: 0xA +protocol_id: 0x80 + ++---------------------+--------------------------------------------------------+ +|Parameters | ++---------------------+--------------------------------------------------------+ +|Name |Description | ++---------------------+--------------------------------------------------------+ +|uint32 lmid |ID of the Logical Machine | ++---------------------+--------------------------------------------------------+ +|Return values | ++---------------------+--------------------------------------------------------+ +|Name |Description | ++---------------------+--------------------------------------------------------+ +|int32 status |SUCCESS: if LM successfully suspends. | +| |NOT_FOUND: if lmId not points to a valid logical machine| +| |DENIED: if the agent does not have permission to request| +| |the reset reason. | ++---------------------+--------------------------------------------------------+ +|uint32 bootflags |Boot reason flags. This parameter has the format: | +| |Bits[31] Valid. | +| |Set to 1 if the entire reason is valid. | +| |Set to 0 if the entire reason is not valid. | +| |Bits[30:29] Reserved, must be zero. | +| |Bit[28] Valid origin: | +| |Set to 1 if the origin field is valid. | +| |Set to 0 if the origin field is not valid. | +| |Bits[27:24] Origin. | +| |Bit[23] Valid err ID: | +| |Set to 1 if the error ID field is valid. | +| |Set to 0 if the error ID field is not valid. | +| |Bits[22:8] Error ID. | +| |Bit[7:0] Reason | ++---------------------+--------------------------------------------------------+ +|uint32 shutdownflags |Shutdown reason flags. This parameter has the format: | +| |Bits[31] Valid. | +| |Set to 1 if the entire reason is valid. | +| |Set to 0 if the entire reason is not valid. | +| |Bits[30:29] Number of valid extended info words. | +| |Bit[28] Valid origin: | +| |Set to 1 if the origin field is valid. | +| |Set to 0 if the origin field is not valid. | +| |Bits[27:24] Origin. | +| |Bit[23] Valid err ID: | +| |Set to 1 if the error ID field is valid. | +| |Set to 0 if the error ID field is not valid. | +| |Bits[22:8] Error ID. | +| |Bit[7:0] Reason | ++---------------------+--------------------------------------------------------+ +|uint32 extinfo[0,20] |Array of extended info words | ++---------------------+--------------------------------------------------------+ + +LMM_POWER_ON +~~~~~~~~~~~~ + +message_id: 0xB +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 lmid |ID of the Logical Machine | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if LM successfully suspends. | +| |NOT_FOUND: if lmId not points to a valid logical machine. | +| |INVALID_PARAMETERS: if lmId is same as the caller. | +| |DENIED: if the agent does not have permission to manage the| +| |the LM specified by lmid. | ++------------------+-----------------------------------------------------------+ + +NEGOTIATE_PROTOCOL_VERSION +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +message_id: 0x10 +protocol_id: 0x80 + ++--------------------+---------------------------------------------------------+ +|Parameters | ++--------------------+---------------------------------------------------------+ +|Name |Description | ++--------------------+---------------------------------------------------------+ +|uint32 version |The negotiated protocol version the agent intends to use | ++--------------------+---------------------------------------------------------+ +|Return values | ++--------------------+---------------------------------------------------------+ +|Name |Description | ++--------------------+---------------------------------------------------------+ +|int32 status |SUCCESS: if the negotiated protocol version is supported | +| |by the platform. All commands, responses, and | +| |notifications post successful return of this command must| +| |comply with the negotiated version. | +| |NOT_SUPPORTED: if the protocol version is not supported. | ++--------------------+---------------------------------------------------------+ + +Notifications +_____________ + +LMM_EVENT +~~~~~~~~~ + +message_id: 0x0 +protocol_id: 0x80 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 lmid |Identifier for the LM that caused the transition. | ++------------------+-----------------------------------------------------------+ +|uint32 eventlm |Identifier for the LM the event is for. | ++------------------+-----------------------------------------------------------+ +|uint32 flags |LM events: | +| |Bits[31:3] Reserved, must be zero. | +| |Bit[3] Wake (resume) event: | +| |1 LM has awakened. | +| |0 not a wake event. | +| |Bit[2] Suspend (sleep) event: | +| |1 LM has suspended. | +| |0 not a suspend event. | +| |Bit[1] Shutdown (off) event: | +| |1 LM has shutdown. | +| |0 not a shutdown event. | +| |Bit[0] Boot (on) event: | +| |1 LM has booted. | +| |0 not a boot event. | ++------------------+-----------------------------------------------------------+ + SCMI_BBM: System Control and Management BBM Vendor Protocol ============================================================== @@ -436,6 +849,285 @@ protocol_id: 0x81 | |0 no button change detected. | +------------------+-----------------------------------------------------------+ +SCMI_CPU: System Control and Management CPU Vendor Protocol +============================================================== + +This protocol allows an agent to start or stop a CPU. It is used to manage +auxiliary CPUs in an LM (e.g. additional cores in an AP cluster), The CPU +protocol provides functions to: + +- Describe the protocol version. +- Discover implementation attributes. +- Discover the CPUs defined in the system. +- Start a CPU. +- Stop a CPU. +- Set the boot and resume addresses for a CPU. +- Set the sleep mode of a CPU. +- Configure wake-up sources for a CPU. +- Configure power domain reactions (LPM mode and retention mask) for a CPU. +- The CPU IDs can be found in the CPU section of the SoC DEVICE: SM Device + Interface. They can also be found in the SoC RM. See the CPU Mode Control + (CMC) list in General Power Controller (GPC) section. + +CPU settings are not aggregated and setting their state is normally exclusive +to one client. + +Commands: +_________ + +PROTOCOL_VERSION +~~~~~~~~~~~~~~~~ + +message_id: 0x0 +protocol_id: 0x82 + ++---------------+--------------------------------------------------------------+ +|Return values | ++---------------+--------------------------------------------------------------+ +|Name |Description | ++---------------+--------------------------------------------------------------+ +|int32 status | See ARM SCMI Specification for status code definitions. | ++---------------+--------------------------------------------------------------+ +|uint32 version | For this revision of the specification, this value must be | +| | 0x10000. | ++---------------+--------------------------------------------------------------+ + +PROTOCOL_ATTRIBUTES +~~~~~~~~~~~~~~~~~~~ + +message_id: 0x1 +protocol_id: 0x82 + ++---------------+--------------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status | See ARM SCMI Specification for status code definitions. | ++------------------+-----------------------------------------------------------+ +|uint32 attributes |Protocol attributes: | +| |Bits[31:16] Reserved, must be zero. | +| |Bits[15:0] Number of CPUs | ++------------------+-----------------------------------------------------------+ + +PROTOCOL_MESSAGE_ATTRIBUTES +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +message_id: 0x2 +protocol_id: 0x82 + ++---------------+--------------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: in case the message is implemented and available | +| |to use. | +| |NOT_FOUND: if the message identified by message_id is | +| |invalid or not implemented | ++------------------+-----------------------------------------------------------+ +|uint32 attributes |Flags that are associated with a specific function in the | +| |protocol. For all functions in this protocol, this | +| |parameter has a value of 0 | ++------------------+-----------------------------------------------------------+ + +CPU_ATTRIBUTES +~~~~~~~~~~~~~~ + +message_id: 0x4 +protocol_id: 0x82 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 cpuid |Identifier for the CPU | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if valid attributes are returned successfully. | +| |NOT_FOUND: if the cpuid is not valid. | ++------------------+-----------------------------------------------------------+ +|uint32 attributes |Bits[31:0] Reserved, must be zero | ++------------------+-----------------------------------------------------------+ +|char name[16] |NULL terminated ASCII string with CPU name up to 16 bytes | ++------------------+-----------------------------------------------------------+ + +CPU_START +~~~~~~~~~ + +message_id: 0x4 +protocol_id: 0x82 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 cpuid |Identifier for the CPU | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if the cpu is started successfully. | +| |NOT_FOUND: if cpuid is not valid. | +| |DENIED: the calling agent is not allowed to start this CPU.| ++------------------+-----------------------------------------------------------+ + +CPU_STOP +~~~~~~~~ + +message_id: 0x5 +protocol_id: 0x82 + ++------------------+-----------------------------------------------------------+ +|Parameters | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|uint32 cpuid |Identifier for the CPU | ++------------------+-----------------------------------------------------------+ +|Return values | ++------------------+-----------------------------------------------------------+ +|Name |Description | ++------------------+-----------------------------------------------------------+ +|int32 status |SUCCESS: if the cpu is started successfully. | +| |NOT_FOUND: if cpuid is not valid. | +| |DENIED: the calling agent is not allowed to stop this CPU. | ++------------------+-----------------------------------------------------------+ + +CPU_RESET_VECTOR_SET +~~~~~~~~~~~~~~~~~~~~ + +message_id: 0x6 +protocol_id: 0x82 + ++----------------------+-------------------------------------------------------+ +|Parameters | ++----------------------+-------------------------------------------------------+ +|Name |Description | ++----------------------+-------------------------------------------------------+ +|uint32 cpuid |Identifier for the CPU | ++----------------------+-------------------------------------------------------+ +|uint32 flags |Reset vector flags: | +| |Bit[31] Resume flag. | +| |Set to 1 to update the reset vector used on resume. | +| |Bit[30] Boot flag. | +| |Set to 1 to update the reset vector used for boot. | +| |Bits[29:1] Reserved, must be zero. | +| |Bit[0] Table flag. | +| |Set to 1 if vector is the vector table base address. | ++----------------------+-------------------------------------------------------+ +|uint32 resetVectorLow |Lower vector: | +| |If bit[0] of flags is 0, the lower 32 bits of the | +| |physical address where the CPU should execute from on | +| |reset. If bit[0] of flags is 1, the lower 32 bits of | +| |the vector table base address | ++----------------------+-------------------------------------------------------+ +|uint32 resetVectorhigh|Upper vector: | +| |If bit[0] of flags is 0, the upper 32 bits of the | +| |physical address where the CPU should execute from on | +| |reset. If bit[0] of flags is 1, the upper 32 bits of | +| |the vector table base address | ++----------------------+-------------------------------------------------------+ +|Return values | ++----------------------+-------------------------------------------------------+ +|Name |Description | ++----------------------+-------------------------------------------------------+ +|int32 status |SUCCESS: if the CPU reset vector is set successfully. | +| |NOT_FOUND: if cpuId does not point to a valid CPU. | +| |INVALID_PARAMETERS: the requested vector type is not | +| |supported by this CPU. | +| |DENIED: the calling agent is not allowed to set the | +| |reset vector of this CPU | ++----------------------+-------------------------------------------------------+ + +CPU_SLEEP_MODE_SET +~~~~~~~~~~~~~~~~~~ +message_id: 0x7 +protocol_id: 0x82 + ++----------------------+-------------------------------------------------------+ +|Parameters | ++----------------------+-------------------------------------------------------+ +|Name |Description | ++----------------------+-------------------------------------------------------+ +|uint32 cpuid |Identifier for the CPU | ++----------------------+-------------------------------------------------------+ +|uint32 flags |Sleep mode flags: | +| |Bits[31:1] Reserved, must be zero. | +| |Bit[0] IRQ mux: | +| |If set to 1 the wakeup mux source is the GIC, else if 0| +| |then the GPC | ++----------------------+-------------------------------------------------------+ +|uint32 sleepmode |target sleep mode | ++----------------------+-------------------------------------------------------+ +|Return values | ++----------------------+-------------------------------------------------------+ +|Name |Description | ++----------------------+-------------------------------------------------------+ +|int32 status |SUCCESS: if the CPU sleep mode is set successfully. | +| |NOT_FOUND: if cpuId does not point to a valid CPU. | +| |INVALID_PARAMETERS: the sleepmode or flags is invalid. | +| |DENIED: the calling agent is not allowed to configure | +| |the CPU | ++----------------------+-------------------------------------------------------+ + +CPU_INFO_GET +~~~~~~~~~~~~ +message_id: 0xC +protocol_id: 0x82 + ++----------------------+-------------------------------------------------------+ +|Parameters | ++----------------------+-------------------------------------------------------+ +|Name |Description | ++----------------------+-------------------------------------------------------+ +|uint32 cpuid |Identifier for the CPU | ++----------------------+-------------------------------------------------------+ +|Return values | ++----------------------+-------------------------------------------------------+ +|Name |Description | ++----------------------+-------------------------------------------------------+ +|int32 status |SUCCESS: if valid attributes are returned successfully.| +| |NOT_FOUND: if the cpuid is not valid. | ++----------------------+-------------------------------------------------------+ +|uint32 runmode |Run mode for the CPU | ++----------------------+-------------------------------------------------------+ +|uint32 sleepmode |Sleep mode for the CPU | ++----------------------+-------------------------------------------------------+ +|uint32 resetvectorlow |Reset vector low 32 bits for the CPU | ++----------------------+-------------------------------------------------------+ +|uint32 resetvecothigh |Reset vector high 32 bits for the CPU | ++----------------------+-------------------------------------------------------+ + +NEGOTIATE_PROTOCOL_VERSION +~~~~~~~~~~~~~~~~~~~~~~~~~~ +message_id: 0x10 +protocol_id: 0x82 + ++--------------------+---------------------------------------------------------+ +|Parameters | ++--------------------+---------------------------------------------------------+ +|Name |Description | ++--------------------+---------------------------------------------------------+ +|uint32 version |The negotiated protocol version the agent intends to use | ++--------------------+---------------------------------------------------------+ +|Return values | ++--------------------+---------------------------------------------------------+ +|Name |Description | ++--------------------+---------------------------------------------------------+ +|int32 status |SUCCESS: if the negotiated protocol version is supported | +| |by the platform. All commands, responses, and | +| |notifications post successful return of this command must| +| |comply with the negotiated version. | +| |NOT_SUPPORTED: if the protocol version is not supported. | ++--------------------+---------------------------------------------------------+ + SCMI_MISC: System Control and Management MISC Vendor Protocol ================================================================ From patchwork Tue Jan 21 15:08:14 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: 13946404 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 B987E1F4E3D for ; Tue, 21 Jan 2025 15:09:11 +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=1737472153; cv=fail; b=FCTDJo7R0uFrPVw/Z20SU3buBtnL6MJnR+1fF+Vm69cl1SXuFha+iYMYClL+VD2fWczUuGOEgkC3rsSzjaEYX/J8v55X3r7x4dk4FNz7oz1l7UCnykxJFGK9RAU4QobdvV8rMibOEUOjQvgaP5uUIjown8QZqjmHJ7c6xK/CNXo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737472153; c=relaxed/simple; bh=A8KFcxznUzISUtFjoYmFx7YIHgoPfid1nIeygdqZpVQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=AplgSHPq7rP+zTuo3in3Zb+0SZy0pp8aRPmWSNeJ/vdCwdtODrcWw62T7SIlwz3NVtoVp05f3OjHIoFwaAeIKeQ2kaaF5J5+A6D+FX3GvdjR9AEBjBHiFOXqGMpPGKh6ANEF+xIAWyoeRX7qIM9Gsh0kgviN6ghI78rrMcxmLhc= 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=m4wIXf4x; 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="m4wIXf4x" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wVmbk8n5rPV9vL5jnhhJ/GTjhu8Xr4KNNDlA0aHUVzCJ+aoZgvGh0loFawnCMRb4IgyMsHHMavSq6XmxGhhZBi98HKLPI++kGy0v31k+hlHYorXWybwfxKk/jd5NGOBlzvmBKj6daizFXmOVI0JoUjela0+CBLBZQvSxg//M4stZ6YUpeOrSnyHh3Xrb+w3yHbfK/CDtml1nMVjk/Ve0b4HvYpqxKJvjQbzfJDZb5eF9Fj49pdfVYKPq3wsOa54BzjVH71AVxe5kJkrrOsVC4DWkKU6Yo9ajv4Ouu3S6ofYauhgU/pKdk6Pz7otsaIQLuwTj2qgQAslc9r/T6v8YNA== 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=ZZ9i91hY2wdGGFd9lr+67VFRbzslwITiBU0BdhRV27E=; b=gzyad7Su0ALH5lAd51IfDVM6dJImDyJDXIkdvJGLrPzc1qwenlYEQX6N+CqHbaBxJFbRGxc5xwkoqmyQQcgB7qGzVNQGpMbG7xDjCGKgCX07IJ4iEiCiOwa3cHhbeKhA0WGF9SKjbxtruglfloI/KRVXhLsHDsBQAy0nTy3cMdF+pCkDIRlGJZsVeVQDpLEzJ5WqoqTc2HFpUI+8XRdG+yudvVwd+fBFN9l9boGMK/Ygft/6T2u6g/1R+NszBSoT1f4lhzmUMutJaAMmsyoBH5ejh3LqFlSFl7QaJiWaanldpnjV8UcbcG/UWyiC+U3m6jgNgSHRIgnMMHZDmYH+MA== 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=ZZ9i91hY2wdGGFd9lr+67VFRbzslwITiBU0BdhRV27E=; b=m4wIXf4x4i1YFca6jO0QBeXrVxz9Ai0SszbmTR/UsxuQn4EMVreHE7SBXd7AemiWmvN4v01kWP9mZnfToC9lcvZ3ykCmC2oGct+nSo7lJlqU5grOA13yeEeXXje75cSLDdhcjlnnblIkTGtEQiUMumfwYjxWkKIchJDqOhNtAZ0z1129On/MIQXpkvCQ0HAXOXXdU9iUORS8FaBIL6ADUbK2L+kLbB2u181fleyJ6PmZLxQjwagT9YiCYxphhA1bhPazOaGvJMaylT8lwIW6gyEFUKnpcbKd9aI1KylhHX59zb78+/2ycssa/qUpRjKeXSjCOWpwx8FbgfYU0Rm3EQ== 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:08 +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:08 +0000 From: "Peng Fan (OSS)" Date: Tue, 21 Jan 2025 23:08:14 +0800 Subject: [PATCH 4/5] firmware: imx: Add i.MX95 SCMI LMM driver Message-Id: <20250121-imx-lmm-cpu-v1-4-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=5418; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=H6PR1jfOvK3fWF4PM3Fm2KdY/Tt/8Cu8Eu3BQO8068s=; b=MCUwL7blskEQ105XVPvW+EbZ1ICwwg76wHkdgfsY20SPhG84GwPxwUmnJZylOTeyQgmpxrAsJ fkqCPo64A+bCcsWDzn/M90k3Ynca3hjIaBaMP8QsiB/mTfvgYfy4Rns 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: 6b09fcfd-9adc-4144-defe-08dd3a2d8dfd 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?qW4PTHBhoaojQv8pqaJGDCHU996JFhO?= =?utf-8?q?xLkjkF5UyJft2pxXhHw5jbxr3dAzX6WodrPm/3dWCayJ/7RMcHWznZ1nzegkd703E?= =?utf-8?q?DQHyrRtYbn3l46FWigR8lzgJgAyEnn8f89aN6Th7ZrhjWHnuoAqRgAMfPoLbk0GS5?= =?utf-8?q?MbWPSyACHy8ywPhJBgM1BoYTDVWdNz7tkZlqVmph1xluUELppkICZkvnnaDZsVa0v?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CHnNKUm/0+8QoYz9zqwCA/AAamCbyTbYnJSyHU0KWq4AWw41V/ePM4KK?= =?utf-8?q?ARN4dzCnWQiZbocYY5lt/04e1u3pQIkQQ9JpqLf5/FAe64x2XQoe9zR7bBZDB7Rpp?= =?utf-8?q?sdAUgvOq0CvotykuSiIw1u4DQvV5S2svCCLMkc4KgTeIWczpbqXcrtDipDg0M4D2I?= =?utf-8?q?ePJNMXYpig8p1ON4T4N0sb8lWLkz1l4yrFB+uptx7pB8ELCmnIAlahOxAN8ra7CIY?= =?utf-8?q?WkOkYhl+KU1/wgjxvVe2HHyuH5kixMYfAGChMbsh8vvZ4UqqDPRNfxTcljT2Wak/Y?= =?utf-8?q?OL7Rw0C9HWJ?= 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?glpkbC4sEtp+Y+gbRokBmRKTaZpu?= =?utf-8?q?ZyPPrfhW2yl850GBXwtK/YvApEYRkNzACURLfVJRtXn58odk4gvWeuqIoWxjk8cQf?= =?utf-8?q?zn4PdUCBoPSSEZoAa2Z6BNCPONBDNIyTqL44+cdtBvAn3+VvWjdYK81TNBNyU+Zmm?= =?utf-8?q?U8GRifuZtZvyzuMsUxVerwBeZUHljTofUKJl/fIDU0MvdmT/+prEaghWlB20/w1Oq?= =?utf-8?q?s8xH5Oud+Or86U/ka1MTAdYTMSwjAmOfsoSL2O7yqYWTVoyIPrQuerl3Uj8b72qkq?= =?utf-8?q?AlsoPhl93RnGCUWkHY2+7Q5DuQnscEMXrnG3zk2x0a99P1eG0WNQzz6vpVis1PuJL?= =?utf-8?q?WsY6SAtES6QmmusUlwMLa17MmK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zL4db7GmLjz6twSPYw9PJTe7m4zaHQ+2ttM2HJz/65Kv?= =?utf-8?q?33MoXZzjgHQVTK3MaKRtOPvknOb/icapgh28U3C2ujagW4CmiLLjHF1IaBLDkM1fV?= =?utf-8?q?RG42cqslYPmavKqBoxJjDeHghILV+QAGEnHp6mgNVXMM4l20YvA//Sdck1CBZpEad?= =?utf-8?q?A9/mgcuMThdSCD301pAF2Nr6zkFHtUTWdLX23Br3+X7gotMF6Uu9Tc4lyOSRYXJxQ?= =?utf-8?q?kRVbCi7KiollS9oHrLiT1+2CvcNfyu/bG9r4Gb4XpkAqReHN2y9S8U7i1IVG5ZDeO?= =?utf-8?q?Zz6DiDOIgbon?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b09fcfd-9adc-4144-defe-08dd3a2d8dfd 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:08.8208 (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: aAvS3lEoPyJLLnysl9qArsyf70evdcrZR4NeegnBu9vtauae1cyLPVT07+w6TVKOFNQNoz74hfwDgM0itJT+jA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7891 From: Peng Fan The i.MX95 System manager exports SCMI LMM protocol for linux to manage Logical Machines. The driver is to use the LMM Protocol interface to boot, shutdown a LM. Signed-off-by: Peng Fan --- drivers/firmware/imx/Kconfig | 11 +++++ drivers/firmware/imx/Makefile | 1 + drivers/firmware/imx/sm-lmm.c | 89 +++++++++++++++++++++++++++++++++++++++++ include/linux/firmware/imx/sm.h | 27 +++++++++++++ 4 files changed, 128 insertions(+) diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig index 907cd149c40a8b5f1b14c53e1c315ff4a28f32ac..c3e344d6ecc645df1f0e3ee8078934c47f347fd7 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_LMM_DRV + tristate "IMX SCMI LMM Protocol driver" + depends on IMX_SCMI_LMM_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 Logical Machine management features. + + This driver can also be built as a module. + config IMX_SCMI_MISC_DRV tristate "IMX SCMI MISC Protocol driver" default y if ARCH_MXC diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile index 8d046c341be878bb6dd1e6277992ff66ae90e292..7762855d2a771169d4f1867d27e0d51be7c9ad03 100644 --- a/drivers/firmware/imx/Makefile +++ b/drivers/firmware/imx/Makefile @@ -2,3 +2,4 @@ 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_MISC_DRV} += sm-misc.o +obj-${CONFIG_IMX_SCMI_LMM_DRV} += sm-lmm.o diff --git a/drivers/firmware/imx/sm-lmm.c b/drivers/firmware/imx/sm-lmm.c new file mode 100644 index 0000000000000000000000000000000000000000..91a504e7f0d99089d3c2250a7918fb2fe99e991d --- /dev/null +++ b/drivers/firmware/imx/sm-lmm.c @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2025 NXP + */ + +#include +#include +#include +#include +#include +#include + +static const struct scmi_imx_lmm_proto_ops *imx_lmm_ops; +static struct scmi_protocol_handle *ph; + +int scmi_imx_lmm_boot(u32 lmid) +{ + if (!ph) + return -EPROBE_DEFER; + + return imx_lmm_ops->lmm_boot(ph, lmid); +}; +EXPORT_SYMBOL(scmi_imx_lmm_boot); + +int scmi_imx_lmm_info(u32 lmid, struct scmi_imx_lmm_info *info) +{ + if (!ph) + return -EPROBE_DEFER; + + if (!info) + return -EINVAL; + + return imx_lmm_ops->lmm_info(ph, lmid, info); +}; +EXPORT_SYMBOL(scmi_imx_lmm_info); + +int scmi_imx_lmm_power_on(u32 lmid) +{ + if (!ph) + return -EPROBE_DEFER; + + return imx_lmm_ops->lmm_power_on(ph, lmid); +}; +EXPORT_SYMBOL(scmi_imx_lmm_power_on); + +int scmi_imx_lmm_shutdown(u32 lmid, u32 flags) +{ + if (!ph) + return -EPROBE_DEFER; + + return imx_lmm_ops->lmm_shutdown(ph, lmid, flags); +}; +EXPORT_SYMBOL(scmi_imx_lmm_shutdown); + +static int scmi_imx_lmm_probe(struct scmi_device *sdev) +{ + const struct scmi_handle *handle = sdev->handle; + + if (!handle) + return -ENODEV; + + if (imx_lmm_ops) { + dev_err(&sdev->dev, "lmm already initialized\n"); + return -EEXIST; + } + + imx_lmm_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_IMX_LMM, &ph); + if (IS_ERR(imx_lmm_ops)) + return PTR_ERR(imx_lmm_ops); + + return 0; +} + +static const struct scmi_device_id scmi_id_table[] = { + { SCMI_PROTOCOL_IMX_LMM, "imx-lmm" }, + { }, +}; +MODULE_DEVICE_TABLE(scmi, scmi_id_table); + +static struct scmi_driver scmi_imx_lmm_driver = { + .name = "scmi-imx-lmm", + .probe = scmi_imx_lmm_probe, + .id_table = scmi_id_table, +}; +module_scmi_driver(scmi_imx_lmm_driver); + +MODULE_AUTHOR("Peng Fan "); +MODULE_DESCRIPTION("IMX SM LMM driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/firmware/imx/sm.h b/include/linux/firmware/imx/sm.h index 9b85a3f028d1b0a5287b453eb3ad8412a363fe6c..1e58ffaa81acd757d9e6a992a2f2df663681c08a 100644 --- a/include/linux/firmware/imx/sm.h +++ b/include/linux/firmware/imx/sm.h @@ -8,6 +8,7 @@ #include #include +#include #include #define SCMI_IMX_CTRL_PDM_CLK_SEL 0 /* AON PDM clock sel */ @@ -20,4 +21,30 @@ 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_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); +int scmi_imx_lmm_power_on(u32 lmid); +int scmi_imx_lmm_shutdown(u32 lmid, u32 flags); +#else +static inline int scmi_imx_lmm_boot(u32 lmid) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_lmm_info(u32 lmid, struct scmi_imx_lmm_info *info) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_lmm_power_on(u32 lmid) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_lmm_shutdown(u32 lmid, u32 flags) +{ + return -EOPNOTSUPP; +} +#endif #endif 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?FG3cvVotpP8K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bG4WzG59WZ0L0gqTQJ+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?rK0ZqlTiRYrMkvO1lcv1h7F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G9jW9q1xCQ3/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);