From patchwork Tue May 31 16:09:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577447 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1300044mag; Tue, 31 May 2022 09:09:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxICi6LUgew9RqxOvFh3SmH5TRFE/0lPXLPHJ9W3UxBnjqWctVeagexPhYYEhp9TRWhTVSq X-Received: by 2002:a92:cd8e:0:b0:2d1:807d:35d8 with SMTP id r14-20020a92cd8e000000b002d1807d35d8mr28358600ilb.312.1654013396269; Tue, 31 May 2022 09:09:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013396; cv=none; d=google.com; s=arc-20160816; b=g9O+iWITXjtPAwik+vgHUv0g2SCWpJS72nPhxo8INvTwQUvl8IAL151dbgWZ27nHiY WRPAta28At4YnUTquXFXEqTZr/kzbmNjDXK5HJI1nM5S1DTAMT/6rd/ekg00m++2JuID KYbLIUiSxwWY8Xl2N/TfAOz7Bc49ifu+v17s+rfw47X1xLJOakkSHCJNTPmrxHKO+0i1 4B1qQv6DlkavUQoQSqGxNeWnmujM2oK4qUSVAV4UiGZjPHr15fc2GiI4E0AKtUxCmO6c WQNZ+IBI32aJ468Ldhq292y+aueAl/mr07cz80HcJRo9XFap09lYLUFyR3z09expSoST PioA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tUwsYIyMddQh95344M+xWvMZHPy9IfsHq+gKIrH8e30=; b=yd6rFKTwCLSBtz0oXPvSEUKIZsaKFyOzq/Ib33jM0KTBqpOYNyNCFJ94VMf3CGd7YV oqLOFaUWkKF1fWoj249irCapocHlXD+M31Kk6Sopj2dO7V6vTaofvJJen9MKLmvKXJuz ov8dvy2bNlGRg1WDRlqxKiDgv1W74piiijScaW64Hw7PwFh/lP+Qff6MLRFUNW6HS+8z xOmDzAxS2UtGfGmstvM+Yra/pa6tiYdSUG6eXJhSBTnTRn2BHDaWqQ7cWZKB034yYB5r xiQLJ/Y20hLlt/7q48x38T7iCDzqtbSeim9tt5GLA5nSfTUgiQWQKXOSzQxIV2fETLr0 BpAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bS2oj9v/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id y7-20020a05663824c700b0031a2a42162fsi16432728jat.81.2022.05.31.09.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:56 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bS2oj9v/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 09DCF84284; Tue, 31 May 2022 18:09:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="bS2oj9v/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F065383E1B; Tue, 31 May 2022 18:09:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B2E5083D77 for ; Tue, 31 May 2022 18:09:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wm1-x330.google.com with SMTP id h62-20020a1c2141000000b0039aa4d054e2so1532113wmh.1 for ; Tue, 31 May 2022 09:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tUwsYIyMddQh95344M+xWvMZHPy9IfsHq+gKIrH8e30=; b=bS2oj9v/UAXHz/7LNHqNlVyZpKq84OamnVcDVkqL1IKQliiz13l1kMQzLZp2Jszr84 Q57lHB37zR0LPr1jCB3Q5/0ZIdfpjG0OziICZHec6qUj8km3Y6mfOM3Bo9X2htRRCEwb CF4Bxu3Vd40i67HHfsPizuYtwFoEe/0JQh9mx2uVUfcyaROPZREz14ZNYJVP7Vo/0zas N3AemvS4C/d3f5uTOLwrn6xYYE6O1W4H5b4fQ2FeZZBriZdlRJ1snV8XBy5Fv61/ri36 Aj5HuDti9wSLlfCgcmBr3CyYeIvQx1Mr6TpRY+T2O/QC8F7SZyoq+lmyDP3C5sJZDmZa R5Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tUwsYIyMddQh95344M+xWvMZHPy9IfsHq+gKIrH8e30=; b=reeOwNLV3tS8wppAx4q2RBhssfuhOtaREKbHkJHTgikiSKtIIxYjeG8bjE6PShmC5v gcSiOpq1lnBSfF2MsgTY9uHFaXOHYHcjjxi+cAL3OAOMbYZOOFyP4p2V0rFFhJ/Y65P9 OAlfZJgF5GO8QZ+B/RbC1h+I4fYKj8uUfZ47yv/tepq/1v0i2dtISUB5e7zdwvqupNzC zVjUFk1NZIn2SQIWdKBflzplZhEzOO1xxsV1Uo5XvyQey+LzwdO/fieNhy+hKL8WkRJK Dq2Z3ipL13IsbVfoJblRM7aDuJSCSpTIdXssOOeDXw91pb3LtHVcIOO7iaut9Il87GWx xBWQ== X-Gm-Message-State: AOAM532m6BouKP+1Ja4V8z8wMBLMBP5vRO7ot9kgQZKm6llEoGNtGnSH oQU/O+5nsVDXkHFD2OmafnaBoR8QyMPcJg== X-Received: by 2002:a05:600c:3d94:b0:39c:1c04:3191 with SMTP id bi20-20020a05600c3d9400b0039c1c043191mr2937724wmb.171.1654013376898; Tue, 31 May 2022 09:09:36 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:36 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 01/14] firmware: scmi: optee: use TEE shared memory for SCMI messages Date: Tue, 31 May 2022 18:09:16 +0200 Message-Id: <20220531160929.931150-2-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Changes implementation when using TEE dynamically allocated shared memory to synchronize with the Linux implementation where the legacy SMT protocol cannot be used with such memory since it is expected from device mapped memory whereas OP-TEE shared memory is cached and hence should not be accessed using memcpy_toio()/memcpy_fromio(). This change implements the MSG shared memory protocol introduced in Linux [1]. The protocol uses a simplified SMT header of 32bit named MSG_SMT to carry SCMI protocol information and uses side channel means to carry exchanged buffer size information, as TEE invocation API parameters when used in the SCMI OP-TEE transport. Link: [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f301bba0ca7392d16a6ea4f1d264a91f1fadea1a Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/firmware/scmi/optee_agent.c | 68 ++++++++++++++++++++++------- drivers/firmware/scmi/smt.c | 53 +++++++++++++++++++++- drivers/firmware/scmi/smt.h | 45 ++++++++++++++++++- 3 files changed, 149 insertions(+), 17 deletions(-) diff --git a/drivers/firmware/scmi/optee_agent.c b/drivers/firmware/scmi/optee_agent.c index 1f265922343..e76f738bbaf 100644 --- a/drivers/firmware/scmi/optee_agent.c +++ b/drivers/firmware/scmi/optee_agent.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2020-2021 Linaro Limited. + * Copyright (C) 2020-2022 Linaro Limited. */ #define LOG_CATEGORY UCLASS_SCMI_AGENT @@ -98,6 +98,22 @@ enum optee_smci_pta_cmd { * [in] value[0].b: Requested capabilities mask (enum pta_scmi_caps) */ PTA_SCMI_CMD_GET_CHANNEL = 3, + + /* + * PTA_SCMI_CMD_PROCESS_MSG_CHANNEL - Process SCMI message in MSG + * buffers pointed by memref parameters + * + * [in] value[0].a: Channel handle + * [in] memref[1]: Message buffer (MSG header and SCMI payload) + * [out] memref[2]: Response buffer (MSG header and SCMI payload) + * + * Shared memories used for SCMI message/response are MSG buffers + * referenced by param[1] and param[2]. MSG transport protocol + * uses a 32bit header to carry SCMI meta-data (protocol ID and + * protocol message ID) followed by the effective SCMI message + * payload. + */ + PTA_SCMI_CMD_PROCESS_MSG_CHANNEL = 4, }; /* @@ -106,9 +122,17 @@ enum optee_smci_pta_cmd { * PTA_SCMI_CAPS_SMT_HEADER * When set, OP-TEE supports command using SMT header protocol (SCMI shmem) in * shared memory buffers to carry SCMI protocol synchronisation information. + * + * PTA_SCMI_CAPS_MSG_HEADER + * When set, OP-TEE supports command using MSG header protocol in an OP-TEE + * shared memory to carry SCMI protocol synchronisation information and SCMI + * message payload. */ #define PTA_SCMI_CAPS_NONE 0 #define PTA_SCMI_CAPS_SMT_HEADER BIT(0) +#define PTA_SCMI_CAPS_MSG_HEADER BIT(1) +#define PTA_SCMI_CAPS_MASK (PTA_SCMI_CAPS_SMT_HEADER | \ + PTA_SCMI_CAPS_MSG_HEADER) static int open_channel(struct udevice *dev, struct channel_session *sess) { @@ -139,7 +163,10 @@ static int open_channel(struct udevice *dev, struct channel_session *sess) param[0].attr = TEE_PARAM_ATTR_TYPE_VALUE_INOUT; param[0].u.value.a = chan->channel_id; - param[0].u.value.b = PTA_SCMI_CAPS_SMT_HEADER; + if (chan->dyn_shm) + param[0].u.value.b = PTA_SCMI_CAPS_MSG_HEADER; + else + param[0].u.value.b = PTA_SCMI_CAPS_SMT_HEADER; ret = tee_invoke_func(sess->tee, &cmd_arg, ARRAY_SIZE(param), param); if (ret || cmd_arg.ret) { @@ -167,34 +194,48 @@ static int invoke_cmd(struct udevice *dev, struct channel_session *sess, { struct scmi_optee_channel *chan = dev_get_plat(dev); struct tee_invoke_arg arg = { }; - struct tee_param param[2] = { }; + struct tee_param param[3] = { }; int ret; - scmi_write_msg_to_smt(dev, &chan->smt, msg); - arg.session = sess->tee_session; param[0].attr = TEE_PARAM_ATTR_TYPE_VALUE_INPUT; param[0].u.value.a = sess->channel_hdl; - if (chan->dyn_shm) { - arg.func = PTA_SCMI_CMD_PROCESS_SMT_CHANNEL_MESSAGE; - param[1].attr = TEE_PARAM_ATTR_TYPE_MEMREF_INOUT; + if (sess->tee_shm) { + size_t in_size; + + ret = scmi_msg_to_smt_msg(dev, &chan->smt, msg, &in_size); + if (ret < 0) + return ret; + + arg.func = PTA_SCMI_CMD_PROCESS_MSG_CHANNEL; + param[1].attr = TEE_PARAM_ATTR_TYPE_MEMREF_INPUT; param[1].u.memref.shm = sess->tee_shm; - param[1].u.memref.size = SCMI_SHM_SIZE; + param[1].u.memref.size = in_size; + param[2].attr = TEE_PARAM_ATTR_TYPE_MEMREF_OUTPUT; + param[2].u.memref.shm = sess->tee_shm; + param[2].u.memref.size = sess->tee_shm->size; } else { arg.func = PTA_SCMI_CMD_PROCESS_SMT_CHANNEL; + scmi_write_msg_to_smt(dev, &chan->smt, msg); } ret = tee_invoke_func(sess->tee, &arg, ARRAY_SIZE(param), param); if (ret || arg.ret) { if (!ret) ret = -EPROTO; + + return ret; + } + + if (sess->tee_shm) { + ret = scmi_msg_from_smt_msg(dev, &chan->smt, msg, + param[2].u.memref.size); } else { ret = scmi_read_resp_from_smt(dev, &chan->smt, msg); + scmi_clear_smt_channel(&chan->smt); } - scmi_clear_smt_channel(&chan->smt); - return ret; } @@ -217,9 +258,6 @@ static int prepare_shm(struct udevice *dev, struct channel_session *sess) chan->smt.buf = sess->tee_shm->addr; - /* Initialize shm buffer for message exchanges */ - scmi_clear_smt_channel(&chan->smt); - return 0; } @@ -233,7 +271,7 @@ static void release_shm(struct udevice *dev, struct channel_session *sess) static int scmi_optee_process_msg(struct udevice *dev, struct scmi_msg *msg) { - struct channel_session sess; + struct channel_session sess = { }; int ret; ret = open_channel(dev, &sess); diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c index e60c2aebc89..509ed618a99 100644 --- a/drivers/firmware/scmi/smt.c +++ b/drivers/firmware/scmi/smt.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015-2019, Arm Limited and Contributors. All rights reserved. - * Copyright (C) 2019-2020 Linaro Limited. + * Copyright (C) 2019-2022 Linaro Limited. */ #define LOG_CATEGORY UCLASS_SCMI_AGENT @@ -137,3 +137,54 @@ void scmi_clear_smt_channel(struct scmi_smt *smt) hdr->channel_status &= ~SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR; } + +/** + * Write SCMI message @msg into a SMT_MSG shared buffer @smt. + * Return 0 on success and with a negative errno in case of error. + */ +int scmi_msg_to_smt_msg(struct udevice *dev, struct scmi_smt *smt, + struct scmi_msg *msg, size_t *buf_size) +{ + struct scmi_smt_msg_header *hdr = (void *)smt->buf; + + if ((!msg->in_msg && msg->in_msg_sz) || + (!msg->out_msg && msg->out_msg_sz)) + return -EINVAL; + + if (smt->size < (sizeof(*hdr) + msg->in_msg_sz) || + smt->size < (sizeof(*hdr) + msg->out_msg_sz)) { + dev_dbg(dev, "Buffer too small\n"); + return -ETOOSMALL; + } + + *buf_size = msg->in_msg_sz + sizeof(hdr->msg_header); + + hdr->msg_header = SMT_HEADER_TOKEN(0) | + SMT_HEADER_MESSAGE_TYPE(0) | + SMT_HEADER_PROTOCOL_ID(msg->protocol_id) | + SMT_HEADER_MESSAGE_ID(msg->message_id); + + memcpy(hdr->msg_payload, msg->in_msg, msg->in_msg_sz); + + return 0; +} + +/** + * Read SCMI message from a SMT shared buffer @smt and copy it into @msg. + * Return 0 on success and with a negative errno in case of error. + */ +int scmi_msg_from_smt_msg(struct udevice *dev, struct scmi_smt *smt, + struct scmi_msg *msg, size_t buf_size) +{ + struct scmi_smt_msg_header *hdr = (void *)smt->buf; + + if (buf_size > msg->out_msg_sz + sizeof(hdr->msg_header)) { + dev_err(dev, "Buffer to small\n"); + return -ETOOSMALL; + } + + msg->out_msg_sz = buf_size - sizeof(hdr->msg_header); + memcpy(msg->out_msg, hdr->msg_payload, msg->out_msg_sz); + + return 0; +} diff --git a/drivers/firmware/scmi/smt.h b/drivers/firmware/scmi/smt.h index a8c0987bd30..9d669a6c922 100644 --- a/drivers/firmware/scmi/smt.h +++ b/drivers/firmware/scmi/smt.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2015-2019, Arm Limited and Contributors. All rights reserved. - * Copyright (C) 2019-2020 Linaro Limited. + * Copyright (C) 2019-2022 Linaro Limited. */ #ifndef SCMI_SMT_H #define SCMI_SMT_H @@ -29,6 +29,17 @@ struct scmi_smt_header { u8 msg_payload[0]; }; +/** + * struct scmi_msg_header - Description of a MSG shared memory message buffer + * + * MSG communication protocol uses a 32bit header memory cell to store SCMI + * protocol data followed by the exchange SCMI message payload. + */ +struct scmi_smt_msg_header { + __le32 msg_header; + u8 msg_payload[0]; +}; + #define SMT_HEADER_TOKEN(token) (((token) << 18) & GENMASK(31, 18)) #define SMT_HEADER_PROTOCOL_ID(proto) (((proto) << 10) & GENMASK(17, 10)) #define SMT_HEADER_MESSAGE_TYPE(type) (((type) << 18) & GENMASK(9, 8)) @@ -75,12 +86,44 @@ static inline void scmi_smt_put_channel(struct scmi_smt *smt) int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt); +/* + * Write SCMI message to a SMT shared memory + * @dev: SCMI device + * @smt: Reference to shared memory using SMT header + * @msg: Input SCMI message transmitted + */ int scmi_write_msg_to_smt(struct udevice *dev, struct scmi_smt *smt, struct scmi_msg *msg); +/* + * Read SCMI message from a SMT shared memory + * @dev: SCMI device + * @smt: Reference to shared memory using SMT header + * @msg: Output SCMI message received + */ int scmi_read_resp_from_smt(struct udevice *dev, struct scmi_smt *smt, struct scmi_msg *msg); void scmi_clear_smt_channel(struct scmi_smt *smt); +/* + * Write SCMI message to SMT_MSG shared memory + * @dev: SCMI device + * @smt: Reference to shared memory using SMT_MSG header + * @msg: Input SCMI message transmitted + * @buf_size: Size of the full SMT_MSG buffer transmitted + */ +int scmi_msg_to_smt_msg(struct udevice *dev, struct scmi_smt *smt, + struct scmi_msg *msg, size_t *buf_size); + +/* + * Read SCMI message from SMT_MSG shared memory + * @dev: SCMI device + * @smt: Reference to shared memory using SMT_MSG header + * @msg: Output SCMI message received + * @buf_size: Size of the full SMT_MSG buffer received + */ +int scmi_msg_from_smt_msg(struct udevice *dev, struct scmi_smt *smt, + struct scmi_msg *msg, size_t buf_size); + #endif /* SCMI_SMT_H */ From patchwork Tue May 31 16:09:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577448 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1300295mag; Tue, 31 May 2022 09:10:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoztIv7q5dRHi+p4NoQK2bGQELkEBStbCzZ4WfHJipRJvLJOy6RI5z1NNfieCMSkYz6lqw X-Received: by 2002:a05:6e02:1563:b0:2d3:c749:841e with SMTP id k3-20020a056e02156300b002d3c749841emr1035660ilu.59.1654013410318; Tue, 31 May 2022 09:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013410; cv=none; d=google.com; s=arc-20160816; b=X8fuJ23QaNKKUIbMz9uk9srv7SE4IiLol1jX6XR5qxEtum59QeLjx3lkFJlf3UbwsS ypktWfe8wj/adNVFXkvdowxbxIcFz+yXQSlrrYPH/1OBbEMZVfr6jHDu11/WqKxDbFt5 X53jjZ+pBKDz0qeyh8GBshxH3Sunk5BOP+uhjvMYNxVlArdO4cLw8uA/B2gjVzYO+e5w OsVk95GFjV0gazeJmAsQLe61k5W1Q0tE1PGX4jkqmv+wQd/l7xrV42iud4gCDtlcn7K5 wVS6OwOn3jDDDKFJuPbTecp94hh6hZWy7d6R0sHqVtqkdO/zY9/UOlC3FdfFgOpL/0c6 la5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YmSbSxDK6L+LgBJw9YogqGg7kozQFpztOoNinfsrapc=; b=QY0PXLcA85Ubgaj4R6ZTlsUNKlqmfK6E75GdnNyAneKkOc2lsqX6WaDtZ1HfXRDtyu bxW1cgujuffp9o/7J4Tv5ydWF2TwOSEP0bYm2LjIMdTKEnAflpY5hCk15lSfKygccLOz ro5PMTCKfhKnn5OKTHBm20X3hwzE8Vaaed4BJyAdhjYmp6OmaGGv3bw2mK9Rebk24vbb jDBnGchABNSl1Cw0D6orw+/hnUCeBvsKhxSuISRNrvpQTImK8hTVMBM6xMk2cspRfa43 bxV84KZv2lzGOgNIsLcNlsiRdijqnp/toUygD9P4md8a0Qee3qsUv/JYCvmSNSGGw7aQ Q/zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dk6fmNzd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id l9-20020a056e021aa900b002ca51b21792si17605326ilv.169.2022.05.31.09.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:10:10 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dk6fmNzd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 34EAD83E63; Tue, 31 May 2022 18:09:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="dk6fmNzd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 39C6183F40; Tue, 31 May 2022 18:09:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B676583DE0 for ; Tue, 31 May 2022 18:09:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wm1-x334.google.com with SMTP id y24so8289808wmq.5 for ; Tue, 31 May 2022 09:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YmSbSxDK6L+LgBJw9YogqGg7kozQFpztOoNinfsrapc=; b=dk6fmNzdLwu9vQnFmmf+7KqeO2FYDL2Sa42DdaEGfI6yg6XORcWLZoh/ot8vx2WwrJ B1e7u5ByapD3IKivc29j/IlsfNAdg+pgDCSTSg1GlEmer9mfBmtKVKizvau0RTHxHYu2 itodc/UPlrVBgTNGRwPt9ugqO7IgVGe9IpYJimnMEOv3bjWE9AIIdb+0+vRLvSwltfGj qCOCTMj17NQhLQ7nwqqy+l7RlCcjmaF/A4TQhU+NxEoYvdNotDOl1I+5tGZ7mwkXVD/J Tz2Z6rC52GCcpy0NrfFT3GEnxyG42o0zE5eYDeD8I16F9Aj1i1ywUK06Fygs/MzAAhB/ hqTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YmSbSxDK6L+LgBJw9YogqGg7kozQFpztOoNinfsrapc=; b=oSYOLyx/deCh1js78tY/aAQTUdG8cvHf01y3Hf7RhQhZlGlPeOvnC3agwgeBOVQm9e mxXkU+UUda5MCYidn8dp/1+zGWTq3r0idHqVFo9yVFaClBfndDzM41WCpMKVomla6JBm eLoK3Yvr5Ss5qZBC05nijD5zmRPgiht3sKnYAkfhUtxVDRymc6xKT6+vw0zSlgtwSNjH bT7n3hr77Pgm9ty0twWUxP7iiitP9pXfKR42HFd3+RUD3U8lT962KxoNGldZMq3cGWns RHYbnEg9a+rpLgd+K2oYJIsdrBmZ29RL3C1xZofht17iwkPTTPUAsO9kT8vd5KFp5dBb lJKw== X-Gm-Message-State: AOAM532NiQOXJhSXSF8VScvnWROa4i+mbwXek1lNw9+qXN9e/sJrZUja Mf0lROtsqifn5W1wysw95JGniy96E2XAWQ== X-Received: by 2002:a05:600c:892:b0:397:7b6c:b59d with SMTP id l18-20020a05600c089200b003977b6cb59dmr24189472wmp.85.1654013378095; Tue, 31 May 2022 09:09:38 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:37 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 02/14] firmware: scmi: optee: fix inline description of PTA_SCMI_CMD_GET_CHANNEL Date: Tue, 31 May 2022 18:09:17 +0200 Message-Id: <20220531160929.931150-3-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Removes inaccurate inline description of OP-TEE SCMI PTA command PTA_SCMI_CMD_GET_CHANNEL. Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/firmware/scmi/optee_agent.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/firmware/scmi/optee_agent.c b/drivers/firmware/scmi/optee_agent.c index e76f738bbaf..bf0647bafd1 100644 --- a/drivers/firmware/scmi/optee_agent.c +++ b/drivers/firmware/scmi/optee_agent.c @@ -91,8 +91,6 @@ enum optee_smci_pta_cmd { /* * PTA_SCMI_CMD_GET_CHANNEL - Get channel handle * - * SCMI shm information are 0 if agent expects to use OP-TEE regular SHM - * * [in] value[0].a: Channel identifier * [out] value[0].a: Returned channel handle * [in] value[0].b: Requested capabilities mask (enum pta_scmi_caps) From patchwork Tue May 31 16:09:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577449 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1300539mag; Tue, 31 May 2022 09:10:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeMno8/4zR1Hi7jZx2XnVz+uPyytivSP/2Fxj2MeyrrmxuVyw29cTk1abp2Axi4WSldcBi X-Received: by 2002:a92:c087:0:b0:2d3:96f3:1b1a with SMTP id h7-20020a92c087000000b002d396f31b1amr8681908ile.163.1654013424025; Tue, 31 May 2022 09:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013424; cv=none; d=google.com; s=arc-20160816; b=WRqMK7RxMLQOuQAzxgAoXpfO3Czyr+e7PFOf4e64Q5biToaVjmRv8NVa35H2FvcVoa bJVWlkik3yw1oeahIAGrAxBEPwEoYTYSH9QIKICBq03BNQh+1VOkhDFOZu9VoGjlALUw yn2TJR5/mbCvgIV9+MfiNQXWLjVNAeb4JrpTIK871JbZIog78Z039tZ0/84twzQ0VhNh xkuQOX208dKXwKUwnvFHnUKJGiWTS3L8gEcZ6Voxtyi+2YqOPUU0Dj0DXFLv4/AIuvWX kqKxbsHUDdjF6309CIgGCgj3pB9bDoFiTEr8NlWkDM2zz8PgMlCKgNLhzAYqIqpgpAvD 3NPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FWq3eaPqYmqa96WH3cVbXcogNmu+p/AyuTFZCmFwbgU=; b=aYzPWIh5u9gFcPEkUnYVT4DM00mt07GA8fAzrU1LBcK8U0RGIHGGFPHOhUK5zYYZIK v1xAHCGNG2hGdV8Bn4nq8ubL9Sn1X5SvQXZLjXpP3GE7RU0CsRYGEfqW4Kq97cT3TMJK dwx8dmbwK7rwO4yorvLUtUrk0NjS191hTqCWTGJvLcRYq25ux9KlFDC7NJ5I/bACJ0Zm 9pNN5pYeHAMQY8trTHb4X3eR8fOBPyiWHPN1kWsHH9z0qcfOiPiUNgAsuFWlgW7gNq6k qLAeYqqUZ7M/zD1Cu/mGXwwBNI7212u7OkgRgFzg+jMKCQnjXzUEKKPaiDdmEnroZhHM 1dwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TftKyqJu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id n14-20020a92d9ce000000b002d1c3dff02bsi14800437ilq.131.2022.05.31.09.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:10:24 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TftKyqJu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 978DE841A5; Tue, 31 May 2022 18:10:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TftKyqJu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5A43883E1B; Tue, 31 May 2022 18:09:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 51AB183E3C for ; Tue, 31 May 2022 18:09:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wm1-x335.google.com with SMTP id d5-20020a05600c34c500b0039776acee62so1172049wmq.1 for ; Tue, 31 May 2022 09:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FWq3eaPqYmqa96WH3cVbXcogNmu+p/AyuTFZCmFwbgU=; b=TftKyqJu0EeB4MXvnytcUx7G9e1foUMqlq+WUtrWF95dFK/YeQzsEEBdghaALwcFZQ 9aep6wTH5K/RPadYI4WTkvgeBhH3M6syjXWt8wYYl1LUUhDARLBeUavn0J5voFmIXiws 6KoExQAPxDahNJKsHwANl/nDRxnoDIy0zPqX3rQNOM3GJJoO3JRIVEJsMWdwSEjNNDtw DW/rB3V5Jy4//mgpV4uyRtYHBz5fj7Wt0LHMnpE6x4ICbI/JGAqzBsrhVxFezXm3lByc BJaPKpi/bSUy0ldHd7pP/6hgsJyXsJr9vgkNNs2pKDeoItWgKW0W4KOj8ziG9rDHqWkf +42g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FWq3eaPqYmqa96WH3cVbXcogNmu+p/AyuTFZCmFwbgU=; b=Nd20oCyCZEkowF1RWyGKEDPx8/MwebV0xqg4JttxfP6FJvIcnN/CeJAYpnmzpx5W0V dqTDm7QsiTR5PMirQnuV28G7T1W6nC7O5ggF++hvwaDQbp++da1/+dnD3iwF6546nq8H wZauuWLWhUM6ATryI8pVv5KgOLkQMHHm0f2+pgQF0ClVc1oSky0t2isNawqDn1Ea59q7 FwttqRzPI2y/xHDJI1SyjozWH8yJSR1EB2tGeOoS/t7GJ1PqxXVDtmegDXJQL5SF6mFT lReCCjvYepi6YtP8OVb0qs1sNRw0upm3+PN9NCEk821sUtpMsai3lb5N5SYZ5Px8ffCs 6A4w== X-Gm-Message-State: AOAM531F/3Gkb13TOLxl/m+TCqLKfwdQTUQKdbCX5pTd3tEnlaKl1Ueb lmOoVDAFbKaqaVTEZYYaj0niTkFj31RXJw== X-Received: by 2002:a05:600c:1c22:b0:397:5c31:6669 with SMTP id j34-20020a05600c1c2200b003975c316669mr24243108wms.78.1654013379418; Tue, 31 May 2022 09:09:39 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:38 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org, Lukasz Majewski , Sean Anderson , Jaehoon Chung Subject: [PATCH v2 03/14] firmware: scmi: prepare scmi uclass API to multi-channel Date: Tue, 31 May 2022 18:09:18 +0200 Message-Id: <20220531160929.931150-4-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Changes SCMI driver API function devm_scmi_process_msg() to add an SCMI channel reference argument for when SCMI agent supports SCMI protocol specific channels. First argument of devm_scmi_process_msg() is also change to point to the caller SCMI protocol device rather than its parent device (the SCMI agent device). The argument is a pointer to opaque struct scmi_channel known from the SCMI transport drivers. It is currently unused and caller a pass NULL value. A later change will enable such support once SCMI protocol drivers have means to get the channel reference during initialization. Cc: Lukasz Majewski Cc: Sean Anderson Cc: Jaehoon Chung Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/clk/clk_scmi.c | 10 +++++----- drivers/firmware/scmi/scmi_agent-uclass.c | 3 ++- drivers/power/regulator/scmi_regulator.c | 10 +++++----- drivers/reset/reset-scmi.c | 4 ++-- include/scmi_agent-uclass.h | 2 +- include/scmi_agent.h | 5 ++++- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c index 5aaabcf0b44..0d0bb72eaf7 100644 --- a/drivers/clk/clk_scmi.c +++ b/drivers/clk/clk_scmi.c @@ -24,7 +24,7 @@ static int scmi_clk_get_num_clock(struct udevice *dev, size_t *num_clocks) }; int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret) return ret; @@ -49,7 +49,7 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name) }; int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret) return ret; @@ -70,7 +70,7 @@ static int scmi_clk_gate(struct clk *clk, int enable) in, out); int ret; - ret = devm_scmi_process_msg(clk->dev, &msg); + ret = devm_scmi_process_msg(clk->dev, NULL, &msg); if (ret) return ret; @@ -98,7 +98,7 @@ static ulong scmi_clk_get_rate(struct clk *clk) in, out); int ret; - ret = devm_scmi_process_msg(clk->dev, &msg); + ret = devm_scmi_process_msg(clk->dev, NULL, &msg); if (ret < 0) return ret; @@ -123,7 +123,7 @@ static ulong scmi_clk_set_rate(struct clk *clk, ulong rate) in, out); int ret; - ret = devm_scmi_process_msg(clk->dev, &msg); + ret = devm_scmi_process_msg(clk->dev, NULL, &msg); if (ret < 0) return ret; diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index 3819f2fa993..93cfc9c395b 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -114,7 +114,8 @@ static const struct scmi_agent_ops *transport_dev_ops(struct udevice *dev) return (const struct scmi_agent_ops *)dev->driver->ops; } -int devm_scmi_process_msg(struct udevice *dev, struct scmi_msg *msg) +int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel, + struct scmi_msg *msg) { const struct scmi_agent_ops *ops; struct udevice *parent = dev; diff --git a/drivers/power/regulator/scmi_regulator.c b/drivers/power/regulator/scmi_regulator.c index 2966bdcf830..3325ddaf23b 100644 --- a/drivers/power/regulator/scmi_regulator.c +++ b/drivers/power/regulator/scmi_regulator.c @@ -38,7 +38,7 @@ static int scmi_voltd_set_enable(struct udevice *dev, bool enable) in, out); int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret) return ret; @@ -61,7 +61,7 @@ static int scmi_voltd_get_enable(struct udevice *dev) in, out); int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret < 0) return ret; @@ -85,7 +85,7 @@ static int scmi_voltd_set_voltage_level(struct udevice *dev, int uV) in, out); int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret < 0) return ret; @@ -104,7 +104,7 @@ static int scmi_voltd_get_voltage_level(struct udevice *dev) in, out); int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret < 0) return ret; @@ -147,7 +147,7 @@ static int scmi_regulator_probe(struct udevice *dev) /* Check voltage domain is known from SCMI server */ in.domain_id = pdata->domain_id; - ret = devm_scmi_process_msg(dev, &scmi_msg); + ret = devm_scmi_process_msg(dev, NULL, &scmi_msg); if (ret) { dev_err(dev, "Failed to query voltage domain %u: %d\n", pdata->domain_id, ret); diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c index 81d195a06a9..30b26ec9d31 100644 --- a/drivers/reset/reset-scmi.c +++ b/drivers/reset/reset-scmi.c @@ -26,7 +26,7 @@ static int scmi_reset_set_level(struct reset_ctl *rst, bool assert_not_deassert) in, out); int ret; - ret = devm_scmi_process_msg(rst->dev, &msg); + ret = devm_scmi_process_msg(rst->dev, NULL, &msg); if (ret) return ret; @@ -58,7 +58,7 @@ static int scmi_reset_request(struct reset_ctl *rst) * We don't really care about the attribute, just check * the reset domain exists. */ - ret = devm_scmi_process_msg(rst->dev, &msg); + ret = devm_scmi_process_msg(rst->dev, NULL, &msg); if (ret) return ret; diff --git a/include/scmi_agent-uclass.h b/include/scmi_agent-uclass.h index a501d1b4825..861ac6d1100 100644 --- a/include/scmi_agent-uclass.h +++ b/include/scmi_agent-uclass.h @@ -15,7 +15,7 @@ struct scmi_agent_ops { /* * process_msg - Request transport to get the SCMI message processed * - * @agent: Agent using the transport + * @dev: SCMI protocol device using the transport * @msg: SCMI message to be transmitted */ int (*process_msg)(struct udevice *dev, struct scmi_msg *msg); diff --git a/include/scmi_agent.h b/include/scmi_agent.h index 18bcd48a9d4..f4d85cae773 100644 --- a/include/scmi_agent.h +++ b/include/scmi_agent.h @@ -13,6 +13,7 @@ #include struct udevice; +struct scmi_channel; /* * struct scmi_msg - Context of a SCMI message sent and the response received @@ -52,10 +53,12 @@ struct scmi_msg { * On return, scmi_msg::out_msg_sz stores the response payload size. * * @dev: SCMI device + * @channel: Communication channel for the device * @msg: Message structure reference * Return: 0 on success and a negative errno on failure */ -int devm_scmi_process_msg(struct udevice *dev, struct scmi_msg *msg); +int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel, + struct scmi_msg *msg); /** * scmi_to_linux_errno() - Convert an SCMI error code into a Linux errno code From patchwork Tue May 31 16:09:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577451 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1300982mag; Tue, 31 May 2022 09:10:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6otQPgSOxWymp2JYj+laDBApt7bENY9n8Tjebiug8iVY56RXHtw1TYeLP729CmXnlLhC2 X-Received: by 2002:a05:6e02:1521:b0:2d1:5e40:b94b with SMTP id i1-20020a056e02152100b002d15e40b94bmr31160744ilu.182.1654013449172; Tue, 31 May 2022 09:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013449; cv=none; d=google.com; s=arc-20160816; b=l5Jd0oofRHxRtxtcmBkjesCF/mymG8Yr4mzJHPmgAMyq/ls9bre0DUVz/vCbz3iYNl L405LVlzOxMJBcJQ3vgz1sYJeooVeCOXt/ptaYMCCwpkW3QrHNTcfN0qSKk5pfMitGyS dn5U5m6DRvsRf6El7yHiTFD+zzCbE3qrloKs7wcrSV/9T94j3mQ0+YhNbOkfLZ768+ov lQINw6hLhCBksHbJeHUx4fWxdeuRzwEMY9GZmdAJ/1/hPBJFWUuekN9P1BIM8DAUKKQQ lWTaFvmWjNR2LUYRx2BTdNcZmccSZs6P9FZGix/KHxDMHrdK0r3pAbNbvf/Ppt3vJG65 MQGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gjG2yTB37I83WcA+ZXkAyrz1HLZPROmXz5OUn8BO06Y=; b=YTJO/bfN+X9LZTT2Y5uM831XLbcDoR0fJorlhq/oVHMJyekCsvSJK7/V4nm+eoazUG 8IfNdqiinUTkJZRAhRQ38H+NvP7qNwZWlGVpUgOjMcMCGiF86AAFLAl3OTOi15wwU2Q9 CCQIuMV0NSDPVvD+Qqg4tbtQklnyMMqwADrU1+CemGf5r0GtSviZP/MM38qcOvTQ7vwv wxQ0AfPLJ6BSsm+n20eTtLCAaUgAnvPy04gk/PcDnvioe42bwoxIjvhNEymd0Br3TuuH HFh17BbqH09UpVpKZJwVXPzJ59wBQDsCp/WCbgUMpqOUdecPhZ8TlmRiIVQQirxruegH lumA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pe6Jw9tO; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id i36-20020a056638382400b00330b30137bdsi13864605jav.42.2022.05.31.09.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:10:49 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pe6Jw9tO; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6735884288; Tue, 31 May 2022 18:10:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="pe6Jw9tO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 548018427D; Tue, 31 May 2022 18:09:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6C87783EDE for ; Tue, 31 May 2022 18:09:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wm1-x331.google.com with SMTP id r129so3009013wmr.3 for ; Tue, 31 May 2022 09:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gjG2yTB37I83WcA+ZXkAyrz1HLZPROmXz5OUn8BO06Y=; b=pe6Jw9tOt6NXAh2j1eP3ZoeptjRHhz+wEe2HoFEHkmhqxE66GqL8JGBTiFrJuMdU9H 3wXbEIWEItdB3xWwKITduDOUeCjvyA64qecqgfMm7Y6NA1gTTINj41XVKpq/76lyZ6DC vISHHfldCPKBbfeqGHTcpkGeP0pk9U+VgM+iA3w8B3ihBGQ3L+vDa2HLpC7qe8A/14OM tu7Rdn+sCpEnqmsolOS1Q2xDOv/pmRccRxb+n0I+rKAlvFZGRQYRhrRmCFu7Box6b9Xc bJHpUkUIBw3k2L6roV/mC0gwBppkcm0ofMq3rEELHGdr5AsEM4Ktby1LXztyKg5mbhN2 pOsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gjG2yTB37I83WcA+ZXkAyrz1HLZPROmXz5OUn8BO06Y=; b=5Dc/oke8EUFvE+RIKGvhPg3MtggUgUnQlAoCFN376akGkOS853m2KbAi2DDFX17Ydd SQBMNKuYl6CIktHuy2SqJ8h6JNL4mLfcTQP0V3bWRS2FXsC87gQbVuwaNg47M5j524Ft 2nM9dyWeJnnzQqFMPJIJM7M92snM2frS+sYmM/0qA9Ire7LLCCU80EPY49N9Kaq4tO+M rjvIlC0qHJDjL5rVuSjf8vSbfA+VkN9DtCiI6y5LLypBUKIptH3h+yMfa+uyxe7AiWlE YscRWtNcSlhPdBhMM7uIrhstlFf+kfYjjj1tUQB64XaL/uOuU2UTiWswYXxbPPwhBs9Y DNgQ== X-Gm-Message-State: AOAM531MinAbIilqTh+oVjekRjpk4lodf74iqkLRvlryuYm3frO+0kcS xdQy9rhwRMZFZmh4IjQpL2osaxZ17LXErQ== X-Received: by 2002:a05:600c:34d1:b0:397:4c0d:598a with SMTP id d17-20020a05600c34d100b003974c0d598amr24156940wmq.36.1654013380431; Tue, 31 May 2022 09:09:40 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:40 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 04/14] firmware: scmi: prepare uclass to pass channel reference Date: Tue, 31 May 2022 18:09:19 +0200 Message-Id: <20220531160929.931150-5-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Changes SCMI transport operator ::process_msg to pass the SCMI channel reference provided by caller SCMI protocol device. Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/firmware/scmi/mailbox_agent.c | 4 +++- drivers/firmware/scmi/optee_agent.c | 4 +++- drivers/firmware/scmi/sandbox-scmi_agent.c | 1 + drivers/firmware/scmi/scmi_agent-uclass.c | 2 +- drivers/firmware/scmi/smccc_agent.c | 4 +++- include/scmi_agent-uclass.h | 4 +++- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/scmi/mailbox_agent.c b/drivers/firmware/scmi/mailbox_agent.c index 8e4af0c8faf..aa4929aafae 100644 --- a/drivers/firmware/scmi/mailbox_agent.c +++ b/drivers/firmware/scmi/mailbox_agent.c @@ -31,7 +31,9 @@ struct scmi_mbox_channel { ulong timeout_us; }; -static int scmi_mbox_process_msg(struct udevice *dev, struct scmi_msg *msg) +static int scmi_mbox_process_msg(struct udevice *dev, + struct scmi_channel *channel, + struct scmi_msg *msg) { struct scmi_mbox_channel *chan = dev_get_plat(dev); int ret; diff --git a/drivers/firmware/scmi/optee_agent.c b/drivers/firmware/scmi/optee_agent.c index bf0647bafd1..771fa25e989 100644 --- a/drivers/firmware/scmi/optee_agent.c +++ b/drivers/firmware/scmi/optee_agent.c @@ -267,7 +267,9 @@ static void release_shm(struct udevice *dev, struct channel_session *sess) tee_shm_free(sess->tee_shm); } -static int scmi_optee_process_msg(struct udevice *dev, struct scmi_msg *msg) +static int scmi_optee_process_msg(struct udevice *dev, + struct scmi_channel *channel, + struct scmi_msg *msg) { struct channel_session sess = { }; int ret; diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c index c555164d196..031882998df 100644 --- a/drivers/firmware/scmi/sandbox-scmi_agent.c +++ b/drivers/firmware/scmi/sandbox-scmi_agent.c @@ -471,6 +471,7 @@ static int sandbox_scmi_voltd_level_get(struct udevice *dev, } static int sandbox_scmi_test_process_msg(struct udevice *dev, + struct scmi_channel *channel, struct scmi_msg *msg) { switch (msg->protocol_id) { diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index 93cfc9c395b..c9c9c00384a 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -133,7 +133,7 @@ int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel, ops = transport_dev_ops(parent); if (ops->process_msg) - return ops->process_msg(parent, msg); + return ops->process_msg(parent, NULL, msg); return -EPROTONOSUPPORT; } diff --git a/drivers/firmware/scmi/smccc_agent.c b/drivers/firmware/scmi/smccc_agent.c index 5e166ca93ee..b7a930b24df 100644 --- a/drivers/firmware/scmi/smccc_agent.c +++ b/drivers/firmware/scmi/smccc_agent.c @@ -30,7 +30,9 @@ struct scmi_smccc_channel { struct scmi_smt smt; }; -static int scmi_smccc_process_msg(struct udevice *dev, struct scmi_msg *msg) +static int scmi_smccc_process_msg(struct udevice *dev, + struct scmi_channel *channel, + struct scmi_msg *msg) { struct scmi_smccc_channel *chan = dev_get_plat(dev); struct arm_smccc_res res; diff --git a/include/scmi_agent-uclass.h b/include/scmi_agent-uclass.h index 861ac6d1100..562a4cc99af 100644 --- a/include/scmi_agent-uclass.h +++ b/include/scmi_agent-uclass.h @@ -7,6 +7,7 @@ struct udevice; struct scmi_msg; +struct scmi_channel; /** * struct scmi_transport_ops - The functions that a SCMI transport layer must implement. @@ -18,7 +19,8 @@ struct scmi_agent_ops { * @dev: SCMI protocol device using the transport * @msg: SCMI message to be transmitted */ - int (*process_msg)(struct udevice *dev, struct scmi_msg *msg); + int (*process_msg)(struct udevice *dev, struct scmi_channel *channel, + struct scmi_msg *msg); }; #endif /* _SCMI_TRANSPORT_UCLASS_H */ From patchwork Tue May 31 16:09:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577450 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1300748mag; Tue, 31 May 2022 09:10:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIcZCYETiMKeB1jPDJjOhCbmshP/PrbNMy5oEQxc/nAV4AWjdhe7X68tHTYODvma/K1b2E X-Received: by 2002:a05:6e02:174f:b0:2d1:3971:9348 with SMTP id y15-20020a056e02174f00b002d139719348mr32324372ill.4.1654013436207; Tue, 31 May 2022 09:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013436; cv=none; d=google.com; s=arc-20160816; b=Wbhp/P6LjX7u8UGr2uql4b12Ti7CGA4s4TfM7FunrWSp5MLyK1HxsGMDT1Ed/FmXEu K3o8rRIyhV/XoVi98dobQtJnx5YprNJ0TsbKkGLX/vgnJRIvn1X/zobURsc2ekjiQ+gf DvmRi8dbdJj+Q7x9X+wM7jIl43KQUK2Sc6/EziDRCOKOQECoRuBaRGPX+Q93HPg7IDhp MCPGhtlAsGuMnmB6I5HVkSRt3qB0+Gsluu8+IPLpHnjEHMdl5A9Y4J4iaZ0s0jBXYcQv ZMOermRNc3b1jIchqBvX2JWe/Mrt+bWVFL5ouHJh72kge6f+9f5uoWd/cTEWTmQjhq4w L86g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AcIJuiH5tQ6CZ0cG4yoE3grwba7ePWNaHcRR8vepnhs=; b=es50RGP9NBkMSzlSLU/U7y+XpriEomu56OKbhGXW3YHwuC4YxF9cFF+2UAdjkSqC42 aeRM0LSAJHVS0EFWUHvQbZ+u0I76syXdH4qW98bMeXkrOruK6x3dtAH/YTJT2cZQNdRq GRWHPX4IpcjbTTVV3Xm5jupOx7/9gADCpoCWikzjGlvlUFfLlf7Biaf/Ub4GYLZSk6hU /aELL9qigYziHj2DzSCjQifyMd8w0bFwuETnx54A3AWOlpugSe68H6sHZylaE2cyvRY0 SILHmxgH/H0F7ptEu4u+42GdbLxPY7xoBLOp1Oy5xWQazfPWL4bpzw2E4S/yQmPNTGK0 w4tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="g7M/BuoE"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a10-20020a056602148a00b00657b5f29ab7si23610424iow.66.2022.05.31.09.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:10:36 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="g7M/BuoE"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5594683F40; Tue, 31 May 2022 18:10:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="g7M/BuoE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 495E283E1B; Tue, 31 May 2022 18:09:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7689B83DE0 for ; Tue, 31 May 2022 18:09:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wm1-x333.google.com with SMTP id f23-20020a7bcc17000000b003972dda143eso1519758wmh.3 for ; Tue, 31 May 2022 09:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AcIJuiH5tQ6CZ0cG4yoE3grwba7ePWNaHcRR8vepnhs=; b=g7M/BuoEFJ0pYxxkCEVybGDxwbxgvjG2g+aMgJGhpMBexA3Z7cG9Mzv1C1w11xETax r6pqINtDWBX9knD/OevMsTLV4/5QfDZqTYkTA6/5eilarobEvmRMXtQMCm5+6qBkoUMk Nel2ryZVM24eX8OBs0f8fW1VJLX2HqT5Ust6EwO72RR2+l/lxbSpqCFo2dWY8YUIL4N/ FGBB+xmDVPxKzLXBA1ITK7pQ1kFypYiNenfKIKf/cz2kGwAQkGVsC73U/i8hIP5t5VCN bRprV4Li6NehHOc903MEM7WhVxCKr87ALrQCsj6I1L0KS6F/iMxfMUY4cVw17CL5pE7E roqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AcIJuiH5tQ6CZ0cG4yoE3grwba7ePWNaHcRR8vepnhs=; b=X3RYM04sXHjH8s7UtG18hmmGCg2zyQBCLLQLyrjL4uy1aM4TJKZefxLYjaHxRVwyMo ee4L0Cb5Qqbts2vIJmtV+KKwgwr3LXwnXuXm7X3z4oFstyV+WvYzOgaZHm672uPobkgF wVJyKzlBQOYYPw2qzKAC+fcYGcSgM5439btDR4Fj0wILVHcP/lMmlyHK65N9l1Fktaa+ Nufe3jHg7QTqindNQXwcE0ZCCtLKeCfK3/ibGsolYSUFxtzgmxY5gnY/NMFKSpWcXowD QbNTQ0lALq0dhP/D9jIR/Q6ZwIMWMJ3kXlW4ZbTRlFvmpGLu2xEJuuQI8BPcaZF/VCAu a+1Q== X-Gm-Message-State: AOAM531iZy3dZv73lRVu/ZlxoBs9KVtbtUAMjlEiD/bwBZ0s52Q3bsXf LUDkqEnp3a0SrYoq9KnUGH+c8GnePuRMVQ== X-Received: by 2002:a05:600c:4f0c:b0:397:6a3a:d3f9 with SMTP id l12-20020a05600c4f0c00b003976a3ad3f9mr24482105wmq.103.1654013381491; Tue, 31 May 2022 09:09:41 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:41 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 05/14] firmware: scmi: factorize scmi transport look up Date: Tue, 31 May 2022 18:09:20 +0200 Message-Id: <20220531160929.931150-6-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Defines local helper function find_scmi_transport_device() with the instructions to find the SCMI transport device from a SCMI protocol device. Cc: Patrick Delaunay Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/firmware/scmi/scmi_agent-uclass.c | 26 +++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index c9c9c00384a..f7fa5df214c 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -109,6 +109,20 @@ static int scmi_bind_protocols(struct udevice *dev) return ret; } +static struct udevice *find_scmi_transport_device(struct udevice *dev) +{ + struct udevice *parent = dev; + + do { + parent = dev_get_parent(parent); + } while (parent && device_get_uclass_id(parent) != UCLASS_SCMI_AGENT); + + if (!parent) + dev_err(dev, "Invalid SCMI device, agent not found\n"); + + return parent; +} + static const struct scmi_agent_ops *transport_dev_ops(struct udevice *dev) { return (const struct scmi_agent_ops *)dev->driver->ops; @@ -118,17 +132,11 @@ int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel, struct scmi_msg *msg) { const struct scmi_agent_ops *ops; - struct udevice *parent = dev; + struct udevice *parent; - /* Find related SCMI agent device */ - do { - parent = dev_get_parent(parent); - } while (parent && device_get_uclass_id(parent) != UCLASS_SCMI_AGENT); - - if (!parent) { - dev_err(dev, "Invalid SCMI device, agent not found\n"); + parent = find_scmi_transport_device(dev); + if (!parent) return -ENODEV; - } ops = transport_dev_ops(parent); From patchwork Tue May 31 16:09:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577455 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1301930mag; Tue, 31 May 2022 09:11:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdsjV5zrq7F9UtpwrRg6dFaOb73Tn7Ep3az0XPqNUeRIJSYeYH8RENCxeEMaYyE+3kwnFw X-Received: by 2002:a05:6e02:1aa7:b0:2d1:6593:9709 with SMTP id l7-20020a056e021aa700b002d165939709mr31188051ilv.218.1654013503008; Tue, 31 May 2022 09:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013503; cv=none; d=google.com; s=arc-20160816; b=ftQwIO6symldvD19rz4QxV8lSm7TyJySDbYv81c5NzjO6xarg/JlY12UFGsgaOvnc7 XqnYCAGu+XSmYzP4qmxK7O9DBnS5VYQrJIL9QRiWM6yVS3YjNGxSWP0tXss8xfVSAADa +9BKbyoaHBERDaCX4GemrTFZ12S42ea7BgJVV+Ry8N4wftwdhNyvBkjOqqHL9iUD+pbS vTJIjOEFzyi83y4i2K5J5UyPqiDgxWK1v0Zr6EHTVAQpdtn+8jf2TEBqjnbS2gUQrVWL fsRWI/1tlY6Axtai5R3WPF7m6lH5khHlg7wxf5CVfriwvxw/TwMCqCU4Dx2KNvn4uWxb L4lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r8pNsDQzbpvBIWSDWJ/onVvJdb2emRTZixzGNvnyISw=; b=B7QlGNFZbXA+MjYVgcJL74ufgNKDnnnWvzzyClxoGoRbkn4Y7EBnQc/a5lu+z+77XC WmuY5qLAxGfvXdI+RCNuMpeyR9McwKz9KGVMUhcoaya3PEZvKbJzHdRknZMiE+PMAigl 40/4GdtKz4rSBoJRz+JznqAqR9oV3Eu4vvVJU4LE5mGjIz3nIHD/Up/VGknaT6so8Xkk 8oAYXK4/2na2KEuiu725rXmUl6EGrqoSlprI+MiL4RV3YmQsj5z0hAcb5qNNFikzYJGM fw0wFc3GAm4DmLYeA9DQ3PzBl0UmATjugQ2oMp6UaTzgQfn5hlwE6mUfTh/07+cBUmjO NACw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p0QJaUSc; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id q13-20020a92ca4d000000b002d16e85a00asi18024342ilo.118.2022.05.31.09.11.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p0QJaUSc; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8CE48842F2; Tue, 31 May 2022 18:10:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="p0QJaUSc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D57C183F33; Tue, 31 May 2022 18:09:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8CF9B83D90 for ; Tue, 31 May 2022 18:09:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x434.google.com with SMTP id h5so11265169wrb.0 for ; Tue, 31 May 2022 09:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r8pNsDQzbpvBIWSDWJ/onVvJdb2emRTZixzGNvnyISw=; b=p0QJaUScVO2LMXlIUGAzBHqc+9aR+NvK5m3PBSvAm3QduQUmobi6DFqXaF7CG4ZAhO 70/TWr5DxnZreZ2IQsZrrMUBohwKrKiu/YoRuKU0ZZP0zKp2HJKhp0sedBqnCQ0vD95g BLUzfc2nzUj1XhvCF+ZM2JlIndIisKPyUH24FrG2j00I6imGZhlYuPoA2ou8Vcb8BvYt weTEh0dW955z4Io3JnjLWyUGQ8Nufk89y0HaGYmNLXSuIxj+0m29eyxMw2XnWXBrVt1H AgeBYiBs4sPwa4H/Vu6PNQOPBraxaPzW8fBMoc+gsW7fMHbOsK/S2xetZP9onjrPnPs9 YAYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r8pNsDQzbpvBIWSDWJ/onVvJdb2emRTZixzGNvnyISw=; b=ZcqmER/VJNSM3bDVqqHg3f9tJ20aGDYCnoY/dRyTd4KGxQ0JjL7+BvB8YaQgCSrOC8 voEQKVW7p1Q511raKG+LaZOWgAG8mk55OnV5XkVXVf49qE3g3QedLuxFJIk30ert6RWN k/3JJbTnLQ6Dv+fQZxvol+w+4YslAN7xYc9TbS+7VazAKKkEfhhjbzFjirSY9G7KQGTV XdboNgT+NlDxQreLmKhChh7AlX8RjSSgU7RVwu3arb6az7iHfQEThBIiZfaWDcwGhJ3R 5vablshgkaJ06AqSHQ3YZ97gyduym2T9RCuXOkMcEXc3z1CH9fXivlHhiAouDikd55R3 aylw== X-Gm-Message-State: AOAM531fIU4NTC/Gz7WBQhSebxOVBggcVgUmIYvw/a+jrjf917x4VbP+ 0/dUxlR6SfOZ7ZCvH7LzIXoFrPUG99aEkQ== X-Received: by 2002:a05:6000:15c1:b0:20f:c1d3:8a89 with SMTP id y1-20020a05600015c100b0020fc1d38a89mr44999485wry.287.1654013382546; Tue, 31 May 2022 09:09:42 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:42 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 06/14] firmware: scmi: add multi-channel support Date: Tue, 31 May 2022 18:09:21 +0200 Message-Id: <20220531160929.931150-7-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Adds resources for SCMI protocols to possibly use a dedicated SCMI channel instead of the default channel allocated by the SCMI agent during initialization. As per DT binding documentation, some SCMI transports can define a specific SCMI communication channel for given SCMI protocols. It allows SCMI protocols to pass messages concurrently each other. This change introduces new scmi agent uclass API function devm_scmi_of_get_channel() for SCMI drivers probe sequences to get a reference to the SCMI channel assigned to its related SCMI protocol. The function queries the channel reference to its SCMI transport driver through new scmi agent uclass operator .of_get_channel that uses Device Tree information from related SCMI agent node. Operator .of_get_channel returns a reference to the SCMI channel assigned to SCMI protocol used by the caller device. SCMI transport drivers that do not support multi-channel are not mandated to register this operator. When so, API function devm_scmi_of_get_channel() returns NULL and SCMI transport driver are expected to retrieve by their own means the reference to the unique SCMI channel, for example using platform data as these drivers currently do in U-Boot source tree. Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/firmware/scmi/scmi_agent-uclass.c | 19 ++++++++++++++++++- include/scmi_agent-uclass.h | 9 +++++++++ include/scmi_agent.h | 9 +++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index f7fa5df214c..2b6211c4e6a 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -128,6 +128,23 @@ static const struct scmi_agent_ops *transport_dev_ops(struct udevice *dev) return (const struct scmi_agent_ops *)dev->driver->ops; } +int devm_scmi_of_get_channel(struct udevice *dev, struct scmi_channel **channel) +{ + struct udevice *parent; + + parent = find_scmi_transport_device(dev); + if (!parent) + return -ENODEV; + + if (transport_dev_ops(parent)->of_get_channel) + return transport_dev_ops(parent)->of_get_channel(dev, channel); + + /* Drivers without a get_channel operator don't need a channel ref */ + *channel = NULL; + + return 0; +} + int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel, struct scmi_msg *msg) { @@ -141,7 +158,7 @@ int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel, ops = transport_dev_ops(parent); if (ops->process_msg) - return ops->process_msg(parent, NULL, msg); + return ops->process_msg(parent, channel, msg); return -EPROTONOSUPPORT; } diff --git a/include/scmi_agent-uclass.h b/include/scmi_agent-uclass.h index 562a4cc99af..b1c93532c0e 100644 --- a/include/scmi_agent-uclass.h +++ b/include/scmi_agent-uclass.h @@ -13,6 +13,15 @@ struct scmi_channel; * struct scmi_transport_ops - The functions that a SCMI transport layer must implement. */ struct scmi_agent_ops { + /* + * of_get_channel - Get SCMI channel from SCMI agent device tree node + * + * @dev: SCMI protocol device using the transport + * @channel: Output reference to SCMI channel upon success + * Return 0 upon success and a negative errno on failure + */ + int (*of_get_channel)(struct udevice *dev, struct scmi_channel **channel); + /* * process_msg - Request transport to get the SCMI message processed * diff --git a/include/scmi_agent.h b/include/scmi_agent.h index f4d85cae773..ee6286366df 100644 --- a/include/scmi_agent.h +++ b/include/scmi_agent.h @@ -45,6 +45,15 @@ struct scmi_msg { .out_msg_sz = sizeof(_out_array), \ } +/** + * devm_scmi_of_get_channel() - Get SCMI channel handle from SCMI agent DT node + * + * @dev: Device requesting a channel + * @channel: Output reference to the SCMI channel upon success + * @return 0 on success and a negative errno on failure + */ +int devm_scmi_of_get_channel(struct udevice *dev, struct scmi_channel **channel); + /** * devm_scmi_process_msg() - Send and process an SCMI message * From patchwork Tue May 31 16:09:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577453 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1301521mag; Tue, 31 May 2022 09:11:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmRdLGLYPBCzA0MDWTtyFeHe86U/2VoEAPRdjBQxizsdW7nyogGGurmtDJOoq5RJNHcekj X-Received: by 2002:a05:6638:1c15:b0:32e:de34:ccb3 with SMTP id ca21-20020a0566381c1500b0032ede34ccb3mr20914296jab.1.1654013476567; Tue, 31 May 2022 09:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013476; cv=none; d=google.com; s=arc-20160816; b=b3MtsR0EQUc3le+jR1YVta2uN9JW88B+ULxT08rW1TfvQCajTw56s0/TZCXu/FPTNM qSg5wdsiERF/n3Dpiej1423G8jJjQUc8Hl59yNZOIPdfQr9QR4XMrpzfllERnHivTXFA Mc5QjSurwrKMul6rZCSw6ydXCJSJRwmHmGh+AIxyQqx+B5Y3B741Z92J6hLOezkwR77F LyTyz0zzzD8EhnztqThLyvzc6nH/7lx0faTQoLDq2bHKgVq/sLbT0tOnoXbeR7O6qyG7 8iIT31sCtftBgUDjnfcSHjinzAPn6XZ+QWGdoZrL+51v9d/gcPYw8hGvMv14Bcsr1rHg MtwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4/jLFRrMgeHr8IHmC/71VKUsz+84Tptcg+sRQiP2X4s=; b=LQ5rvw8LQnd7Um6RKozUaaxFODMnUE/EHYM9gkS5c5qaGIRsvBnc0yrkUYx8vBFNjF gKQOjg3xK8JT2N5lX3g90iOG1c96T23NNBuC3lOJ5K8V+oQExBBiJzO3X331ZrPFw2FV n9h2eODlPBxEutpKtqHaM/BXJtcNMx+5BsxCufHb5cGoVxeqAJepgdjZ3zo7nmbv4fRZ qIyvGPW/iU0WeOeHqMh3VxPcncfTv+DQbh3cCPilke0GOFGQxZ1yP+xJUJ+6YC7uHnUG 2NcA3ig4csgRaIxMkWvdxUkCsoqGx9OuZL0okOjNTeBuEzvC8jCYno7bdDMKJaoah4wQ cV8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=canr1x4l; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a124-20020a6bca82000000b0066880222ccasi10681871iog.99.2022.05.31.09.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:11:16 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=canr1x4l; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A1668429D; Tue, 31 May 2022 18:10:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="canr1x4l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6C44D83F33; Tue, 31 May 2022 18:09:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 36C2F841A5 for ; Tue, 31 May 2022 18:09:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x434.google.com with SMTP id h5so11265169wrb.0 for ; Tue, 31 May 2022 09:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4/jLFRrMgeHr8IHmC/71VKUsz+84Tptcg+sRQiP2X4s=; b=canr1x4lj6Da63sNiq+8CxSU/DyDBZsH0Tr6HHxKuqAcT8op09O1lwMTyGo9yfk+3/ K7F2hy6blZ3PNVX7aRVppVzhxgYBNeq4bpeug7vvMyyBMytN9f3o8AWZRF0EbKPtWGhP srPkE/eGekr0H+i+/bpjyIZXaBWxFZcBwbKjjFAnmRp1xgsfm7fuAKLQCZ10Thk29v1s oSv9saQ8515FbfDM1tVjky+1vs/hyLYPW4qGOItDI4mpCxcqOQ03Wnx2NRW51FFk/X7o 6j+McCy8ZDFJCKCO+VtcN6KCAo/21CEO1BbpGVvwNTtOjcmhJBsfWIomlU3WsLV5P5xt Oq/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4/jLFRrMgeHr8IHmC/71VKUsz+84Tptcg+sRQiP2X4s=; b=zZncGPcXahOQXDMq/RxDdxVC/jEusDbd5EsR+0IXPnuo9LZZBLmL9HY8vaupsaFY5g cw8l+f8nGC7cXKtJOMzgJWk4mSgyHblYjYzJLWl93Mr/FOdGwrUH3/U7OzD81Vzcvly5 LXgo0C22tK5Mlfd8UoiW4rsfeT+rN5FV9Dj264SioIOAeztSjnI51k8pbrRzGhhAEZsn PREvx4/RbsNFwbUnr1mTEVcVwo1Jz1kG0diRuzv0+KRolKFq3NeyYmuja2UONesEdun/ 23OXAXbi6h7UeLEMy7hgnxPmJ2vLtmcteaYFZKm3OFth0loilB1CDTsPE4GTC7TTkLAA p/jw== X-Gm-Message-State: AOAM5333uwSgnc8MfRvLCy3JxpHfH3XiGpWHM7H+YfNRZ2bwAZYReVSa 8VC8Zxs5TcfsbfJnhlgtI/g9UB8yuSMiiA== X-Received: by 2002:a05:6000:1682:b0:20e:6de0:a566 with SMTP id y2-20020a056000168200b0020e6de0a566mr48330191wrd.91.1654013383693; Tue, 31 May 2022 09:09:43 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:43 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 07/14] firmware: scmi: mailbox transport: implement multi-channel Date: Tue, 31 May 2022 18:09:22 +0200 Message-Id: <20220531160929.931150-8-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Updates SCMI mailbox transport driver to get SCMI channel reference at initialization and use when posting SCMI messages. Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/firmware/scmi/mailbox_agent.c | 63 ++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/drivers/firmware/scmi/mailbox_agent.c b/drivers/firmware/scmi/mailbox_agent.c index aa4929aafae..e63b67c5ee8 100644 --- a/drivers/firmware/scmi/mailbox_agent.c +++ b/drivers/firmware/scmi/mailbox_agent.c @@ -31,6 +31,14 @@ struct scmi_mbox_channel { ulong timeout_us; }; +/** + * struct scmi_channel - Channel instance referenced in SCMI drivers + * @ref: Reference to local channel instance + **/ +struct scmi_channel { + struct scmi_mbox_channel ref; +}; + static int scmi_mbox_process_msg(struct udevice *dev, struct scmi_channel *channel, struct scmi_msg *msg) @@ -38,6 +46,10 @@ static int scmi_mbox_process_msg(struct udevice *dev, struct scmi_mbox_channel *chan = dev_get_plat(dev); int ret; + /* Support SCMI drivers upgraded to of_get_channel operator */ + if (channel) + chan = &channel->ref; + ret = scmi_write_msg_to_smt(dev, &chan->smt, msg); if (ret) return ret; @@ -64,13 +76,10 @@ out: return ret; } -int scmi_mbox_of_to_plat(struct udevice *dev) +static int setup_channel(struct udevice *dev, struct scmi_mbox_channel *chan) { - struct scmi_mbox_channel *chan = dev_get_plat(dev); int ret; - chan->timeout_us = TIMEOUT_US_10MS; - ret = mbox_get_by_index(dev, 0, &chan->mbox); if (ret) { dev_err(dev, "Failed to find mailbox: %d\n", ret); @@ -78,10 +87,51 @@ int scmi_mbox_of_to_plat(struct udevice *dev) } ret = scmi_dt_get_smt_buffer(dev, &chan->smt); - if (ret) + if (ret) { dev_err(dev, "Failed to get shm resources: %d\n", ret); + return ret; + } - return ret; + chan->timeout_us = TIMEOUT_US_10MS; + + return 0; +} + +static int scmi_mbox_get_channel(struct udevice *dev, + struct scmi_channel **channel) +{ + struct scmi_mbox_channel *base_chan = dev_get_plat(dev->parent); + struct scmi_mbox_channel *chan; + int ret; + + if (!dev_read_prop(dev, "shmem", NULL)) { + /* Uses agent base channel */ + *channel = container_of(base_chan, struct scmi_channel, ref); + + return 0; + } + + chan = calloc(1, sizeof(*chan)); + if (!chan) + return -ENOMEM; + + /* Setup a dedicated channel for the protocol */ + ret = setup_channel(dev, chan); + if (ret) { + free(chan); + return ret; + } + + *channel = (void *)chan; + + return 0; +} + +int scmi_mbox_of_to_plat(struct udevice *dev) +{ + struct scmi_mbox_channel *chan = dev_get_plat(dev); + + return setup_channel(dev, chan); } static const struct udevice_id scmi_mbox_ids[] = { @@ -90,6 +140,7 @@ static const struct udevice_id scmi_mbox_ids[] = { }; static const struct scmi_agent_ops scmi_mbox_ops = { + .of_get_channel = scmi_mbox_get_channel, .process_msg = scmi_mbox_process_msg, }; From patchwork Tue May 31 16:09:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577452 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1301270mag; Tue, 31 May 2022 09:11:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvI5ZmEmwB6iLegXKD4iYOzSuV8+vSoQfaTnHm7xCFE5yQjQH/RruPBFSu//EXfCJsl2QG X-Received: by 2002:a05:6602:3d2:b0:65d:c151:f29f with SMTP id g18-20020a05660203d200b0065dc151f29fmr27597438iov.28.1654013462522; Tue, 31 May 2022 09:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013462; cv=none; d=google.com; s=arc-20160816; b=NJDis3NVqmh44v6EtzG5Z5JjWDW3P5IBaz0SW7PibHf3zQgnKMwEaybyeYq/lfZcP+ ZxGaZEPROVig8MKseEPce3TNfj6ry6wp6wiAdJ9x6qGv8qYyIXrO9VZLQMbEUjkb61qA zPQRpbMCf6s66Y6DhBg8z8QRcApQ72huII1oEcYu92f4ngv0K0mIzhPmLJR2Uh5BjawQ VYiQGZK4WjagEkKivIafKmY4uMzOb1L85ARc9LBtoEoSeQDlgf/ngbAWrlQJWt8QK6yQ MTD9ao0wz3x/kkqZL4syTtOV7S690tvuXQmcmY2FmPR8FsQbUG2nLB8PLZQmciR5mJ5/ lUMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ov8+U6N7p5wQlZ34HTCOUwzpfOCO33LzC2iQnp+jed0=; b=k1HWvZc4/0BZrAuEX2Czmh0upU8zfEYgO9MwTiBzHTNPTPv5xEv7GdQorrxb+j5Szd acUStnDE+08T3tCnT6mZHRkvXhw+D/9z+oU39sYRNH9qNqC0DN11HFaDP8R7DP+DP/lA 6ojOx81mEzsGS33h74yDmohkeB0bZCne8Ev8spvbUROvPjkk5Leny/NpG9iUNVoO8QPL FU0kFCdpqyr2DZ9E0rp5QJlwzEsZNAESfKGdJxjHY4tnw2ZOmcjCoFFSBT8W/02BLruT PaVs4NQIFW6F9fTGuNFyOHAmbAVXjoM+GXhUrUse4PPkm9ZNxknQhq0T8Qouo/D3j61N 0SlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SQPmOS4c; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id b6-20020a92c566000000b002d100cccd4dsi13969298ilj.129.2022.05.31.09.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SQPmOS4c; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AC2E8842A6; Tue, 31 May 2022 18:10:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SQPmOS4c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CBC3383F33; Tue, 31 May 2022 18:09:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1E3B583F40 for ; Tue, 31 May 2022 18:09:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x433.google.com with SMTP id u3so19341408wrg.3 for ; Tue, 31 May 2022 09:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ov8+U6N7p5wQlZ34HTCOUwzpfOCO33LzC2iQnp+jed0=; b=SQPmOS4cBJhaA2+ZkEmEKao+KBtgCQD6bAUvbX0XwO23KSCxnE0tGO5XvHGLrjV2ip Z2D6fWcel7V+C+N/MmZYu3FzF3TEwz7bG7OEUTwGM5ZF84qEqN0/abCncaRTTtgDATe4 FSY0yhTHgWy9aw5/1jzHYgIz2Bf8FnH/3AsNZL6V4zDL6cb82d72Y7+AuGdUOlPChGl+ HviH1PkRy6aevgn9qY7VdV1+YHZEz+Y0NO8MWcB8/2fJKZ/kUcr5na7D4+hYSpWMxf4Y IuMuxwx6C8XbPzNmHi9dwUpriiiz2Hwf9KsJ6UCi1nMyNnRZJ8exN9PcCw8V1SSxZRkA W0mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ov8+U6N7p5wQlZ34HTCOUwzpfOCO33LzC2iQnp+jed0=; b=YIgkWSwfYwbB0nsWdlcGHhoDVGx0nVMjSAo9f7w/jEhiAfFe0o7FXlsc1nUM4tmk1L RltVh/K5FjDO4bjhpHe+bm2wTeMqwhkynxYkEC/eI+4DK6731Yn2Md1Yr8HwJApK6kmW WLAlMA/oCQxSR0zsQJky8gdK6ISVr+EeCk/Q7SVhS3gQo+vbhJMoJxNiCRETr2l+VXuP 71Mj7maYPodv8YLBXMpPsXGOvHAgpynRcg6XJymUJleT2bhJTH14rVG78j/UELhVfqu/ 2lHJGX6Dptm7kj7MM8soguQIZ3K7Js6RdrJJT9wp0dGhqgz8vBR8oBOiq3drOW5ilHnk JWZQ== X-Gm-Message-State: AOAM5317V4RV6SLxu9pvy3AMEnAhpA7qjrpJAY+BpKMvKrg7AuLEXgly /WGYlNXFSNDtfYeDplz5mIaA8keoSM5tJg== X-Received: by 2002:adf:ebce:0:b0:20d:7859:494d with SMTP id v14-20020adfebce000000b0020d7859494dmr50491687wrn.590.1654013384750; Tue, 31 May 2022 09:09:44 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:44 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 08/14] firmware: scmi: smccc transport: implement multi-channel Date: Tue, 31 May 2022 18:09:23 +0200 Message-Id: <20220531160929.931150-9-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Updates SCMI SMCCC transport driver to get SCMI channel reference at initialization and use when posting SCMI messages. Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/firmware/scmi/smccc_agent.c | 54 +++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/scmi/smccc_agent.c b/drivers/firmware/scmi/smccc_agent.c index b7a930b24df..73a7e0a844a 100644 --- a/drivers/firmware/scmi/smccc_agent.c +++ b/drivers/firmware/scmi/smccc_agent.c @@ -30,6 +30,14 @@ struct scmi_smccc_channel { struct scmi_smt smt; }; +/** + * struct scmi_channel - Channel instance referenced in SCMI drivers + * @ref: Reference to local channel instance + **/ +struct scmi_channel { + struct scmi_smccc_channel ref; +}; + static int scmi_smccc_process_msg(struct udevice *dev, struct scmi_channel *channel, struct scmi_msg *msg) @@ -38,6 +46,10 @@ static int scmi_smccc_process_msg(struct udevice *dev, struct arm_smccc_res res; int ret; + /* Support SCMI drivers upgraded to of_get_channel operator */ + if (channel) + chan = &channel->ref; + ret = scmi_write_msg_to_smt(dev, &chan->smt, msg); if (ret) return ret; @@ -53,9 +65,8 @@ static int scmi_smccc_process_msg(struct udevice *dev, return ret; } -static int scmi_smccc_of_to_plat(struct udevice *dev) +static int setup_channel(struct udevice *dev, struct scmi_smccc_channel *chan) { - struct scmi_smccc_channel *chan = dev_get_plat(dev); u32 func_id; int ret; @@ -73,12 +84,51 @@ static int scmi_smccc_of_to_plat(struct udevice *dev) return ret; } +static int scmi_smccc_get_channel(struct udevice *dev, + struct scmi_channel **channel) +{ + struct scmi_smccc_channel *base_chan = dev_get_plat(dev->parent); + struct scmi_smccc_channel *chan; + u32 func_id; + int ret; + + if (dev_read_u32(dev, "arm,smc-id", &func_id)) { + /* Uses agent base channel */ + *channel = container_of(base_chan, struct scmi_channel, ref); + + return 0; + } + + /* Setup a dedicated channel */ + chan = calloc(1, sizeof(*chan)); + if (!chan) + return -ENOMEM; + + ret = setup_channel(dev, chan); + if (ret) { + free(chan); + return ret; + } + + *channel = container_of(chan, struct scmi_channel, ref); + + return 0; +} + +static int scmi_smccc_of_to_plat(struct udevice *dev) +{ + struct scmi_smccc_channel *chan = dev_get_plat(dev); + + return setup_channel(dev, chan); +} + static const struct udevice_id scmi_smccc_ids[] = { { .compatible = "arm,scmi-smc" }, { } }; static const struct scmi_agent_ops scmi_smccc_ops = { + .of_get_channel = scmi_smccc_get_channel, .process_msg = scmi_smccc_process_msg, }; From patchwork Tue May 31 16:09:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577454 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1301712mag; Tue, 31 May 2022 09:11:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaXOLDVF8TMCB+oXD0oMz39mk9QK0+3A+VDkP+1y8vPE4u6SGBbgvRa73mfmFv4EA7EVii X-Received: by 2002:a02:a70b:0:b0:32e:2457:6a44 with SMTP id k11-20020a02a70b000000b0032e24576a44mr32206062jam.232.1654013489510; Tue, 31 May 2022 09:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013489; cv=none; d=google.com; s=arc-20160816; b=tQmOCPB3j53nfwWfiurg+xTXAodQWpjjvihb+Vaa/l6Si0BFlIjIG3jTFqOqqrMwC1 nQYL0YaEK4objmbIe9kljyRaw8la9+u5NXWK9t5ADUIQ7/kibeDKV8PfLQBjHwaSXTG8 sCf2m3d7PLWbDDFQRfN+C0pKeUxlMmwQT3QF0NDxFIb6FvJZSBK0NEuMCx8jihtYFqE+ p52Y9zPQuX5Hzmmb9a3njazcGtnMuh9ntdEl+Y9Zf4Xh60Q0XuulWU4vbk7oR/2VPSum ZSYCuKbnEbD2KtR9qXDIj+jxwAsCXDlODM0D8+fPUDTZaz6oPDAWEGcHdG5SiwcwDJAl dUAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VmQ+NBzdBbI1MtBJIweUrEcpTgG/Mb6wMhltSYi2ho8=; b=MouI+/HOMHv43t2ZFe/K6c5rOHsM77oSxQXFvnELuoifodDk4yps3hvuRw2KMpnEqY qS9vtMDoQIjLUs1wt4IZ9TvxJVuvYe3OXc1qn29Ll3/R+fdd6Oiv1hTA1LIgFwJlIQ7t x8Fe5Gftg1ZBHrGz7+FBMMV/WC7TykIZav2gjB+YjF4Olq/OvIJMblJ3uqutnqoioQOl GeD1bmzjJN2/nIuQ3Dmk9lZU6ftFJ+gGTulD8D0WHSHE6b/SMYvE5L8h15t+J6DDC29P Giv3fU8dqeas3GmqcAbCxdWKQZsI0XyPpt6LR+dB9dYFTIIDdB82y23rbaErYW7Lssbi ju+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DBQkSWix; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id n123-20020a6bbd81000000b00660cf61c704si17747944iof.1.2022.05.31.09.11.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:11:29 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DBQkSWix; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0490E842AE; Tue, 31 May 2022 18:10:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DBQkSWix"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 17C8C83E63; Tue, 31 May 2022 18:09:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7FC9583E43 for ; Tue, 31 May 2022 18:09:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wm1-x335.google.com with SMTP id d5-20020a05600c34c500b0039776acee62so1172049wmq.1 for ; Tue, 31 May 2022 09:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VmQ+NBzdBbI1MtBJIweUrEcpTgG/Mb6wMhltSYi2ho8=; b=DBQkSWix76ktdftAqnxPxsmCVXY+qrZ1fqkS6FkJI9SONgZZQgpCgnvabMKBl8KgaP scnrAjV1r57RqmtEycdvdOPRWsw33c5nWSQkaqsoh3i/6NXswLeOpYVRXTvAVTO+LeDj 5deIcbUT+ESV2WXtTPraFTgQUynT0HFvXXZ3WpuIlc4gsU0A2MzpVMjNoEKMu/wzC6NS Zf/Chm1B8JwacVDFOxPXw5mMpDQFT4LCaF56oX7P4u1tmFb0U0SD1eZC3Os6OOwp8Mm8 m7Exr9WdG6+jbBdu7UorRH8GkK/vDLEQLW37El71C7Fu2TJ/cRD/ylBBzO+CK7nWAvn3 fJ0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VmQ+NBzdBbI1MtBJIweUrEcpTgG/Mb6wMhltSYi2ho8=; b=rSRU7koXjZ+91tayvGSkIc/iL6u9tJIMEE+noPmvQ9O9eXgHI95dMaz5awKikm4GjG +mvkjr4n/IbOkmTIPFJ9ZGZvsPbP1UIE/4k+JRZCUem294r3Fmkgg88OCZkA3QEDWVd/ a5OdKKZV0CcdI0AeuGFW+x++UtpPtZFKDCP/QfV2DABQWm1WhGW3t5b5IVnygW77zqm8 /y/qcgdzRaoFqsHBP+UgqnhzjVn3alva1oiKeOP8FDm+qRE2YCrfd9YB2xWpfPY8UnmT 8N1ktUTHtout82vEl/PlsWXLuXtoI48Rzx2/+lYBkok8qsCPLo8IMgqdLimZjYt1F7/i t9fA== X-Gm-Message-State: AOAM533EA3Hq2/b/5s82BvBCrc65Fhql0fvphMILzKimI7TfIjCZWJ4+ quGjxB1887+VMTrBcMAheW89DsK2HlskIA== X-Received: by 2002:a05:600c:2e15:b0:39c:10cd:50d0 with SMTP id o21-20020a05600c2e1500b0039c10cd50d0mr9626189wmf.170.1654013385852; Tue, 31 May 2022 09:09:45 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:45 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 09/14] firmware: scmi: optee transport: implement multi-channel Date: Tue, 31 May 2022 18:09:24 +0200 Message-Id: <20220531160929.931150-10-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Implements multi SCMI channel support in OP-TEE SCMI transport. An SCMI protocol may use a dedicated channel, specified by the DT. Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/firmware/scmi/optee_agent.c | 76 ++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-) diff --git a/drivers/firmware/scmi/optee_agent.c b/drivers/firmware/scmi/optee_agent.c index 771fa25e989..da5c2ec9754 100644 --- a/drivers/firmware/scmi/optee_agent.c +++ b/drivers/firmware/scmi/optee_agent.c @@ -35,6 +35,14 @@ struct scmi_optee_channel { bool dyn_shm; }; +/** + * struct scmi_channel - Channel instance referenced in SCMI drivers + * @ref: Reference to local channel instance + **/ +struct scmi_channel { + struct scmi_optee_channel ref; +}; + /** * struct channel_session - Aggreates SCMI service session context references * @tee: OP-TEE device to invoke @@ -132,10 +140,10 @@ enum optee_smci_pta_cmd { #define PTA_SCMI_CAPS_MASK (PTA_SCMI_CAPS_SMT_HEADER | \ PTA_SCMI_CAPS_MSG_HEADER) -static int open_channel(struct udevice *dev, struct channel_session *sess) +static int open_channel(struct udevice *dev, struct scmi_optee_channel *chan, + struct channel_session *sess) { const struct tee_optee_ta_uuid uuid = TA_SCMI_UUID; - struct scmi_optee_channel *chan = dev_get_plat(dev); struct tee_open_session_arg sess_arg = { }; struct tee_invoke_arg cmd_arg = { }; struct tee_param param[1] = { }; @@ -187,10 +195,9 @@ static void close_channel(struct channel_session *sess) tee_close_session(sess->tee, sess->tee_session); } -static int invoke_cmd(struct udevice *dev, struct channel_session *sess, - struct scmi_msg *msg) +static int invoke_cmd(struct udevice *dev, struct scmi_optee_channel *chan, + struct channel_session *sess, struct scmi_msg *msg) { - struct scmi_optee_channel *chan = dev_get_plat(dev); struct tee_invoke_arg arg = { }; struct tee_param param[3] = { }; int ret; @@ -237,9 +244,9 @@ static int invoke_cmd(struct udevice *dev, struct channel_session *sess, return ret; } -static int prepare_shm(struct udevice *dev, struct channel_session *sess) +static int prepare_shm(struct udevice *dev, struct scmi_optee_channel *chan, + struct channel_session *sess) { - struct scmi_optee_channel *chan = dev_get_plat(dev); int ret; /* Static shm is already prepared by the firmware: nothing to do */ @@ -274,15 +281,19 @@ static int scmi_optee_process_msg(struct udevice *dev, struct channel_session sess = { }; int ret; - ret = open_channel(dev, &sess); + /* Support SCMI drivers upgraded to of_get_channel operator */ + if (channel) + chan = &channel->ref; + + ret = open_channel(dev, chan, &sess); if (ret) return ret; - ret = prepare_shm(dev, &sess); + ret = prepare_shm(dev, chan, &sess); if (ret) goto out; - ret = invoke_cmd(dev, &sess, msg); + ret = invoke_cmd(dev, chan, &sess, msg); release_shm(dev, &sess); @@ -292,9 +303,8 @@ out: return ret; } -static int scmi_optee_of_to_plat(struct udevice *dev) +static int setup_channel(struct udevice *dev, struct scmi_optee_channel *chan) { - struct scmi_optee_channel *chan = dev_get_plat(dev); int ret; if (dev_read_u32(dev, "linaro,optee-channel-id", &chan->channel_id)) { @@ -316,13 +326,52 @@ static int scmi_optee_of_to_plat(struct udevice *dev) return 0; } +static int scmi_optee_get_channel(struct udevice *dev, + struct scmi_channel **channel) +{ + struct scmi_optee_channel *base_chan = dev_get_plat(dev->parent); + struct scmi_optee_channel *chan; + u32 channel_id; + int ret; + + if (dev_read_u32(dev, "linaro,optee-channel-id", &channel_id)) { + /* Uses agent base channel */ + *channel = container_of(base_chan, struct scmi_channel, ref); + + return 0; + } + + /* Setup a dedicated channel */ + chan = calloc(1, sizeof(*chan)); + if (!chan) + return -ENOMEM; + + ret = setup_channel(dev, chan); + if (ret) { + free(chan); + return ret; + } + + *channel = container_of(chan, struct scmi_channel, ref); + + return 0; +} + +static int scmi_optee_of_to_plat(struct udevice *dev) +{ + struct scmi_optee_channel *chan = dev_get_plat(dev); + + return setup_channel(dev, chan); +} + static int scmi_optee_probe(struct udevice *dev) { + struct scmi_optee_channel *chan = dev_get_plat(dev); struct channel_session sess; int ret; /* Check OP-TEE service acknowledges the SCMI channel */ - ret = open_channel(dev, &sess); + ret = open_channel(dev, chan, &sess); if (!ret) close_channel(&sess); @@ -335,6 +384,7 @@ static const struct udevice_id scmi_optee_ids[] = { }; static const struct scmi_agent_ops scmi_optee_ops = { + .of_get_channel = scmi_optee_get_channel, .process_msg = scmi_optee_process_msg, }; From patchwork Tue May 31 16:09:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577456 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1302141mag; Tue, 31 May 2022 09:11:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBIkALXfKQDxBs0KTtx1cFRVi964pTAeyEAsQq63E3n7sc02h8saN3KNDAsGpom73XCzmz X-Received: by 2002:a05:6e02:1c45:b0:2d3:bb0c:9559 with SMTP id d5-20020a056e021c4500b002d3bb0c9559mr2852783ilg.251.1654013515307; Tue, 31 May 2022 09:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013515; cv=none; d=google.com; s=arc-20160816; b=lGPMG/sqi3ND4TiOVwtOFXedHJJYyr2NQJsvLikLCTPs4/TDmROxbIMY+XgodtQ2eJ i8Pm1ae149KTncDNK6CPEMc1Aza31EzY2sOdOoilylKYrsY6aqG38AIEG9WuFSGhVI70 BBcJsUU4lk7HVzPcJJPpUH3eQS/p2l73jhTi4rztu0HQRuJ6M1EPZbViYQqrX/kEqJNu NS4V6PfINQqIx40i3EM6z+HFqCsInxj/lFv/XAOh47EkuOtH1mdoDn9ZebxJCKsqLIrS 5/0sDuMLY1oIm3s71uWL3myuysRXCiUvHJ3tcklCFluGyqUaYdHchVuRHQDpNaAxoizN 3uPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/2DYzo6aKwa+iW9Y8HNcQlnWBb1YlYUSK8becWxcOos=; b=Cx7t/Qw7z6B0b1nQC8LDLCB4lDzyvk1ZtpLLpTaleePrBMh28a1marNPQ6cAq6wQFa JRC83gR61y0in15r2Df22LoB8ah4KpwTYucTjBB2xu9rfqf9GRQZtnppKgav4yuaCel7 lrkehRqFhX3AJBIbyNr9DbLA5LCS3be/GpTt1f7lyBgcAoERO2gUAwtFLcIubBkmRWO4 9W1z9IA9D3LATk34n9Rt7hG1nSt1lsqMAjEjej54C6VeIOHVSYkgMMYDQeiVdQARbsHp cdNHPnfNXWSIeG96thuBUpQsY9QRgEyAYvt63KviEUldc+IzPoLTtcz3PKZf6BQ3xce5 K8uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zHTb3jx/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id i4-20020a026004000000b0032e22157263si11790704jac.122.2022.05.31.09.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:11:55 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zHTb3jx/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EC381842DB; Tue, 31 May 2022 18:10:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zHTb3jx/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1236383E3C; Tue, 31 May 2022 18:09:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 057F484271 for ; Tue, 31 May 2022 18:09:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x434.google.com with SMTP id q21so8155258wra.2 for ; Tue, 31 May 2022 09:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/2DYzo6aKwa+iW9Y8HNcQlnWBb1YlYUSK8becWxcOos=; b=zHTb3jx/5epWR/PvG1KfrlJ1JEZpawdblUkcqC5jsRQQ1DEDv/gF4uLgUyNQ0DZHkC 3EiBSwmXeLD2LpblGaOb0uKHNslsZOaUZU/ix0E2yPNNVbXYc7MsU06BgwAv4CCKO1Uq msvy6V3j/x4M5LcmNGyze6VontaOxf2oOvNhBhq76QUazH9qmoz2zEpxuvhzgkODxBB0 6tnHtCAsBFOIx/inPNRG9ahbF+81tRkDpLpiOUOgTVnc3Q862WTvVUnm/7mrJIFIzzyZ vEORzGb9p0+NM95avdet1xcKZSJ0SdqnkgzAcNM+3UmDvpsSaMBc6MFMCdM8TJXlTJqi ruLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/2DYzo6aKwa+iW9Y8HNcQlnWBb1YlYUSK8becWxcOos=; b=4y5mWvns5U+ZS21tlvNg6yta4HA2+kiUwQXXK5CwwaDVZkwTLK9fACTp4MLyHZjgET l+jLEL8vlcZ6GszOZBtZ36d9t485LEypL0dG4Mw1APKKoaIpYbPNHeM5aFwrGZ7f3Ofw oQqB2VwNnPVzZTkIdn+/ljY4NcfYyW5HYhMKRNzYSertlkYFXWu0Zau/DN8IGgAyFXcV wHEDfQQpTRidcdyznhWqn7h4gzLs8TglwGJhVish/05qQ/PHVUwKEdGqu5i5c13FvAvO zIVs9Odg7qzpE6BR9J822/3ryQwKF2rLCGLYiozgtxgddcOYpHHJAkRi4fCO3GXG1CHB pAhQ== X-Gm-Message-State: AOAM5306mDBSLYIAkshcnaQL1H3hfP0yJvpaPzKdRM2CUbPxQVB6mA9h gE+w3l/zxyM08Ygt5aZcZJOEiWDHFE3tug== X-Received: by 2002:adf:fd10:0:b0:20d:c38:d43a with SMTP id e16-20020adffd10000000b0020d0c38d43amr51560624wrr.84.1654013386891; Tue, 31 May 2022 09:09:46 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:46 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org, Lukasz Majewski , Sean Anderson Subject: [PATCH v2 10/14] clk: scmi: support SCMI multi-channel Date: Tue, 31 May 2022 18:09:25 +0200 Message-Id: <20220531160929.931150-11-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Update SCMI clock driver to get its assigned SCMI channel during initialization. This change allows SCMI clock protocol to use a dedicated channel when defined in the DT. The reference is saved in SCMI clock driver private data. Cc: Lukasz Majewski Cc: Sean Anderson Signed-off-by: Etienne Carriere Reviewed-by: Sean Anderson --- Changes since v1: - Define a private struct to hold channel reference rather than using device private data reference as opaque channel reference. --- drivers/clk/clk_scmi.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c index 0d0bb72eaf7..d172fed24c9 100644 --- a/drivers/clk/clk_scmi.c +++ b/drivers/clk/clk_scmi.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2019-2020 Linaro Limited + * Copyright (C) 2019-2022 Linaro Limited */ #define LOG_CATEGORY UCLASS_CLK @@ -13,8 +13,17 @@ #include #include +/** + * struct scmi_clk_priv - Private data for SCMI clocks + * @channel: Reference to the SCMI channel to use + */ +struct scmi_clk_priv { + struct scmi_channel *channel; +}; + static int scmi_clk_get_num_clock(struct udevice *dev, size_t *num_clocks) { + struct scmi_clk_priv *priv = dev_get_priv(dev); struct scmi_clk_protocol_attr_out out; struct scmi_msg msg = { .protocol_id = SCMI_PROTOCOL_ID_CLOCK, @@ -24,7 +33,7 @@ static int scmi_clk_get_num_clock(struct udevice *dev, size_t *num_clocks) }; int ret; - ret = devm_scmi_process_msg(dev, NULL, &msg); + ret = devm_scmi_process_msg(dev, priv->channel, &msg); if (ret) return ret; @@ -35,6 +44,7 @@ static int scmi_clk_get_num_clock(struct udevice *dev, size_t *num_clocks) static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name) { + struct scmi_clk_priv *priv = dev_get_priv(dev); struct scmi_clk_attribute_in in = { .clock_id = clkid, }; @@ -49,7 +59,7 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name) }; int ret; - ret = devm_scmi_process_msg(dev, NULL, &msg); + ret = devm_scmi_process_msg(dev, priv->channel, &msg); if (ret) return ret; @@ -60,6 +70,7 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name) static int scmi_clk_gate(struct clk *clk, int enable) { + struct scmi_clk_priv *priv = dev_get_priv(clk->dev); struct scmi_clk_state_in in = { .clock_id = clk->id, .attributes = enable, @@ -70,7 +81,7 @@ static int scmi_clk_gate(struct clk *clk, int enable) in, out); int ret; - ret = devm_scmi_process_msg(clk->dev, NULL, &msg); + ret = devm_scmi_process_msg(clk->dev, priv->channel, &msg); if (ret) return ret; @@ -89,6 +100,7 @@ static int scmi_clk_disable(struct clk *clk) static ulong scmi_clk_get_rate(struct clk *clk) { + struct scmi_clk_priv *priv = dev_get_priv(clk->dev); struct scmi_clk_rate_get_in in = { .clock_id = clk->id, }; @@ -98,7 +110,7 @@ static ulong scmi_clk_get_rate(struct clk *clk) in, out); int ret; - ret = devm_scmi_process_msg(clk->dev, NULL, &msg); + ret = devm_scmi_process_msg(clk->dev, priv->channel, &msg); if (ret < 0) return ret; @@ -111,6 +123,7 @@ static ulong scmi_clk_get_rate(struct clk *clk) static ulong scmi_clk_set_rate(struct clk *clk, ulong rate) { + struct scmi_clk_priv *priv = dev_get_priv(clk->dev); struct scmi_clk_rate_set_in in = { .clock_id = clk->id, .flags = SCMI_CLK_RATE_ROUND_CLOSEST, @@ -123,7 +136,7 @@ static ulong scmi_clk_set_rate(struct clk *clk, ulong rate) in, out); int ret; - ret = devm_scmi_process_msg(clk->dev, NULL, &msg); + ret = devm_scmi_process_msg(clk->dev, priv->channel, &msg); if (ret < 0) return ret; @@ -136,10 +149,15 @@ static ulong scmi_clk_set_rate(struct clk *clk, ulong rate) static int scmi_clk_probe(struct udevice *dev) { + struct scmi_clk_priv *priv = dev_get_priv(dev); struct clk *clk; size_t num_clocks, i; int ret; + ret = devm_scmi_of_get_channel(dev, &priv->channel); + if (ret) + return ret; + if (!CONFIG_IS_ENABLED(CLK_CCF)) return 0; @@ -186,5 +204,6 @@ U_BOOT_DRIVER(scmi_clock) = { .name = "scmi_clk", .id = UCLASS_CLK, .ops = &scmi_clk_ops, - .probe = &scmi_clk_probe, + .probe = scmi_clk_probe, + .priv_auto = sizeof(struct scmi_clk_priv *), }; From patchwork Tue May 31 16:09:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577460 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1302972mag; Tue, 31 May 2022 09:12:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBQUgMdDRZMfb31G1XqN0CPNuDOCjCjC+3MGNQhROGkIRbeC8INEADPci1avO21ZGHS68g X-Received: by 2002:a05:6e02:1909:b0:2d1:cadc:6db1 with SMTP id w9-20020a056e02190900b002d1cadc6db1mr19160461ilu.3.1654013564710; Tue, 31 May 2022 09:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013564; cv=none; d=google.com; s=arc-20160816; b=iMAMwQ4GXQSNOViatv0jOOZGeLOX5vijqKzl3JMYnSQAMTVtHCE0EQkW/HZfPAz1YB HNV7FA5nKVT0WsJdTrMGa4wexPKeN01toRM3jfqianmL9jMCFHptLa2hOiqLHaUJ3xSi RxFADU5xPtbx3xv+6J2krHAEf06pLXPljAV2xzQSof+swA/kZRzWATSUWSIFrRwh1da0 JZCOP/ygkjplOcP1471uUV3nkgeLf1IrRr30FT5qkG1wFFv0HzdI3p9VaBZFgjGbUHxv MyQ2GR/ir02NIHw6g31jmUhi1qBYU9v90HZEeo82RbLFc3UaiPrIdWcTz1ZLPsGKnzwL C2ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iwTuXZOz9+UtxN9wMXSzzohZWLxchdnL7bJCNiUXGCk=; b=wkCJlBL8HgDNUT8RdT9hVqNTM2XtNb0E3QiyhZbeldceFpJFsGoxevPNtd9BOP1FWh LY96viJe7GdDmuKraqppqnTWjZpka5DkkQVyymTgvLh0Jr7E7mbtWxysikxVIWDPpOwH E3SfsuXQohbEp6QTkdRlmIyxq/Myajyt995s2QfpYdakjNE6QVtZwbCZ39ZGT9J8EQhz +wvAFePBTR7b5h5z5QiEC69WGjhSWuTd4kLJpP9WSrnpQ3mBmDN8hvpOx7PyZ0aY1j1L LBb/N5XohhF8zCpj9gj9b27BJMeaBy+DygCVxSA/i61agGGm+GWnjXEJXMofr2hrpy7t MbMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wJ5RTTIE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id w10-20020a056e02190a00b002d1e16a6dedsi16830045ilu.77.2022.05.31.09.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:12:44 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wJ5RTTIE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3DF0984319; Tue, 31 May 2022 18:10:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="wJ5RTTIE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 36B9A83F33; Tue, 31 May 2022 18:10:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5DE4E83D77 for ; Tue, 31 May 2022 18:09:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x432.google.com with SMTP id s24so12021046wrb.10 for ; Tue, 31 May 2022 09:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iwTuXZOz9+UtxN9wMXSzzohZWLxchdnL7bJCNiUXGCk=; b=wJ5RTTIEpEoEqNqr1s6tn3H3L9B9+eglua5vb0e26tRJHubz4AGcK4gH4M6xnYfz6s FiPx83VluP9qF/fve4f025ZXxN23PLrIP0JhTFva+kx6TGJTMmia8UE2XtMGDYKhf7yy sHW3G0tVqj6cNOA2e7Ah93dGr3a5+tqxW3D/WMbME0hub9/WaFtzDGhPMn5f0ZJ2dx4I IZfrJDAcg3znViKy0uCGQExyrSX0j1L2OrkEWSwYmAaR7m0zrFMmNKKwU/r2rlhlo35X Nn4J0s0NAlynco8w7E2b7SJKd4w2PEu/Oowl9ijqXvhBOeanxiL+6/46aNAk6dYESEmh fizg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iwTuXZOz9+UtxN9wMXSzzohZWLxchdnL7bJCNiUXGCk=; b=a64gmfOfA02Meipcld7+ETykVyukKdNFmJpfdHtjaPJqBlLM0XjkAPuEbXki5dHxQZ LR6iK/xrvK4+5MtVr1ZsK/NFRQYhL2uZwIWndvB7JLSda1c8AI33l2qKxyPZwTQlP/f9 LzD6dClBp54OUriFExBIPAHlWhTZj2LGk0w8E8sfQWdq6/a2p4yr69E0kCNrSD9GdVdd dQKjHLmmopyRZxcKufKDa5bhQpFDFuZqntHMf8tp02l+L74cqjZj21hP3jchPlQGGlYM EtMO/UPvowyti0yre4NIod+asPYghbUHKQSRl7qTjuRXfSgC/IIzqs7pKQCt+pAHYpxq AerQ== X-Gm-Message-State: AOAM530VPnDeeFLmHDZhTApjuNQPXGjYrRE57bMjvgmcG3adADOP2GQS I386gS4EqvO+fVBJsV3/MheZ6velRcy4ig== X-Received: by 2002:a5d:6d8b:0:b0:20f:e42a:96d0 with SMTP id l11-20020a5d6d8b000000b0020fe42a96d0mr36053483wrs.518.1654013388131; Tue, 31 May 2022 09:09:48 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:47 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 11/14] reset: scmi: support SCMI multi-channel Date: Tue, 31 May 2022 18:09:26 +0200 Message-Id: <20220531160929.931150-12-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Update SCMI reset controller driver to get its assigned SCMI channel during initialization. This change allows SCMI reset domain protocol to use a dedicated channel when defined in the DT. The reference is saved in SCMI reset controller driver private data. Signed-off-by: Etienne Carriere --- Changes since v1: - Define a private struct to hold channel reference rather than using device private data reference as opaque channel reference. --- drivers/reset/reset-scmi.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c index 30b26ec9d31..122556162ec 100644 --- a/drivers/reset/reset-scmi.c +++ b/drivers/reset/reset-scmi.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2019-2020 Linaro Limited + * Copyright (C) 2019-2022 Linaro Limited */ #define LOG_CATEGORY UCLASS_RESET @@ -13,8 +13,17 @@ #include #include +/** + * struct scmi_reset_priv - Private data for SCMI reset controller + * @channel: Reference to the SCMI channel to use + */ +struct scmi_reset_priv { + struct scmi_channel *channel; +}; + static int scmi_reset_set_level(struct reset_ctl *rst, bool assert_not_deassert) { + struct scmi_reset_priv *priv = dev_get_priv(rst->dev); struct scmi_rd_reset_in in = { .domain_id = rst->id, .flags = assert_not_deassert ? SCMI_RD_RESET_FLAG_ASSERT : 0, @@ -26,7 +35,7 @@ static int scmi_reset_set_level(struct reset_ctl *rst, bool assert_not_deassert) in, out); int ret; - ret = devm_scmi_process_msg(rst->dev, NULL, &msg); + ret = devm_scmi_process_msg(rst->dev, priv->channel, &msg); if (ret) return ret; @@ -45,6 +54,7 @@ static int scmi_reset_deassert(struct reset_ctl *rst) static int scmi_reset_request(struct reset_ctl *rst) { + struct scmi_reset_priv *priv = dev_get_priv(rst->dev); struct scmi_rd_attr_in in = { .domain_id = rst->id, }; @@ -58,7 +68,7 @@ static int scmi_reset_request(struct reset_ctl *rst) * We don't really care about the attribute, just check * the reset domain exists. */ - ret = devm_scmi_process_msg(rst->dev, NULL, &msg); + ret = devm_scmi_process_msg(rst->dev, priv->channel, &msg); if (ret) return ret; @@ -71,8 +81,17 @@ static const struct reset_ops scmi_reset_domain_ops = { .rst_deassert = scmi_reset_deassert, }; +static int scmi_reset_probe(struct udevice *dev) +{ + struct scmi_reset_priv *priv = dev_get_priv(dev); + + return devm_scmi_of_get_channel(dev, &priv->channel); +} + U_BOOT_DRIVER(scmi_reset_domain) = { .name = "scmi_reset_domain", .id = UCLASS_RESET, .ops = &scmi_reset_domain_ops, + .probe = scmi_reset_probe, + .priv_auto = sizeof(struct scmi_reset_priv *), }; From patchwork Tue May 31 16:09:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577458 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1302507mag; Tue, 31 May 2022 09:12:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDA23yQb52bdPMCCepYoJjeBoVVIqE4zh2Xo/zZcoB/s/P9mvfnOiFZHksBXXVrw/ny3Ov X-Received: by 2002:a6b:5a0c:0:b0:660:d32b:df5b with SMTP id o12-20020a6b5a0c000000b00660d32bdf5bmr21944773iob.39.1654013540172; Tue, 31 May 2022 09:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013540; cv=none; d=google.com; s=arc-20160816; b=ZEOmP8WATrD7N3NBS8FVdM1NFTuNMxcC2GXgm/30ClSrTF9bS6X2XMUop6cvzN8CFR 2lwM8bu495I1125tctsELWbiyGy8JMChNtnHOQZLoQJynnLS2HVXAbR3RVA6qV5nLScn Nvm4czTEQJQVnXkgXFnZLK+E12BUqEjg8u+8VZhxev47ERoF6YzXbT5huE9xeHuN6Dc3 +j94qDyauMkajXkKCVT8EyWbjIFVEJGoJHNmLbcC/Dpgc89Fgen/bLOhU74zR6bRI7cU TkuXJSC6tNITVD2fG6th8vtVeBWRDPcVpglDUnYFP3pxSWhWhVCT7o8BgGk9ROv2ZrWC FSUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bBHdViJGuJjkkaael2/r5JxOOahuH/fZqg55eEXV9yg=; b=adHwaHe/j72GV9awK1gYYpTu1KmzifBbdLdyHNx4Yf0TCRcQ0WXcOyZd7pBuKwsfcM aNW+bt/cLmJT5trU5qzOsnOJlsEEMX+ZlsdN3So3ieYl3chH6Iq3u/iwnG8TtICZ4ALK nw9nQqcFBe5U2ceRA9EjyVVOJlvDHMd0r75vvsCl0PC3zxxBWkgbe5Di9xOFGKGaL1vo NRJdOMK8oU86Nc9j6Ilg5LvH9AYNlT8P3XmfDlPe13yoeQWzRmLDEobNrpp0p6xnFJdQ GnNyd5h+dlvNkBQsKxGeJRdOXnYAdrUWqS1S69zw6iUd7/F7W/TAafD41OuaNp0QSeY1 kTJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b8ILpFH5; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id m2-20020a056e02158200b002d1d77fb959si15544347ilu.85.2022.05.31.09.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b8ILpFH5; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC14884318; Tue, 31 May 2022 18:10:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="b8ILpFH5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0CA1B83E3C; Tue, 31 May 2022 18:09:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A489684282 for ; Tue, 31 May 2022 18:09:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x436.google.com with SMTP id d26so13743230wrb.13 for ; Tue, 31 May 2022 09:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bBHdViJGuJjkkaael2/r5JxOOahuH/fZqg55eEXV9yg=; b=b8ILpFH52t1Bi9ldDAw83ZHQBd8846dEPAjLU06HTcoCSUtKaM++wn+3AaPmpwpX8O Sab/3Ly2uyWrP/jpn/eucuf43EvEGyZWPYh387i9fpLzf7chMid/9CThgwnivtcigOOB Qa6Vyem7JHa9hOmHIWKZzRxGVfZNF7RA9gbFsyBq8O9hk2zbcdnPHd9lnCW+3eTff9O2 +6uywUGUulktkgzZXBDKZ/fOVNpI7Qyv6+FujA2F5fhmmWqfA20Q4Yxy62qjZFps+tvH NYgLVtIOcAekdAyZ6AZHG+HskrPWF4HZP1u8HcbRdn242VzSiKV/Nx5tdX9jU8gD7EM3 QNig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bBHdViJGuJjkkaael2/r5JxOOahuH/fZqg55eEXV9yg=; b=fseVD1ys68zWtQGeNRB/vwIUtcMmJoHh3r7Rqj/qMaGkRetgydYjvGhrStCvnmzf+V yUKSpM5qMJkGw0bFuATWX1+h0TFo2rq5MfATmFKstmijULepVXO8ngLyjzL8F9Wsj+O6 ROepESNwnTnzzBNDrTkWCbUtXiiMeyijSlgYVb9BM6+OtWVpuFdhJ1FZn1zzIq8UgV8c 6pkmoQBfmopQRfri+ehCXOV0JqJIvTMNJ2H3J2sIbOFLhyU0FVhbfVW5TvEleddx+0f7 /02F8DUV6q7BbeM0mpG+xcfBWBCUe5cNriBAiysxOqkyHu+mU2tCnwkmImrPfOkbG1tp pE+Q== X-Gm-Message-State: AOAM530r5ATNSwC7Kej0hsHrd7zHtdTDQavwZflyoBByHZ5oc0XM136y TP5w6NS1sUMx9+SHvRUyAjn8/tlnhx1OJg== X-Received: by 2002:a5d:540a:0:b0:20e:69db:4dc5 with SMTP id g10-20020a5d540a000000b0020e69db4dc5mr48814458wrv.337.1654013389390; Tue, 31 May 2022 09:09:49 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:49 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org, Jaehoon Chung Subject: [PATCH v2 12/14] power: regulator: scmi: support SCMI multi-channel Date: Tue, 31 May 2022 18:09:27 +0200 Message-Id: <20220531160929.931150-13-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Update SCMI regulator controller driver to get its assigned SCMI channel during initialization. This change allows SCMI voltage domain protocol to use a dedicated channel when defined in the DT. The reference is saved in SCMI regulator controller driver private data. Cc: Jaehoon Chung Signed-off-by: Etienne Carriere Reviewed-by: Jaehoon Chung --- Changes since v1: - Define a private struct to hold channel reference rather than using device private data reference as opaque channel reference. --- drivers/power/regulator/scmi_regulator.c | 30 +++++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/power/regulator/scmi_regulator.c b/drivers/power/regulator/scmi_regulator.c index 3325ddaf23b..352daa9bbc9 100644 --- a/drivers/power/regulator/scmi_regulator.c +++ b/drivers/power/regulator/scmi_regulator.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2020-2021 Linaro Limited + * Copyright (C) 2020-2022 Linaro Limited */ #define LOG_CATEGORY UCLASS_REGULATOR @@ -25,9 +25,18 @@ struct scmi_regulator_platdata { u32 domain_id; }; +/** + * struct scmi_regulator_priv - Private data for SCMI voltage regulator + * @channel: Reference to the SCMI channel to use + */ +struct scmi_regulator_priv { + struct scmi_channel *channel; +}; + static int scmi_voltd_set_enable(struct udevice *dev, bool enable) { struct scmi_regulator_platdata *pdata = dev_get_plat(dev); + struct scmi_regulator_priv *priv = dev_get_priv(dev); struct scmi_voltd_config_set_in in = { .domain_id = pdata->domain_id, .config = enable ? SCMI_VOLTD_CONFIG_ON : SCMI_VOLTD_CONFIG_OFF, @@ -38,7 +47,7 @@ static int scmi_voltd_set_enable(struct udevice *dev, bool enable) in, out); int ret; - ret = devm_scmi_process_msg(dev, NULL, &msg); + ret = devm_scmi_process_msg(dev, priv->channel, &msg); if (ret) return ret; @@ -52,6 +61,7 @@ static int scmi_voltd_set_enable(struct udevice *dev, bool enable) static int scmi_voltd_get_enable(struct udevice *dev) { struct scmi_regulator_platdata *pdata = dev_get_plat(dev); + struct scmi_regulator_priv *priv = dev_get_priv(dev); struct scmi_voltd_config_get_in in = { .domain_id = pdata->domain_id, }; @@ -61,7 +71,7 @@ static int scmi_voltd_get_enable(struct udevice *dev) in, out); int ret; - ret = devm_scmi_process_msg(dev, NULL, &msg); + ret = devm_scmi_process_msg(dev, priv->channel, &msg); if (ret < 0) return ret; @@ -74,6 +84,7 @@ static int scmi_voltd_get_enable(struct udevice *dev) static int scmi_voltd_set_voltage_level(struct udevice *dev, int uV) { + struct scmi_regulator_priv *priv = dev_get_priv(dev); struct scmi_regulator_platdata *pdata = dev_get_plat(dev); struct scmi_voltd_level_set_in in = { .domain_id = pdata->domain_id, @@ -85,7 +96,7 @@ static int scmi_voltd_set_voltage_level(struct udevice *dev, int uV) in, out); int ret; - ret = devm_scmi_process_msg(dev, NULL, &msg); + ret = devm_scmi_process_msg(dev, priv->channel, &msg); if (ret < 0) return ret; @@ -94,6 +105,7 @@ static int scmi_voltd_set_voltage_level(struct udevice *dev, int uV) static int scmi_voltd_get_voltage_level(struct udevice *dev) { + struct scmi_regulator_priv *priv = dev_get_priv(dev); struct scmi_regulator_platdata *pdata = dev_get_plat(dev); struct scmi_voltd_level_get_in in = { .domain_id = pdata->domain_id, @@ -104,7 +116,7 @@ static int scmi_voltd_get_voltage_level(struct udevice *dev) in, out); int ret; - ret = devm_scmi_process_msg(dev, NULL, &msg); + ret = devm_scmi_process_msg(dev, priv->channel, &msg); if (ret < 0) return ret; @@ -132,6 +144,7 @@ static int scmi_regulator_of_to_plat(struct udevice *dev) static int scmi_regulator_probe(struct udevice *dev) { struct scmi_regulator_platdata *pdata = dev_get_plat(dev); + struct scmi_regulator_priv *priv = dev_get_priv(dev); struct scmi_voltd_attr_in in = { 0 }; struct scmi_voltd_attr_out out = { 0 }; struct scmi_msg scmi_msg = { @@ -144,10 +157,14 @@ static int scmi_regulator_probe(struct udevice *dev) }; int ret; + ret = devm_scmi_of_get_channel(dev->parent, &priv->channel); + if (ret) + return ret; + /* Check voltage domain is known from SCMI server */ in.domain_id = pdata->domain_id; - ret = devm_scmi_process_msg(dev, NULL, &scmi_msg); + ret = devm_scmi_process_msg(dev, priv->channel, &scmi_msg); if (ret) { dev_err(dev, "Failed to query voltage domain %u: %d\n", pdata->domain_id, ret); @@ -171,6 +188,7 @@ U_BOOT_DRIVER(scmi_regulator) = { .probe = scmi_regulator_probe, .of_to_plat = scmi_regulator_of_to_plat, .plat_auto = sizeof(struct scmi_regulator_platdata), + .priv_auto = sizeof(struct scmi_regulator_priv *), }; static int scmi_regulator_bind(struct udevice *dev) From patchwork Tue May 31 16:09:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577459 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1302715mag; Tue, 31 May 2022 09:12:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcTpjRpfayyD3nbwa4gJ38Lbls7giFMsGaqNddz+1CW0jpbK6Vr9Wrx83ulzipXUjMwqCJ X-Received: by 2002:a6b:fb05:0:b0:657:655e:a287 with SMTP id h5-20020a6bfb05000000b00657655ea287mr28275810iog.211.1654013552097; Tue, 31 May 2022 09:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013552; cv=none; d=google.com; s=arc-20160816; b=tTQniBMfe5GXAgy83kPftH6GgDMFqXkPAXwC/SlRmJaCqnk54d/G3wPdcN5RQv53oT KkRvsSatKia4W+b8wk/hIzjvLSNCwQA8Zk6xhyngEEpJlcQjrVPpU1/WvVyurQ3jEewp 1txKmCLE9gJl86Yw8jgpFK3323UxWh6pWjmtdt9kTmqgvLQOyjXvpzqF3NPWOvSANOCK tCLA/NuAQtjrc2eXIYuDW5BYDHAo4a2UvKuX4okU4LNT18KB8oKjHDxRLBQOvdDjm7mr nV41mgowTKQb4q1zMvlsFjxbvxvVqiIFaBva5Yok3IeTHgD+SOszI5OS6Y5Ep73EBVta XWag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GfRWehbfLmvtTZVN78yMOQgVSehOAIauaunA+eD0YO4=; b=jZMgFkeHHX7HS8mSVbNV01LIhW7Z1VfYEZt2EtDBEuxUzkwE9z10Ix4NVPbqH9QCd0 ghCHMVivCPSu9+i0DhKTSW3W9ri4TjjcIwPmx5XDV7vzB3J10K6Au5TILEtpj98Vbqv7 I+WOn73ARTABHnIZ+Z3hbOyY8wV5jjbhEhtryPCXI9E+1Jnku/gr4au27BAjMv9NxjUs 83Urxu3DleXGBH/GbiQylo5VcA0eLuK04kbag7A6//FS39R1ONyPRdO+Fh3TX8Tpkhcx a36ntWCE+jB7xUqjtaVfQOZ7TdYEhfeqjjGrFdHdrvTft1ROHI41JyQGzvAPWof3XW2s fjRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TD4f4gKT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id r17-20020a056638301100b0032ee0615d1fsi15785489jak.67.2022.05.31.09.12.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TD4f4gKT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 53BEA8432E; Tue, 31 May 2022 18:10:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TD4f4gKT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2F3D1841A5; Tue, 31 May 2022 18:10:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 755F683EDE for ; Tue, 31 May 2022 18:09:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x434.google.com with SMTP id p10so19331101wrg.12 for ; Tue, 31 May 2022 09:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GfRWehbfLmvtTZVN78yMOQgVSehOAIauaunA+eD0YO4=; b=TD4f4gKTEXlU+c1eC4jLU8zDvUD3Jaq/S/mm5mb/32Ph/oxdTjAZA+mYUdC5HsBLtM +bDsak9pI7WFvBCz1wxl9Zo3GQ9Qv2+MUR4SQcIZzCaQsIZmX/qToB1TA99VI1raXcqJ tHdGOPwGCZfS+c3bk+QN5NV1mUGwjeXkzognLBBCkUCna/C4df2cK+H5+FmAWBVzmmhr wdGllksquFWyQVXzEDU/EQOwA2TSt2YOgqqu0x4vub2575EITenqIB9JMmYqDARc+ZZ7 MsJb2oBuGOPJhdLPc6ubxNPSxFoaf+YKUPp8sCDXZNS1c7f17G1jdBLM1cIkPPQvJirP 9cZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GfRWehbfLmvtTZVN78yMOQgVSehOAIauaunA+eD0YO4=; b=Hi/Kkr+z9olpAV0ot3POwBWDdB7h4X7KmxUygm/1rLrglcwUAQwrmA1UxwTWW5Alcy oucfuqRzQkK5mU/zUSTyQTmdd+9GNnGLUStK5g0MlMUm8yHU/03ZD1XiBtnBwOvCE51E cGF9pD94NZJQ4VqCNXjeXBDG9mLxEaUM9/hZBnOotWPH0jg0gglC8YrYZjTDWF9ot3Eo JM1d44hMc7a8/pUrHQrZio1iZcuPAxJ+iGpoJZanoSMsXQjF9fs72xIXPvXvdSqXKd1h qY6q/gBSu7gvHL9iQPFVDkJBbbJwGdEQ0iSgvp8E2RSeolkukaYUCzbNCYoBTiErLguW 9LTw== X-Gm-Message-State: AOAM533T69UPlX1jzJ/7Y3k5TKWNQGvlKvj3bogAyvG7j2a2R6z9+oL7 GPrjCeGXtb2yqF0yYYAZcGWsONO/0w/0XA== X-Received: by 2002:a5d:6847:0:b0:20f:c0b6:d783 with SMTP id o7-20020a5d6847000000b0020fc0b6d783mr44858389wrw.101.1654013390845; Tue, 31 May 2022 09:09:50 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:50 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org, Jaehoon Chung Subject: [PATCH v2 13/14] power: regulator: scmi: simplify scmi_voltd_set_enable() Date: Tue, 31 May 2022 18:09:28 +0200 Message-Id: <20220531160929.931150-14-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Simplify scmi_voltd_set_enable() exit sequence. Cc: Jaehoon Chung Signed-off-by: Etienne Carriere Reviewed-by: Jaehoon Chung --- No change since v1. --- drivers/power/regulator/scmi_regulator.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/power/regulator/scmi_regulator.c b/drivers/power/regulator/scmi_regulator.c index 352daa9bbc9..801148036ff 100644 --- a/drivers/power/regulator/scmi_regulator.c +++ b/drivers/power/regulator/scmi_regulator.c @@ -51,11 +51,7 @@ static int scmi_voltd_set_enable(struct udevice *dev, bool enable) if (ret) return ret; - ret = scmi_to_linux_errno(out.status); - if (ret) - return ret; - - return ret; + return scmi_to_linux_errno(out.status); } static int scmi_voltd_get_enable(struct udevice *dev) From patchwork Tue May 31 16:09:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577457 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1302334mag; Tue, 31 May 2022 09:12:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf6sB+Pl0NpFvFWeDsqThYTlnoGKDLL0XKh5g9rLokRU52DZm0hitHF2mIWTMZeiVYH8sx X-Received: by 2002:a05:6e02:1a42:b0:2d3:afa3:bd with SMTP id u2-20020a056e021a4200b002d3afa300bdmr4874753ilv.142.1654013527956; Tue, 31 May 2022 09:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013527; cv=none; d=google.com; s=arc-20160816; b=lvFbx5JBHOWtkGSpp4xU2ogSb1Er2a1M1VKPmHfOo0byrJ1i7Z7oSJc+NiY7kShqw7 xXcF24ROqsLZcN7vmr5XXCpbqinBkHeEFcbyPxiliZFat8MJ5v9G0sp9BQ4erbY+HRT3 nf6VZLTROA6ESR6iXSazYlshVtJBdnH4murBwEudbfyITuX6p04xqfuAeGODr07CfiST i2hWbFcmW9JO+aqqXxV58j6VXEueezA4JjQiiDrDuXukl7Qfj57K/DsptfxRRJfZxC8U CO3tuYr4emqCIzHd4A0TvNoSXlWO+BFFlUyna5xqxkdwmrFJfeVxifffjSvpjzwQNyDZ SW3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aOQUVjcd80eT9g5ZI09/rRjgTm3cf8zed/+wUM6diBg=; b=ThnBSwa8YU/jTmri5d33jzIF2rTHcTm5irXgDdA8fmPSMcLCG3OrjcpC2UYTx+Nash PZi4HjkWLxc2YsxGrSZymdcPD8LFwzxyITar8DwBt+DFEGwPByH2L0/DQ9eS5ZSeSQ1O pF9DUs5sANy39+vwiXzl80cKcgvR38dzYe7fr4F7dlAzc1Xpo7TRrC9ftdJEBQhafe/e s+nIybfU8KOOXy8OaR3pY+u0/ymBBt+6qxx07hjg7tsFOMUDoeCp1f9v7kos0XlF0mMU YWZNt25oS8YtSX5j+jiH6LjKNZRCNPkiAfJIsf3/4Q36s+euNWYaMXMJWMAHJXOOHN1o VcBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YmeMIgMG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a1-20020a92c541000000b002d1e8879de8si16706754ilj.20.2022.05.31.09.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:12:07 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YmeMIgMG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E8A06842D4; Tue, 31 May 2022 18:10:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YmeMIgMG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AE6F483DE0; Tue, 31 May 2022 18:10:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B89B483F40 for ; Tue, 31 May 2022 18:09:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id v4-20020a1cac04000000b00397001398c0so1509503wme.5 for ; Tue, 31 May 2022 09:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aOQUVjcd80eT9g5ZI09/rRjgTm3cf8zed/+wUM6diBg=; b=YmeMIgMG69Wg5HiWbH9iXPtvC3rOUF3WkYjHd5EDh6s83he2eXatY+j237G/ps/4U4 If09Q7YacmgK5o/uwggO5dauahP0hROYtzyn8MdxUB4K/om5HxCuoDTRIbO/wnBIgCpo n4f+UlKw8qlrUATSImUVpgayEC0+IGn1Pz3ZSo0sYbYi76N2B7qbxaPWsd1XMtYWvS67 LXXBvTiOyGcG2iPmyMIu6kFZ2dZac1pZAzaMOvyBldUbdrDiE3aOOl+D0ux3BBlnC80/ EM4rOL+4m/4ljzeycbXr22Zm2IbNCTsp2VWi13UC9JfzHNcyEmkoeC3Z3yzctRJLICc8 gMig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aOQUVjcd80eT9g5ZI09/rRjgTm3cf8zed/+wUM6diBg=; b=Lddt2ce3ApO9OiwJclrYDoILwk6/6IcHdq8qsDwYVIL37ZpurjfMzD/0mIfepJe0Hs pCW0bmI2UFimHHIzVj61hpkwH+BGQqaqEWNV5I6PRnntTGIY4xebaAsCDd2cFrODOIIh YTv3V7xD+LpT0lmqCoIqsxBqt66yTjyV+fVnNdPhk3qnTuqJvsL0fwBsGOdgfEmy6lbJ HBYYhxAMvPxuILsQOyCrM3yCrFPjVYiW8OcJfg5nH5NF1CFrkkQVi2BhBUAhAtrYy87c wsq6O3unhzLgmJbpF7LUlI6NbqVhPa8Dohwe2ptzQ/4o5jWWhVAAW3r4WBBCHn5TvyIx L+vA== X-Gm-Message-State: AOAM531XHzGc+YZn2I14Uk6OokxzMGyk3/XPf8cvCVQDv3NHP9lGIrHf XaS1JsFD2WClS0YGfufSFBjuhOFYGNEVEg== X-Received: by 2002:a05:600c:4f93:b0:399:e654:4481 with SMTP id n19-20020a05600c4f9300b00399e6544481mr15425741wmq.164.1654013391938; Tue, 31 May 2022 09:09:51 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:51 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 14/14] firmware: scmi: use multi channel in mailbox, optee and smccc agents Date: Tue, 31 May 2022 18:09:29 +0200 Message-Id: <20220531160929.931150-15-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Updates .process_msg operators of the SCMI transport drivers that supports multi-channel to use it now that drivers do provide the reference through channel argument. These are the mailbox agent, the optee agent and the smccc agent. Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/firmware/scmi/mailbox_agent.c | 6 +----- drivers/firmware/scmi/optee_agent.c | 5 +---- drivers/firmware/scmi/smccc_agent.c | 6 +----- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/firmware/scmi/mailbox_agent.c b/drivers/firmware/scmi/mailbox_agent.c index e63b67c5ee8..3efdab9e723 100644 --- a/drivers/firmware/scmi/mailbox_agent.c +++ b/drivers/firmware/scmi/mailbox_agent.c @@ -43,13 +43,9 @@ static int scmi_mbox_process_msg(struct udevice *dev, struct scmi_channel *channel, struct scmi_msg *msg) { - struct scmi_mbox_channel *chan = dev_get_plat(dev); + struct scmi_mbox_channel *chan = &channel->ref; int ret; - /* Support SCMI drivers upgraded to of_get_channel operator */ - if (channel) - chan = &channel->ref; - ret = scmi_write_msg_to_smt(dev, &chan->smt, msg); if (ret) return ret; diff --git a/drivers/firmware/scmi/optee_agent.c b/drivers/firmware/scmi/optee_agent.c index da5c2ec9754..2b2b8c1670a 100644 --- a/drivers/firmware/scmi/optee_agent.c +++ b/drivers/firmware/scmi/optee_agent.c @@ -278,13 +278,10 @@ static int scmi_optee_process_msg(struct udevice *dev, struct scmi_channel *channel, struct scmi_msg *msg) { + struct scmi_optee_channel *chan = &channel->ref; struct channel_session sess = { }; int ret; - /* Support SCMI drivers upgraded to of_get_channel operator */ - if (channel) - chan = &channel->ref; - ret = open_channel(dev, chan, &sess); if (ret) return ret; diff --git a/drivers/firmware/scmi/smccc_agent.c b/drivers/firmware/scmi/smccc_agent.c index 73a7e0a844a..bc2eb67335b 100644 --- a/drivers/firmware/scmi/smccc_agent.c +++ b/drivers/firmware/scmi/smccc_agent.c @@ -42,14 +42,10 @@ static int scmi_smccc_process_msg(struct udevice *dev, struct scmi_channel *channel, struct scmi_msg *msg) { - struct scmi_smccc_channel *chan = dev_get_plat(dev); + struct scmi_smccc_channel *chan = &channel->ref; struct arm_smccc_res res; int ret; - /* Support SCMI drivers upgraded to of_get_channel operator */ - if (channel) - chan = &channel->ref; - ret = scmi_write_msg_to_smt(dev, &chan->smt, msg); if (ret) return ret;