From patchwork Mon Jan 20 02:25:34 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: 13944689 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2055.outbound.protection.outlook.com [40.107.241.55]) (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 CEA3435968 for ; Mon, 20 Jan 2025 02:26:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737340000; cv=fail; b=CutXiBQV5tpxFCCV5UnErml3Vl53OOgA+XXxSaPvVb/qb5JBo+264VWe2W0vIbGIClkl/KjF3Ez1y+6LjmVIpTXTaM9I5+RBeIlmls+TKBB3CcgzOLep5FxE3zAVf8fVeUafMQujfdUttwWvLpDr0AIIQr/P8A/15JLQy2XpP5U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737340000; c=relaxed/simple; bh=EN2k/2Zt+hegS4CGsu8OPcUqieIFeCVz8DbmKySo3N4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Qi62eFG5FZIvnpcZBDLx08jk85oiKmRAtqNHpDgyMw7WqpjxuJjWnHtKi9cNw0+feDAbxpyD78OptdkU8/sN6H0MrT+Qu7WRSKCNw7LIobBT1ohYSAJQridpTswe1KLM3+GVbQBdADla88RstblJQFW6x+XydBsQti3bG9g6Lm8= 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=ELMshrkR; arc=fail smtp.client-ip=40.107.241.55 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="ELMshrkR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LqaWj9B4rR1mdIp8NYx5i7joq418deYoUeksWOkaXLhBs2ZNLNzp40itY1d7M+9EHiitR4kYU2PADZyJq8OzDq41+p9HeomkAz4H5AtIZv2hloiE7vXrVyrzVUXsjn18Tlt78t0dZcDTHahnMqu6IPPBwliWP8qF7LQmDuTug4Vpv/GFEnU1Gt3Td1+8IhUbenbxvYONlcr1qpq94wwa/p+qM5iSCh2QW3MJRaSp/JMvQ1n79T5/sirIKL9NbUkPdP4TOFDQrto1s3M7BM2CDIYXUcy0f+iCe04SHxQ+IE2HNTvgAHMyFOwZbPCbqSpL4MaOs7kR72Pe7wMhShz2tg== 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=lxIy1MINgP4AsV84ZZTh16+5NK6mkgDtqnQlGJzhFHU=; b=OSQt6kYH8eLJv/vBQqkDKCZdlhRm47UfguDau/vJ7xj1GKvNp11sMKh4UKpkax7YBBJ3BvUdJc+8mY3eMk4bSMpgTTQa75TrOiVVJ6Wq2KsvaDdc7Pvc8HIHWn7bc8Gd0YyzPl3W6eM1h6i2dcpsO+cUHQYeczpKvk/MQdFfLBCBzsMQrIegvxumZM8EHd9gTUH4ChJ7BwrzLKOMF1TaUdP3F1TK0MuTm90O5Zoa0Xh4zB0mdP1BN1bl7kpjo2bccwHsGa3h01LSf/VPaLPDiAfY+M3gOGSzxD6HdKjBPpauXC18IOg+isFq9tb32zajcJUb1WboyJ4FZBIHgSEMmw== 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=lxIy1MINgP4AsV84ZZTh16+5NK6mkgDtqnQlGJzhFHU=; b=ELMshrkR26+uA4xheVICMQwNQbXKIRl8DQULI08xl8uxv229ZguOE8sfCuwSvgWwcIuS44p1Izg6VZp9sWjrWAZE8EXISZMzq8mVEXQ2PVO3PosS7xUpsVGuDSIQ6zVA//23q7Q2o3fvRFW4FDqebRRsI8SaqFlohLf0QsA49j3AYaxztBTmgu8PSLgZ7tGCFk7jEZyrE7p6CGS976n0AtSlx9vG5tYzVFI7+NZj1IXx17lUBvhoTVaT9VT4ek9ANiFMVl2Grdni3PiqEyTjoiclgkOma7678ttI8bp1xnoQi/GUVXu8aQFtnBYi19alLShJP+TMdLhEbXGnx2ij1A== 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 AS8PR04MB8690.eurprd04.prod.outlook.com (2603:10a6:20b:429::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.17; Mon, 20 Jan 2025 02:26:33 +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; Mon, 20 Jan 2025 02:26:33 +0000 From: "Peng Fan (OSS)" Date: Mon, 20 Jan 2025 10:25:34 +0800 Subject: [PATCH 2/4] firmware: arm_scmi: imx: Introduce bbm_info hook Message-Id: <20250120-rtc-v1-2-08c50830bac9@nxp.com> References: <20250120-rtc-v1-0-08c50830bac9@nxp.com> In-Reply-To: <20250120-rtc-v1-0-08c50830bac9@nxp.com> To: Sudeep Holla , Cristian Marussi , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Alexandre Belloni Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, Peng Fan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737339953; l=2191; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=64KNtg8mNAuAOCB4DlUfZa1lYCiwprX7QtiyIFbHFiY=; b=37Mi4t0q7VmQ1QxBLvoDq8DPeGqXFJNc75veDumeMNc74VnGPhOQUImE39+2Fm8gibHvXfqiJ 8/3KARqnvY+DVa9A1DzLHrTbTW8UHM0NkMViLayvmeXulZ1NubKxxQ0 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2P153CA0038.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::7) 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_|AS8PR04MB8690:EE_ X-MS-Office365-Filtering-Correlation-Id: 801d0328-b084-4988-8517-08dd38f9db66 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|376014|7416014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8y7ys20I/SJL+9jGd3LxzdOyYZ8PihX?= =?utf-8?q?GyO6Lx+yL43qBmgKcvzCUXrb6oY95GmBzAFkFbPbV+efJuiSS8EhkYc6ed/nEhPaC?= =?utf-8?q?H+IqlbsfsoadNIyD7Wgxk5AAKawGRHWLHnbKCME+yyzX3ITijCJ4qdXOiJRQpPou2?= =?utf-8?q?jig315cbysFEu/lrfFCMRkQDuYUijgK5pl+GUf+askeLm3iye5w3kRFtOiz+bPHqc?= =?utf-8?q?TV/CXoJkkFxcT/l3PgDSJD6MubT8bBGTN5EVcoKBTU6+KKcUR+2xblf3VrDXKQzoq?= =?utf-8?q?LfyKE/rj0Mg41kyyUuriURA640DIMtzI/ImT3WwRvRAM+G+CAuYJmlDUck2pCHQ0p?= =?utf-8?q?LBSKaOkVn58avkBoLgQPAO4A82q8giu1Fwd3jcvN3Ru1mISjk8S+bbyQWJ5YRn9M4?= =?utf-8?q?FjtWNqBd43gZLTeC5yfFYKKwikiqImtI9bO7+Mxq16AFAI7gU/TZ0XKrrDecTyAgn?= =?utf-8?q?rPl+LNCMLXl+pJM9s9KVqRW+jwsUxk5Xxwikb6EsPDDT9VF1dIFjI9tBmACfcysXS?= =?utf-8?q?TBgk0LK+XGkuzJQXFlEOZbsvWQBIU5AgeiSxs1pet7NRmv6Qkqb7DlnOlHCyc9HrG?= =?utf-8?q?2/aWa7+Vf2wsf9XNEnhBTZfHiD3+0b7ZpH7Nt2kol6t/3YD3ESCS/eObF/CmMaRQA?= =?utf-8?q?wjHbhWSqDEmiLdpWR1nZIPyCsmiGE1OShf0Py0+ROMGpVd5I7aSU04yvteCU++1V4?= =?utf-8?q?miMDiOTJTocmbMhJ56H8a1zExI/Oh59Q9P/S6DYp2q78hY46go7+vuXufl7fzBtrR?= =?utf-8?q?At6j9LAHmZZcFj0l8H1co2anhOPa27E4KREwmRNJmboXRsflKkUb9ORcKH35WtvvU?= =?utf-8?q?Dxd5p6f2q6okY8uzCU2uTYCvtzJUiRMLx4TlMA0JaOMKdoNvo2tR86MOVZ/pS/ciV?= =?utf-8?q?fdW7tfrBYmg+fsOL1Y4kXbpFuy9HT1AEeuG8qa94ttqlADi28MR00TObC9+8plLyy?= =?utf-8?q?1oTS5qYa/jJHc/vUzmYKpBOW/j0WdQKqPQMOG3tAks/Ld+ZvMimBYYAkQfRIf+IUC?= =?utf-8?q?TnWat6TEiqtpNAF2c3iQqs1JCBcscBeiGbEIfyEj2k1A87ax3H10yFVh0UtESJI69?= =?utf-8?q?4DLJW0pikXm2LrbDhpfYpPPHDOF6S55gVz9I2eusSj3wmHbR6MSZZPSazeFK91TAW?= =?utf-8?q?kHtL1G8dZlL2xSoki/L6CfL/JjRK3Z4HAxVvw1RQaPsy4mB5wS+vyI/sT8sdfZcmo?= =?utf-8?q?cs/nngiLyZl99HdDKkuEdF+MB7HAITStWz3LSR4HIR5cunQwSK724Jx1qAGFUaoxx?= =?utf-8?q?QS8s4p8trmsxjpLW73EYQ0QfZH/Pa4nbt0qPHAkzMoIHV07AzoMcrsaqptlITDuJs?= =?utf-8?q?TkL/ffqQHdehxLYmyvathYq+nDEVh2gN0ZTM+4/o8ZOncILXwVLXQdURuuEa7Hl73?= =?utf-8?q?IgnoKp+xpuM?= 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)(376014)(7416014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?qF5+HfhUXN9dthwQJhzAH++s/nq9?= =?utf-8?q?8LUgjUPMTrdxPOwScoXlRN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Ya5452rT/7ZxpTx3S5u5aNiQ3I?= =?utf-8?q?EGsKmDCOGbHsgMZqh5h9TVhzQMf+q8N9Dfu688pYdnFTaPZncRoB2W2+FfMlRdRhE?= =?utf-8?q?HFXXFao/jQyAjq7C+OA0a9nDQQ3LWkCoesyx4iUFhIfB0DZ6FUw2zcA2nQX0D8oM7?= =?utf-8?q?+ui/ZnXQ6XlBnngZ9evgVcVQ+deoJh+Fveo2Khc/rDodAkyPMPjjrri9W8weTGA0M?= =?utf-8?q?lck7QVktkHdOCF9ExMy9tP0GVGEDe9VFN2cQMqUWv7kTwHdz3+0qHysRPx3qRgIcb?= =?utf-8?q?crEScF0deDDJoeQES2C4oMJkpSw68QYWoNCGCAe2XM4yyu96D8eFw3orwCFKerZLw?= =?utf-8?q?DHSClJdWkocdKiD3oE671eD3Vy2LfFelkiGiEWhQQtNjHzcPT76fr68iZbgysPB0G?= =?utf-8?q?7peVDPQKoOLcSjy6viUDNuXuad0CAXcvtJ+0MrVzreHDbDnAaqkuy15aQO4kZJEbt?= =?utf-8?q?bvis34JzF9ADS458mYPgaT8QgBD3UOOd3tciBsC7mbOojOMKuh3kIqSklMgt62ow0?= =?utf-8?q?Ul1fzk78cKt7wSNASvUNSEn2+CpHY1a0VkRjSPDJGdK91aCESnYmSY5k/WVdflUb6?= =?utf-8?q?icx6bjn4TzbY?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 801d0328-b084-4988-8517-08dd38f9db66 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 02:26:33.6457 (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: bc1JfUdcDuRbI/a70ATtzSOCF3JFh0Yp0t44uHJoTAIvBJc7jknOxJPnSPaxmAFF+AIE7NuNo0NBfBbZd+6ibw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8690 From: Peng Fan Add bbm_info hook to let BBM protocol users could query the how many RTCs and GPRs are supported by SCMI platform. Signed-off-by: Peng Fan --- drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c | 15 +++++++++++++++ include/linux/scmi_imx_protocol.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c index 86fadfe8e3560b1cab5876a1029e38d91d938e2f..9d40ea817f4bdd2304c932bf3f52b7673a35eaff 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c @@ -246,6 +246,20 @@ static const struct scmi_protocol_events scmi_imx_bbm_protocol_events = { .num_events = ARRAY_SIZE(scmi_imx_bbm_events), }; +static int scmi_imx_bbm_info(const struct scmi_protocol_handle *ph, u32 *nr_rtc, + u32 *nr_gpr) +{ + struct scmi_imx_bbm_info *pi = ph->get_priv(ph); + + if (nr_rtc) + *nr_rtc = pi->nr_rtc; + + if (nr_gpr) + *nr_gpr = pi->nr_gpr; + + return 0; +} + static int scmi_imx_bbm_rtc_time_set(const struct scmi_protocol_handle *ph, u32 rtc_id, u64 sec) { @@ -351,6 +365,7 @@ static int scmi_imx_bbm_button_get(const struct scmi_protocol_handle *ph, u32 *s } static const struct scmi_imx_bbm_proto_ops scmi_imx_bbm_proto_ops = { + .bbm_info = scmi_imx_bbm_info, .rtc_time_get = scmi_imx_bbm_rtc_time_get, .rtc_time_set = scmi_imx_bbm_rtc_time_set, .rtc_alarm_set = scmi_imx_bbm_rtc_alarm_set, diff --git a/include/linux/scmi_imx_protocol.h b/include/linux/scmi_imx_protocol.h index 53b356a26414279f4aaaa8287c32209ed1ad57b4..a0e7e99c4f43ba3e735f50b9eadbfa07a7803947 100644 --- a/include/linux/scmi_imx_protocol.h +++ b/include/linux/scmi_imx_protocol.h @@ -20,6 +20,8 @@ #define SCMI_IMX_SUBVENDOR "IMX" struct scmi_imx_bbm_proto_ops { + int (*bbm_info)(const struct scmi_protocol_handle *ph, u32 *nr_rtc, + u32 *nr_gpr); int (*rtc_time_set)(const struct scmi_protocol_handle *ph, u32 id, uint64_t sec); int (*rtc_time_get)(const struct scmi_protocol_handle *ph, u32 id,