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: 13946422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11613C0218B for ; Tue, 21 Jan 2025 15:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZZ9i91hY2wdGGFd9lr+67VFRbzslwITiBU0BdhRV27E=; b=I5MdVMfOykvMvSBO4lqYCh/rEu hSTiACzuER/FSuycrBogpEGUfvJon0ihE76A4nJZJ+ePExrvMGOe9h3ba9uhvtMjdOQ6D9S6TLS9B 3tGzvwz4g+uFbOQUX2dUjHaVmjMHQQcgis5nmpokyfsGtSJqG6itBZIONhKXTRPe54IwFFT+4NjgI 3NcuZnNpjfpvxwiTrw+Da2DrPsE7HFaKEbccGujuXtvMGpIpRx2TA/i0aVjnCY5jotEV9gZptKNkB PIkKOp2YbQacGfDBcc25daNIvHctA9uGaMjgCtrn3Z/WBkLXCXvTjeErUJ/zZ9j958rvfS7uXeaYI U4cB9Rvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1taG16-00000008CEO-1r9H; Tue, 21 Jan 2025 15:18:12 +0000 Received: from mail-am7eur03on20601.outbound.protection.outlook.com ([2a01:111:f403:260e::601] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1taFsO-00000008AqX-1Ds0 for linux-arm-kernel@lists.infradead.org; Tue, 21 Jan 2025 15:09:13 +0000 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) 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?= =?utf-8?q?okedqMEqKRh8Zk3UZJQDY37sdXkoHSG6WOhso36INC8XrZURvXjS2EnzoyDx/MuaN?= =?utf-8?q?lRx2GogqXvgAj3DRLBoxZHHXatWyC4SpXetKcrXaPw0bKlUzkddAcaruRmgmCwLzA?= =?utf-8?q?+OSLREsuQW7PCb9CsWW/f+bTZh/08A2e5QLO9Uuwk+XgGPp9Ryz4ZxBVu+t/Li0x2?= =?utf-8?q?9fJi0qL3oCMM0nJDKqRoL5XSiDniOy95ot05CeBl7iJBwA4k3ZccIFEn57CmT1bZB?= =?utf-8?q?xNr5lNsLsnW3hSAeV9tdpQgILS9y6nd7CMEurdujT15Nx/72fbo6AuQSbAKu11g8t?= =?utf-8?q?2AsIK1pGDPo39GPezWImbwJWdb2/ckmkmiupg07oIYMM+LqvSeErEUZJSbghwo2oK?= =?utf-8?q?TYtIgyBILjXuW+U6e7eZBEQZagG1+ng8uWXWq10wb+rv3SIC9Ykch7i3zgsrmm7+h?= =?utf-8?q?lx+iOppn7rP6B5Utj8dpgsA+eywklRV11CXdqjWjKOynpgRFQ+OgUUiblItH3SvD0?= =?utf-8?q?eFGOZ2fc9hDb13iyiGroNF+e/Ken0ZzLQGln55DU6W18uP6QaZypXlmp9Hp1xHb79?= =?utf-8?q?DpvfjgY9KAHtZtVZ9M6tbpOVfSzTBviBHGKuazfE4sdOG/s0uZt358Mu8kuDVpCl5?= =?utf-8?q?+9LkNhM111i9L0OzH9p1Pn6+PfRxa9CuSMv0LamE3EETF0FQ+3gMGUV2HciOu45/S?= =?utf-8?q?hdQStc0gqt4vuV590Hw28fnFVu9UgCOY/GInwHhBcZtm5cT0gumrfd34XZm1eH4Qf?= =?utf-8?q?NOAo75LMbE3/J05ody+yBOs3DsHrKXufdfhUF0MP5YhgkLM1nFWokqpqddmLU1is5?= =?utf-8?q?vdCjjgQJKfgRiddkMDZ9bRrO/vUkZGW0pvQD8quakfObnG8Z6HslIq4Gaw5UtvzWF?= =?utf-8?q?3r0bWRqhWCHnNKUm/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+KUQX/mjgHd3T4/ndM1o/LnUPdAFk+/H8CvlK6H?= =?utf-8?q?KALzEas1dy/vpV+/JguRkLWWo5U5o7Jf2C4xKCW8nnoEEEc0/O13tjTKhu/MQrss6?= =?utf-8?q?sfxxBgnDGfovNDA4CLoZPdCRUDm0/DPsgSGtOh+Z45VM1mui08vGgRO2hZ5CH5uTs?= =?utf-8?q?Voy8K+/aKLxXg9256xPT9zTC3ZNRNci4LgZpEzb2S+39fHsLRx4fX0d7v1IE1VVD/?= =?utf-8?q?qUv6jqsirXG28MyyaJWj+hw+rkO5ZAYHDlTSPQ1paXljlx0uCUsgbMAOkazZiOtUE?= =?utf-8?q?wdbcWBTq0H5XnYJ029sDpRQ0s0YNPOfzEwLoiDG/VbrSXM8p+RjxQDpNTLwIJYKQf?= =?utf-8?q?fQo4C/YbaqWkbMydDUar1dVm1G+Ianuz3djAJyYlCXEbMGBg6b4ZeftQPL8sA8/Jb?= =?utf-8?q?TtcRijGjlvivdleKFdXErylrmju5p3rA6lq4KhQYQTv9Qdaoj7OjXLHDP2oq82XrB?= =?utf-8?q?+GkBLBRV9LOKsHm4AFDZ1eEPj8g7KzKweYdll1Z5/8W/53jI1hjizJ1s1nIQrlzjr?= =?utf-8?q?Hwyf8M22T1ReH/2CyqsQJ8KHhANjsms/QM4noiW8d8vgsbZBp7mLKZco34kdjKMtj?= =?utf-8?q?nSZ2SjEjrMxx7NZ1J99VMLTDyrC2sMD8ZhWgs2T9n/0wEC8qr9rewj64n45g2wm0O?= =?utf-8?q?PL46/Lp5B8erFcJ7Q2CMhl9zVBYItGe/4dUDIiLBPyw2C3aQ9dCMG1CTtDDdzmR+8?= =?utf-8?q?Vi9E08KRQ3dN+zUn963FhTlREyo6zPqKd05IOBYH+QcAa8oGcFyyvOISLucdw0vPa?= =?utf-8?q?IWQ1Nn9LJZZZSSIdLRkKZfhoyA+qmLQgKMTNR1dIisVY9u76fb4xPjNudeWM95usP?= =?utf-8?q?dXDAKvXv4EH53kTe0gARQzL4db7GmLjz6twSPYw9PJTe7m4zaHQ+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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250121_070912_504609_74226FC7 X-CRM114-Status: GOOD ( 18.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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