From patchwork Fri May 13 06:26:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 572067 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp197508mal; Thu, 12 May 2022 23:29:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjLA+0DqvcylyUJL146gt8I/Q7FKZKrP+aVHEBLu+L8l4TasikUMEqjvDPReQfFq6XlE2H X-Received: by 2002:a17:906:b50:b0:6f3:ce99:3c39 with SMTP id v16-20020a1709060b5000b006f3ce993c39mr2903333ejg.52.1652423341307; Thu, 12 May 2022 23:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423341; cv=none; d=google.com; s=arc-20160816; b=L/mGbzVAD74gzeaQThUAFNKivd629DZShActBkZ1DO+fn1bw4VrM1uF/7FMpd/qEIs oKAniUQlrvfofGikZh1eDqWEPkuA1WtvLt0UidkObHXm7FW0Gb8uSCy/n9tQksNoczDk is63N1Pyq76mcixQF54ClFOf3TGctAUkAMg0Pd/MIxJ0Z7KS0iZ8MvTMFI7Xd+Qjohfv gWS3vsXe6nYxQbQCPo1rsW8XlNT9AWwZP5X9vtordjGyVNiTwJZpKyOv3RZWCMAoV8Bu HzOG1JA52aKc2sVRVwdpvUzhuEmYbY2i/SYjFrgYqbiK6trgshaD6leXC+8Mkl/OCj/R bxww== 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=jjbR+XalpAPWBAWu4p2Csj0a/PWkUgrRWyA2eBo5k1A=; b=AoC6QdL7Ke1hyaeIWdYgFZtJRVCL4VA8yjeVGHS4bwO1NaFveS65aBcEiwQfCOwlT/ RdehHO4RMnkif+BP3SemFDBtEMsCBIMcEOcd69VO2HFziXHP5juiS+AuKluTxPy2hVe3 IUvMhUEE9ad/smxxiF+2QJxnKPTerE9XTB1/nYgyxLIkOTeR1yDO80468MSgDllZdTPI rtW8ZAw010KbA6/os0U5BmfyHwMCE5RCS6AM1JKHEYt9WX+On/nki6jyqctFMan6GDy0 5mVLnYrk3H1f61hvvmXjrEnAFvczc73C19DoFe05toM8/a6K/7etuN2hl9CfM3ohnqFy Iorw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mbSJJj01; 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 c2-20020a50f602000000b0041d053799bdsi1215978edn.493.2022.05.12.23.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:29:01 -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=mbSJJj01; 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 3ED2383E51; Fri, 13 May 2022 08:28: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=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="mbSJJj01"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B409F83E43; Fri, 13 May 2022 08:28:30 +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-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 7BF6183B63 for ; Fri, 13 May 2022 08:28:26 +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-x431.google.com with SMTP id d5so10046711wrb.6 for ; Thu, 12 May 2022 23:28:26 -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=jjbR+XalpAPWBAWu4p2Csj0a/PWkUgrRWyA2eBo5k1A=; b=mbSJJj014IDM/eXcT0MBH4axzR8UtdGzq5elbfnTmrLBZmoPGMwwHcp8xlWlV1NYG8 HzJasq1F3lc4Z3nuW94MRzMlY6RfMXAQ1Ylr2eBFJT+NWhPt3eGO4pz/LKczP6pTIuv0 cqN+K9k/DyxDnBgdChfsILx9OB+NgRkOsYBsviA47fJORat8h2HbSi86Y1brsYOPF8rR 13ZLRRdudNZKXu8xl6GLAPQrrUytIEcUoZkcvbJnjyvToDjPrAaz4AfblMUFwrMH7dej rDTHwT9o5qYlzN6E/tbIUTrWQArhOWEYiqmSGhSomYJUUtBKigk3rgbhXUvNGzFmVyoY hZTg== 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=jjbR+XalpAPWBAWu4p2Csj0a/PWkUgrRWyA2eBo5k1A=; b=CnpLf3FKPpLN1dDEyTtAlRtBtKxNj5Ep9h31L7aXoJMHhlG2/gys844tnoWytQjIgu yakArTynareuHn3cCPDTAxWYMOPmbkevAd8teZv7d8gDaTfdb4o4VPYUXb+0nBpikhFs /i9oiwpXf4x2oC/9F2n1i/wCSrKm+BpurjseelNpRJRZyh9Kn6fRiOB1hYqcTIdAYVYc gCHDw3Pt+Ug68cegiU1y1DRVDVQ8BOdz4lYY8woMS5saIszOJmugOFh3H5mrKnOkmNAx cKXuKkhoYDkhhxMaPhpvPporLABEU9JP8kaAcMMf2qMgsRcgJedS4rHKGluhT1FE0QNe u8nA== X-Gm-Message-State: AOAM530LOUxWQTJRsHWSgnLUcRlKrxjlszJ/cF+V6XtXQ1cd64j3EUzk F8+vJZAcb7riWQmvkXehPPUaET2jDjVhvw== X-Received: by 2002:a5d:59a5:0:b0:20c:5603:c0c3 with SMTP id p5-20020a5d59a5000000b0020c5603c0c3mr2538874wrr.521.1652423305545; Thu, 12 May 2022 23:28:25 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:25 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 01/14] firmware: scmi: optee: use TEE shared memory for SCMI messages Date: Fri, 13 May 2022 08:26:09 +0200 Message-Id: <20220513062622.155433-2-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 Fri May 13 06:26:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 572066 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp197409mal; Thu, 12 May 2022 23:28:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/7PGtesdoLHcH3hSmkHlSH/bBFjiuGaA7QO7ybwvBpYsskvgAr9cZVQY8ZTK4V7kUswOt X-Received: by 2002:a17:907:da6:b0:6f4:c257:750d with SMTP id go38-20020a1709070da600b006f4c257750dmr2821289ejc.669.1652423330335; Thu, 12 May 2022 23:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423330; cv=none; d=google.com; s=arc-20160816; b=Arai1bTQ458rHEnlUolaVtwKxjfmJuRQpcmk2O4o/Xni5j6yM4naAiGCrlQFSCH0aL gY40d7gavr4qabPuAvQlAWJPaAjBEJZAWX5tlUFyUXf+Ce/oxKSzou7gBG5TrcdfGJeu sB0SKDvfRRBPtZgamhN1O3XQ6Mr9g3x9KpHdQuJ3dtZOmVxQ+YtEu2YrKcQ4wv3rRHXj MqjHtnlpX+DT2DTHfTmniggQnke/zK2ZhwECyUIXVJPEaw0htuyEAnccM1aHCG80G6Oi KjIw/je5wCodhoh4MpPDlxKWDe4eabukyM6UN2z1XU6o2YpfFEo8VFT9DZQV2r556+i6 ffrg== 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=NQq7QWlrqFBcInYMoEkd7FKyNNBGbU3mQoAicWN9W9c=; b=P4dAPpSX4rOmSAhNux9rpJ1A6DG94iCCHLMEBImiiC5EDn1iBxWzq0vG6xNZMpomxZ 9vBqKmUbRzJG5X2gXC9nJJSLyQktbeVX1AXWR4Zr7a7qvwus5WuQfzvp1zBiIjI1Yy5g ABZ/9sdkjIsRDcpmxdLZ7H9xvNJofXkdyKkRiDSGALaPbwuhG5nCELMxO+aIq8WF0PRk NeYZIN2NwMwCxq2YT2bxuBtKjtz64PEuQGnRYz18MkmEzosQxYPcnTZDb2YxN7qXUe30 oU2mtMoo/M/19r4LhxBKBf8lEHR7CeH3+tZhM8Ont/zsNPACYKR3MS+LQ3uWAyq8pawp Sb0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dMFhyvSy; 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 qa40-20020a17090786a800b006f3da8554f8si1472947ejc.247.2022.05.12.23.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:50 -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=dMFhyvSy; 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 1073383EBA; Fri, 13 May 2022 08:28:35 +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="dMFhyvSy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51BF183E92; Fri, 13 May 2022 08:28:31 +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-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (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 427D383C62 for ; Fri, 13 May 2022 08:28:27 +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-x42e.google.com with SMTP id t6so10055032wra.4 for ; Thu, 12 May 2022 23:28:27 -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=NQq7QWlrqFBcInYMoEkd7FKyNNBGbU3mQoAicWN9W9c=; b=dMFhyvSyBrnuMass4L6avYfVuEGgSrTe3o9DEd2dppBmzE0nfCCODBi0AlkLUNOw3H RQbbVSUbG2aKvdMs0+G5wOeeV1YDL52kiGSDlO2M0vaWjGsKWkC7pmDxQkrwZ2x3mMAX A9jDN5bNndb+mMEntJ+3EN+oOFZL18//vSd4ndKFcYPYrOwPPt7CdAEvsZ09H38XmaM+ beQhEgu6EOHLGEiPkbxxpBmCZw7HdTz8Ui8EiQpV2Eg9ovJsHBi/sxexjwPOYGzcjUMe dNiFenjAgoRMt8fWEP03Muuocua3amtofEjF+Jynr8YINMzNVP7F2IszfXaUMKgi/1U2 1JoA== 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=NQq7QWlrqFBcInYMoEkd7FKyNNBGbU3mQoAicWN9W9c=; b=snV3byvzqEt//iZHVGoYn9/tOsxz3zkNDNUQmKlraSxSgdF43Ro5Kkd3esQvi5XTID rZ6u9lRBYf4RHRsGTWBoElMZUy/ENbUegEp3jzEfWoy1UQd/kHfNHg+SCSHbbCnsWKQ9 pCGPM1n855uovO9/tFq24jZMI76gqF54rBPBThG/+wiEbTBtm8X3xuXP2X50vLSGj5bg xCoJ7zimF/uLjV5O0bNzrfIlVW0q1PcUK2/FCiaDIuH201+EBs+CDSQK5lzKUB/lpNMl cycwIiKs7MYTAzp5MVywS45tTymrlYHzXjoMELeLGQpz+JVJzsmNFd0d1zyMXKAOljL4 G25A== X-Gm-Message-State: AOAM5306A9kmqfzuzWLQt22PER/HumX3z9rwFXzlJfE7vrTyi8oM3mRG 58MdeAp7FMuMSJqfoU1mFS/JJIYpXVSzrg== X-Received: by 2002:adf:eac6:0:b0:20a:e096:c4 with SMTP id o6-20020adfeac6000000b0020ae09600c4mr2507905wrn.139.1652423306544; Thu, 12 May 2022 23:28:26 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:26 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 02/14] firmware: scmi: optee: fix inline description of PTA_SCMI_CMD_GET_CHANNEL Date: Fri, 13 May 2022 08:26:10 +0200 Message-Id: <20220513062622.155433-3-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 Fri May 13 06:26:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 572068 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp197611mal; Thu, 12 May 2022 23:29:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQdLM1CQ4rPShpzMz+KMIqiAL7PATwEs5MnMiFvdbFNTaEOliyfxQW9b7kCLuRvputP8NB X-Received: by 2002:a05:6402:190a:b0:427:bbd8:40c3 with SMTP id e10-20020a056402190a00b00427bbd840c3mr38892936edz.245.1652423353908; Thu, 12 May 2022 23:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423353; cv=none; d=google.com; s=arc-20160816; b=gmsgeuGM5hixCnZV1yCYWho9zMxIVmZfZVmkXTPktC4NFqtY8lpQqZVr+fdQ366hKw P7MkIJGN8+XNCY9bIpJgc2owe/jZgfEq13HKOQOtN8ed6j3gcKD7BaJml7zNBuOszrqe 2F8J3JUHT+5KIcvM2KkoODblp7epNZK1GiVsEQL0JbwTZowZXqPJMIBwGbqJbNedX63s Rop8HZcJxI8ZLOdiyE6EPph5MJsZx2sBtH5mvwOBS7TM9OCsltCp9Ay1m1s3mgdn86hz ME7fZwrUQ+/ExKf7r0TJYybRZdC6/e+RpavNZscaw45D7iKsF0lYav7t8HMZGr0Ac5Yf /QBg== 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=EuxrXpNkAq03Z5IsFSEd6GrPwp9jlgZ9vqG+JylqL8M=; b=Q024B4Yb+D2Vr9gkDBn/Z2Tus2nhxu7De6KHFIpK+lY3QulHB/V/CvyO+BJW48iFxQ J+AVnQ3qxBTcoI4//xONxi3LZron+EXzfgF18qwbv113EwtCdTrLARzSFQUWlkMzHbcF 82ZLGQXKlGg9ENSrEjFr7T0DeBeqZ7Q17hPKddJ7K5zXfhOwMSzU+3CqK1X8ZGTRHTJl FirBwImzg1pt1BD32w8m0RYGjcN83hCjSH1D6LbWi7UPke8M2vfGpnk0dWcg/3hLJ6m/ cbpx9cR1GZ02+PPGiH1soeZSSxD2i+RiJl676BBfeht2LgkRkydtY4+nYOXH5bi6jiTG EHyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="q2HAsFJ/"; 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 nb2-20020a1709071c8200b006f4568123b1si1268271ejc.962.2022.05.12.23.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:29:13 -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="q2HAsFJ/"; 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 397F983EE0; Fri, 13 May 2022 08:28: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="q2HAsFJ/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C815383DA6; Fri, 13 May 2022 08:28:32 +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-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 9647D83DA6 for ; Fri, 13 May 2022 08:28: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=etienne.carriere@linaro.org Received: by mail-wm1-x334.google.com with SMTP id n126-20020a1c2784000000b0038e8af3e788so4186424wmn.1 for ; Thu, 12 May 2022 23:28:28 -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=EuxrXpNkAq03Z5IsFSEd6GrPwp9jlgZ9vqG+JylqL8M=; b=q2HAsFJ/s9Ce3F6vlZHfeo1VxZsdc2KtPO9oQ1gMdswpWgy4l6cvgnifpWmY1UiGya kVrMmcEQKpWF2Ss2/PV87tLWF2tGaS16CprgFmiv2qOInJyeTcpm7E3WG2xZXt/EUpw6 2Z2DZavir8AkK8NK2tl2YCqhWPGrfFicsZO0QlGZCts5sBjcWnRtIv1nMKY1HPmxxIvt D5TrUQ/NPhEHyk++Tv8WJqEZrUW73+EExqku1gZslYBl6JnDHe+5BpEj1rrw+jvjRypv hL/qJ5bFi32yDMhMwBrK8AgtDJOFRarvhNAek6M5BcP31tsPYo6gCIH1vjQ1dr2L66Fz IzPg== 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=EuxrXpNkAq03Z5IsFSEd6GrPwp9jlgZ9vqG+JylqL8M=; b=JrjqsT1/yfes4xdNvT4WFmlbwDxzFiNuNFCw+DpK6a+ieeigWTyqdZOIDuSmxBDMEk 8YorAAunfpVijanU8vK0ctToYUPepNSFFOdiUy46qOqtzyHn01SFE7p6X7bjQ1gnBIg3 jl96pZmnFlIZetUMRnqg4vukl1L4jjBakrwvoVgSvw3L3DWeBIB7dveXyxamBRwb4wzc I2ZHlxOsV44LgPtfcUZLnAju8O4NLr52UL6TnhrT0cuGVWFFLi6rThaw9jdlG+mNe3Gz upX1cz92c9+A87k5dd1oBFwwhY2sNfdR1zdWQW4va1ffDQ1Q7xwUWhByb0+jCvjqwacm V1Ww== X-Gm-Message-State: AOAM5323U/qZynm3Jzwg5XujXa51iwnQUZq4xZXzblAy7uNIZjBgvVn1 Vg1Ztd9k0luEfqea3+++2WnT0VICZOfWBA== X-Received: by 2002:a7b:c5cd:0:b0:38c:8b1b:d220 with SMTP id n13-20020a7bc5cd000000b0038c8b1bd220mr2956937wmk.118.1652423307699; Thu, 12 May 2022 23:28:27 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:27 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere , Lukasz Majewski , Sean Anderson , Jaehoon Chung Subject: [PATCH 03/14] firmware: scmi: prepare scmi uclass API to multi-channel Date: Fri, 13 May 2022 08:26:11 +0200 Message-Id: <20220513062622.155433-4-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 Fri May 13 06:26:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 572070 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp197801mal; Thu, 12 May 2022 23:29:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF37rxW4Jz7qPU1xyBs8yf8BxgNWQJzg9K8zvj2xFGxa1JiuSNei+csVJxeUk2b68HKJok X-Received: by 2002:a17:907:7e83:b0:6f9:1fc:ebf3 with SMTP id qb3-20020a1709077e8300b006f901fcebf3mr2977177ejc.403.1652423377998; Thu, 12 May 2022 23:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423377; cv=none; d=google.com; s=arc-20160816; b=sU6Qu7DhUbXqRB5N0TT+IrrQadvzTzPoiTVs1pzoxFVs1GjP1TRk3NBR75xVXSuzed 4hp27RDOCFDxsYhhWXzEqrGL5qsXU3Qt/GyrSLpjY2J+2ywv0a3F8JtC0Zsnqu00IYkC uIh0oDbEONruLKFef5aarDBfDGXak4oKUZTqzs4vuE/Bhu82fs27WiZ0Y9DBboUj0hxe T3/xzkwCjJEHUx7Y1r0BZ+PFsRDU7kt8LIEuT52vAo9hZbOmslPfBUM0ZDtcsMi8g1iy bZt4LrOihw5JK3kEDCOvf5xi7Npt0YegAPmB3Tp4VayB3YbAARI0xyCA7Sq60CuIgrzS 2DUw== 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=ehodpUW7yVvaXwoOOkgGmiAdepzuj9jv6A8OLbbMpWQ=; b=SdcJUQ4QmhzMQ2Gxpod0Pz2+gk0ZisJNSfAj+uMZ5XDOrb1EGjkHpkLpIkPKAONLWF 965f0oQ5lN44RFo0jjbtWz0SBvmUxGaUtBtSqStzTdYibbiNzWk4f5lL58sXdUGLbuaQ fhQhmkruFaHA5DRTucDiA0f7/n6RdeMa7w7hjNb0x3ztB+7QKI2UNDAh/Pyhri8J4dvX U0/arb/QLH+8VLSGvVqyNxsNErgRt2XRad/HU+MKvukpsBYYVXJ5CgoFdZCUuopkF6mW 0jE8FuoRGOlgm3qDdmDe8LDlv4BbuHy+LkIspUDm4IoqjJYjDXxQGVwsENYssljFw0rD n8ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nCMoXEBl; 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 y17-20020a056402441100b00427e10fe80dsi1455740eda.547.2022.05.12.23.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:29:37 -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=nCMoXEBl; 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 2475483ED4; Fri, 13 May 2022 08:28: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="nCMoXEBl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9F4C283E49; Fri, 13 May 2022 08:28:36 +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 97D5A83D8F for ; Fri, 13 May 2022 08:28:29 +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 h16so9347322wrb.2 for ; Thu, 12 May 2022 23:28:29 -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=ehodpUW7yVvaXwoOOkgGmiAdepzuj9jv6A8OLbbMpWQ=; b=nCMoXEBlaridFD5FEL9qthSVFB4sFXssDuTsAGdTgqyq1DaRPb7rZAgejEKymCQeq9 XHzMXyWFxdOnLWJCQlIdQZZ3CvCESY8U8ly6HA9OXXWhm/FCOXA+qHv4/QAkCxeGEppH HkYmitQlDAS+z3wA3/a+ZgrgZ8Hv1gz6JZLkzA0F/uQfYDqXy+6nrfEnOOvPY749wKHp hGwZpODl/uB073/DlEq3gautSBygq1C7d/jEyqXwCF8m7ZYMwuYauvCqKp56aeuP/mog Q8gXZqUtBqcTZXyp9yB6M9V6oX0QGeeJ0sPF4KMhr3YhlgYLp35RL/zWm+G+Csacf1Ra /rmA== 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=ehodpUW7yVvaXwoOOkgGmiAdepzuj9jv6A8OLbbMpWQ=; b=HAe+I4O0OuXi5dBDogO99yChFP6SuwZNrwjRpqJGrdXA4etnUMUIxqpMv5jOVp5z+j 2OuIt1h7eGN6pBejKPs2MBZurc1bGITu1Hmd2XpqWcR/prH1ZxNEMnk/pAFT8cU/XzUJ WRF4YO2rjYgtZI2Mfo5P0mW7hrxBiW7pfeIeSJEV0yTE32LtkMsA+97xc5ywZUqteKp0 PJy7qdzkut24VNjJdhl8PiwY8aiNaKkM5JEGE4UPSXszw/m5i/BuxpLgsxARPCyQp0Hw lXkR0zvrUn0YorifSk6swqbs1UG475EG5cqk7cteYHZTyJ4fsxI0kzebbu0y8USAyL29 5iVQ== X-Gm-Message-State: AOAM5330Wc1rGCSnJw8wPZtVzAMwt2Df3RGLlou7kruGfWl6QWfyA2uU 6ob5Flkm+alz/9vmer93kUg8DRxWld7jlA== X-Received: by 2002:a5d:4344:0:b0:20c:9156:8ec with SMTP id u4-20020a5d4344000000b0020c915608ecmr2579537wrr.71.1652423308790; Thu, 12 May 2022 23:28:28 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:28 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 04/14] firmware: scmi: prepare uclass to pass channel reference Date: Fri, 13 May 2022 08:26:12 +0200 Message-Id: <20220513062622.155433-5-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 Fri May 13 06:26:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 572069 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp197691mal; Thu, 12 May 2022 23:29:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxfJ03MBe43wgzLNLZZ9w6rmXRekZ04mW9A/to0/VGGFw9aAQo35/7iNQbGifQ8bLm+TLn X-Received: by 2002:a17:907:6d1c:b0:6f4:4089:8257 with SMTP id sa28-20020a1709076d1c00b006f440898257mr2921772ejc.682.1652423366029; Thu, 12 May 2022 23:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423366; cv=none; d=google.com; s=arc-20160816; b=NjdxQjuMDoMQXzv2kGMYNqEUwlcaXmamia+zyS0yruH2LR/NmqPF+xK1d+laGB4vK5 TIbMdlBDZgbW+nVxknyv1f8jwPwBkMcePooqGCEJBEmfANnaO90tTsC2k06Dm/cA6eq0 b8xpPlv9YNTEcWrL63DWI2E15OoY6XW2Au4R3RadpS/Rm7P25rXc1+92owNluf3Rod/I 3UEDVgUrTfphs5OVfNWxjYnnF/3+bb3v/BLBmGmiRyguWOfOUV0JdX4g/ghdNgqFBR8w /rlbFO+UVfzm7x8mJ6x9TpwxnVfWVq0VMMZmgdVJIaez3gxWqGqTPKawna2UtqbS8vUL 6zGw== 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=moaGrljTW+1UmBsjRq1ZnDHCE8hqTiGO7oGBWbgGEB0=; b=XRi50RtRMsMXSz8Y1llh67UglJyVgTIxp2R9eMqpFl99QG6dVZQRX0MzVwBgrFPo+X WUm6hs+j7BM6OSExYV1+/dezBHidfsal7B47DULWiT7Zhki21TpQo2WAQSXq+z/KQqAk h3xl+3baYKoMzzbUP7wB7CQgKDLgboDaiY3yb0R/ZXXgP4YfvVgRZrGG32OdoY/B8sAU YpTtSY2jYyL5tgEJ4pqSs0ngSiUOguRx0Qh1vA6PVacadVes43ir2daqqrceNeb3MsFB vVkpasKSpxW6VvCWhqjm6yOrl8MFxyHkvPRHtQ7sJRVVWehFoLyW8YsUvzAW+d4L06Hj iHIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="rQmuUL/R"; 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 ji8-20020a170907980800b006f384307fc0si1324531ejc.343.2022.05.12.23.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:29:26 -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="rQmuUL/R"; 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 E142083E3C; Fri, 13 May 2022 08:28: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=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="rQmuUL/R"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B684283ED8; Fri, 13 May 2022 08:28:35 +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-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 75C0683E49 for ; Fri, 13 May 2022 08:28:30 +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-x42b.google.com with SMTP id v12so10006379wrv.10 for ; Thu, 12 May 2022 23:28:30 -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=moaGrljTW+1UmBsjRq1ZnDHCE8hqTiGO7oGBWbgGEB0=; b=rQmuUL/RO6M2TE62OQZUiLk7gyO7+2KlXfihi7BUnI4uk49NjTzSkYbMQhID9sTQDf OPWMrU/3DOlrW8LfCOiKkoO9M8qq64nAzyaJJILwdA2uLKsVRa6+wmZ/kCbIN6bp+2lh 2g1G+7h9yL4Mrn8f3AzAIcYP0N8AUOgrXhGFBCoFiL6wyL6iI4tKRHeggdpdYbQdJoBn NOt8R7oAlvLARXaDJoAz/dzCjGh+kTuQmDfLKiXPrMxB37oBB595jwtX9t5c9CymerBk qCePCXy4JBvESRaefWmm8zRisroTQSSPfWLCmqQnZ+aoMKQn0nSiYupfdgN0uYjL90Bl xvgQ== 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=moaGrljTW+1UmBsjRq1ZnDHCE8hqTiGO7oGBWbgGEB0=; b=l0jwvBzw1eCGF855iGMmcr2bgK86BD0uA0u+PNuf731p/YPTSBqdt0IFcNwuOnBEDX wTsbf7lPxrL8c62rDZwzeOWx9rs3ecUERZB3DLG5MDR98ttZJGygjTRAWeUuXSlC8U7i pHZwxDjxKLz6EMGLUMG41goLE79i5wFQkj7ok4m2ip9cXH9zVR7YXyBC+E95RyPWdBZc CfPhnfKJQfIJBqipkpuV4IgQcUjUBxqQxBdKJA3b5ri+f6q9e31082OD5jcf+jbMfuwt k7gMBu3/L3+guIrciZ0Z5MNWU1fsx9W6d6azNaF65yC2Chlm/MB+6Gf75obf05kVjpej GlAQ== X-Gm-Message-State: AOAM530n6spGtsK4Aw94gTVxL/r8/YbVpii26iO1HGzyQQcE45Wj1T0q AujNb58hriyMG7cyldlOgC3Ix4x20DuBXw== X-Received: by 2002:adf:d1c7:0:b0:20c:4d5f:e57f with SMTP id b7-20020adfd1c7000000b0020c4d5fe57fmr2479027wrd.453.1652423309688; Thu, 12 May 2022 23:28:29 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:29 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 05/14] firmware: scmi: factorize scmi transport look up Date: Fri, 13 May 2022 08:26:13 +0200 Message-Id: <20220513062622.155433-6-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 Fri May 13 06:26:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 572072 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp197956mal; Thu, 12 May 2022 23:30:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoDZHZk4Z+Lu29oOrKmZQsE8g8PpmVZr7AyBr3t5czRElVVykNyjaThXanYV7ZeaxthFAb X-Received: by 2002:a17:906:730e:b0:6f4:e9e7:4f4 with SMTP id di14-20020a170906730e00b006f4e9e704f4mr2767966ejc.509.1652423400908; Thu, 12 May 2022 23:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423400; cv=none; d=google.com; s=arc-20160816; b=SvfGrLb76yzPuxhXFmwMKTWFn0ZU6BsxPoeH3W3oQ62Ul/tShuKBCE15EeR/f/WEy2 wL1stNa/S1aZmhjBZq+U2WzVXs2xjVwApfZEKp+L4w3iV+j97byo/HwwQD2Y5ocE+hqv c7rQnNvM46x0RH9NGq+EjlKXBX3awSYgQFZGFnryIBxWeo8E8Lf/aTn+QOI7sDxhakwM tDHxTYgwmaj7/ABsbYHRqDWG/vzJ/umkYXf32Um8k8oqFyvcfJV0YJvUQLE33epxF6hj vohMGyULveRu/wqRQOYoZgd0jhu7yB/IMt9jVI1qhUyoDNuA0Ujrl35WkTQzEPKGvcmV 5Tuw== 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=cB91w0HN0mWNy1INhoZb+NF/dnvAQl0H0z9Whkb/1Jk=; b=S5Q+DauseBnJV8WRgXwB/dkJleASNyvbNjDWwMsCyybe64ZuyOH5rmeqqN2fjw1trY HhBBpUzJTlWannyp6EelY2/Q77xs6BSIX5xS9/WQd32YS7ZwE1DExgvC5kQf0Tm/gnqf EcI/1lw/Yd+WABiEga4AXyEQgMEqfcgSfNlj21S35afpKgwxs+89/Y4gtgHZz9K0AGGP Of0xgthaHxUSHGl6unAFQUAmSciZ4NcezAHZIStO7ol6euFQfRCYbTDfXhxlAiUWnmQy aQV8jgObNg5NPcEHRHr5tH+LyKq+5d5E6U4aOI+jyBWL1ZV4006WwXwwPRAz0BbWrjOO IrYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uDJS8HZa; 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 sc40-20020a1709078a2800b006f3a9502509si1462509ejc.121.2022.05.12.23.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:30:00 -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=uDJS8HZa; 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 B208583F2F; Fri, 13 May 2022 08:28:57 +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="uDJS8HZa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0ECA383E49; Fri, 13 May 2022 08:28:38 +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-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (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 ADADA83D5D for ; Fri, 13 May 2022 08:28: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=etienne.carriere@linaro.org Received: by mail-wm1-x332.google.com with SMTP id n6-20020a05600c3b8600b0039492b44ce7so4174464wms.5 for ; Thu, 12 May 2022 23:28:31 -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=cB91w0HN0mWNy1INhoZb+NF/dnvAQl0H0z9Whkb/1Jk=; b=uDJS8HZaadr7PMrhAQAeAy94NxmfOLTdwu6Uc0TsYXfdewVvGnXrHK5VGlZgkMI7J0 BNFeT4DAzp93C7IcxR/vhlLO1HVQgnjeBZ48etaLXZCedyd7mPt0agfBJn39Jf8qksn0 YVPU5xVRETTm71FZtfKR8dVRja/ISCOLddsaIYE5iD9Ykg/Tmg0uTfD9W+0jbbJUZcUg OBO9onNK8cBfojCammjeQwplaK3sCTxzXPkAPuHqqK5i7xvqW2x++03ukYgQypPW5v68 XLAg281Uc9eIa8BJ1bjtvVh8vgGs3O04zm0QkWmbBcPLGMrjqALpr2O0bqnMrv7ceXWz 1YPA== 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=cB91w0HN0mWNy1INhoZb+NF/dnvAQl0H0z9Whkb/1Jk=; b=vkYmH/D6nTS4l3SxIUpEx16igdMWeLNxhNpqDvrzxXgNfYRaMTL+AOWBxG74t0jgg8 k7liF/2jnEkZ0fbosZCT1OmpTOz/i9hW1/rbHCje1ayovi8rIMAikg+KeCB0C3Z6pgV5 HJRRDI+lHeeW69L7GPsYUbF5f/zopLpg+ZA+ONOOQFmDp0hBG63zDddCgvmhKJrwdU+b q08MOcODTo6GmjDmqG4Kuwe7e+/tDTW4JS168UmkKNUGOVAOjjiSi9+XbyXfC8fGSuS+ Uqc9MdmVJ4DSID+RiAl+rTI6ca4DlFsfzExub9YNDJvnod2JQ5SZqB95Yv892OsSjEYO wAAg== X-Gm-Message-State: AOAM531HyZ25kmaMWswHZNKFHWgBuldOXMkJELZwPbfi4D9GIHQ7ulzA 1VcMQCg0DF8Wb+WTUZg/V1f3g7Xgh2mU9w== X-Received: by 2002:a05:600c:4fd4:b0:394:8e96:6d3b with SMTP id o20-20020a05600c4fd400b003948e966d3bmr3003835wmq.180.1652423310601; Thu, 12 May 2022 23:28:30 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:30 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 06/14] firmware: scmi: add multi-channel support Date: Fri, 13 May 2022 08:26:14 +0200 Message-Id: <20220513062622.155433-7-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 Fri May 13 06:26:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 572071 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp197887mal; Thu, 12 May 2022 23:29:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1uPkxhyrVdO56yP3zZDaNR/2dJRnIfV3hn+rAjK6px90Pjm+gJgkNA7GVGU3TtP0yTyWW X-Received: by 2002:a17:906:a383:b0:6f5:132c:1a14 with SMTP id k3-20020a170906a38300b006f5132c1a14mr2930859ejz.21.1652423390392; Thu, 12 May 2022 23:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423390; cv=none; d=google.com; s=arc-20160816; b=HaTvhkooi7MmAB9dmfUCwpDJ0Ue1KsIUrJE98G2cEwCdeJfqQ1klEBFB84G5XSi+NQ LQJ6Lfdrvk55NfvlwafUbv5N3gWTlw4zHWPNaIE/e+WODncc2GlRsGDhFmDGkeNJz3CY K6kvga8BoNQ0FOJaADxqMQa4rmiyoxdh2m0VdfyAVu7PKH53BIlb2qO+wvISp7r7gD40 8VtwWc0gqWiWMSTZmFQMKQ7XDaiU+X3jbyvBwrmv9rRL5v+br6OdkKaS09fghKlXaNnX XP2aS22uLod0TfN6rzRkb5/H7UXEr+Km+vwTre1orqi6bKkPRx9OskV8yNaWfPlsN9AQ Vn0Q== 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=x4/6O7aGugEjAcYT4t+60iUD8Qi1BBUN+5oRpySZRDc=; b=RiEQmnQxt4ll0qHU9EFYO+XjsCHZgMywQ0o/pQzs6t9Z9X4AdgXCPTnZYWZx4xgjSf VHknEl64b+914UYODLNQ7v/N1E8t7yh01nKmEbxWkpHnAB3pvVYVPzPwNWAocQC2RrLV 0+TbaM8DYAOaamUON+Jg52sW+LWslofr2//rAve7a9vculbXq7+gi6So2Z6wbIxvlH6f LDpwB8VAslef3oh4k+AaQq8ANvtov1UGJpeMOM7C5U2pJh0XuyCgKxcxwvKOAfDRJCfh NzCbVbVfJiM6bHSytckTHFTvhamVG58ZEjo9PKTpf3qynt3ZZy6mOFHGoY+nnKs3Po5M Fy5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jmiFiHqa; 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 ht16-20020a170907609000b006e8cb75fd59si1332479ejc.723.2022.05.12.23.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:29:50 -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=jmiFiHqa; 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 3F48F83F39; Fri, 13 May 2022 08:28:55 +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="jmiFiHqa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 385CC83EDD; Fri, 13 May 2022 08:28:37 +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 9F5E683B2F for ; Fri, 13 May 2022 08:28:32 +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 a5so6237258wrp.7 for ; Thu, 12 May 2022 23:28:32 -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=x4/6O7aGugEjAcYT4t+60iUD8Qi1BBUN+5oRpySZRDc=; b=jmiFiHqachl3UFa2Z6dxKmaLKQAa+SIXk1Dt3DNU+XDokhEt7xMLguBsYdanLMzJtI Q/yKfIZUHCBAW4IvnII7itIwUC/vO55c1s8zk14N1GF53okYk+ro3BaKXcuq/EGoRo19 BhL9WaZxA1jTxgfY135u/AdhhPcKqtGWhYSg/5EtHDuWdxS/1f+KMfWZbRbQrDakWA4Q TEnBQvOe44376F4wa0bSp6JZA1nsZclQoSxp07MQLfllEck4Ttu1/eLmVqIcgFk6LIDI LMYHHEyMgnDHMEKVRrSdvaL/VEnlrdysseTLJ2Jro7hj0ojuikSKmZGxF4vmGY484yuj +JYA== 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=x4/6O7aGugEjAcYT4t+60iUD8Qi1BBUN+5oRpySZRDc=; b=MWTvixX5qDhekpYnY05VmsN32HWz3GxJQ6sot1N3I3Ejvojcyr/cUMA8uUL5zgtcxk wIvzO3bQeUfTyY6VUzbXK06B99C8wo/ybaucV/m8kOpPGJU4/gms7VrWinGb+CB4Pn3C BfLk7PkH9jI3DM1j1MySkNSQZPfhyUiiqv5eDkFff9zfj7Ff4DA9ywWnOg4oB1VqmQKa c+wJPXnH1gC+TZ/uHinbvPoDpi7H2+pP2Xza9kdJtavZBoq1berrkpchJsAFcyZWyEg2 xQUZ6SemvzdiA4MAFMmSO3R4JxutWI6Uc46VIUzgF5vrZnNHaLZfjrPAlVgPaGDt++r0 84jw== X-Gm-Message-State: AOAM533heY8AB1HnqSmSEeeoHRzG9NmSpHkmCvyx3Inl1ipDExidV7U9 IfoLwWeRov7F+t5p/jTjB0AOZoDRn5FwGg== X-Received: by 2002:a05:6000:144f:b0:20c:6090:3040 with SMTP id v15-20020a056000144f00b0020c60903040mr2428350wrx.479.1652423311671; Thu, 12 May 2022 23:28:31 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:31 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 07/14] firmware: scmi: mailbox transport: implement multi-channel Date: Fri, 13 May 2022 08:26:15 +0200 Message-Id: <20220513062622.155433-8-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 Fri May 13 06:26: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: 572074 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp198155mal; Thu, 12 May 2022 23:30:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykXnMMqe+vhxGEo48MKpMcsauxqnwZ9vtuTySlfM8nSsgAjZ8ORH+49+0EoQoUGDKQ8z6b X-Received: by 2002:a17:906:5cb:b0:6cf:954:d84d with SMTP id t11-20020a17090605cb00b006cf0954d84dmr3015000ejt.560.1652423425421; Thu, 12 May 2022 23:30:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423425; cv=none; d=google.com; s=arc-20160816; b=wS8Vzr9W0hCkjMLoiEER7Xio4EGIFAaQNpcyC8i1oM7mo35ulblzewVChcGOVF+aNN zvvOYoEaXm7p1q0WVPGgIRFr0b0uTY6CXwaGlUdsu0VN13kZ3mZ/VclZEFEetIb56X4n uFbR03vD/B9SflcUIiAXzyV4giz0cmgn1fgj+4se76tLMUs5tS2K2dmPhqSPBqsjF+xM mGpMLdCcSf5roIymTpwa9N5Ckytqbk/zi2aB+RZywZ/tDuLbOyTqq8QKBGdDZK8Y4zSG skRJkVzy4U+LG9hNrd3hiujlIxcEAeMOdHcT/9e6wC9+zEtpfzVtta+TbYDDJwWQYcJL 8sJQ== 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=9jttvUYr6F4AjwMC4ongrei2VaauMhS/a1N5PQBi55M=; b=XV5Gnu7sxgjXv85fcYOfFhzZDtFwQqTj7CbOr3EiYFV0uEPlypu63nFJK6JcxlaRyL Aok2RzfH87jOcTUdJd3E9ZznPlM6LGp6Afm2L/AsRLvcwmsdz6tJ6mZRZhI/3B8/pVuq pcy/GiTm5hc77PgFzYej8lTTMmZ67TLR4dyiF8ft0T3pnJJsiDVMTTSdeQ4nfVkyJuia +KxvQJ8U7/OxPerI6zPtpTn6SFpIdiiudKIhz8xq41Svbyj45woqUeLIvRqVcby0NnXz c+RZNvSpe9NlN0OLy4ft0W1adftg1pmYRaEEb6eeu4Fz+wzqUkH8f9tx9ixzRWOpf4s0 83AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S9a20Zxl; 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 qk20-20020a1709077f9400b006f387f81489si1350846ejc.302.2022.05.12.23.30.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:30:25 -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=S9a20Zxl; 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 4FF2E840A2; Fri, 13 May 2022 08:29:12 +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="S9a20Zxl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D50B883E3C; Fri, 13 May 2022 08:28:39 +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 41C4983E92 for ; Fri, 13 May 2022 08:28:33 +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 c190-20020a1c35c7000000b0038e37907b5bso6375571wma.0 for ; Thu, 12 May 2022 23:28:33 -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=9jttvUYr6F4AjwMC4ongrei2VaauMhS/a1N5PQBi55M=; b=S9a20Zxl7fibXWD0ONHRmw6zayo6i6pbr0qLVMd98jV67jv37iPSVSA/NEXb0mi6Uh HSyFEy5O2X2/opbAr7x8wmsD1j0H3GgxttCF/2ekc1OMFXMwYzVgSMGWHbEo3/IfQCyn ZVeatdsqqgAv400mUS8tIxc1JAOGeWLiYNExTo/q8iIGwD6RIRmmIGaPemlkbQXvzw+l +ShoSvBFu8iFn8T2+SCMgs+li0gLJZrJyEfPPBiGtC36N2Q+XRZu/04YxiXrC+kNsWLk Hwasjpn9XKiVsrgM+/6EqbPIA8DVAyvwNCQwr8++h2TlagT1elUYpNiIRbIWZr0ewc0b /QPw== 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=9jttvUYr6F4AjwMC4ongrei2VaauMhS/a1N5PQBi55M=; b=PmP+M/GLAoDHm54Xbx2wNjuj+JCyzWsu8um+xRhVX27CJ3irJxRB48WARVEUkqbpVd pH1CxsuCVERfDph7YbxITsUofWkEPUatO3o5bcP6dcy3fDXzEDmx2U+GJ5Xd19uC/dE5 iwSIksH8DmdX2zSbrGNJX8l/R9mrjkrbbPlAfOeW13+K+3EVM9G8/nhXNK0OA6xeONTy 91JGU9Y1zv9fg4vT/3yvcc4XKDLBRKA4YrYxAPf39jgWr0WKLFJGaM0BTzSr/10Xq3EI eZ91VxYf8/Mq161Ln7E3IqfH6I/fB8pEgCm2IzYRLK/IpRrbGRlbgLt+NpYq0zHLVc4v ahkQ== X-Gm-Message-State: AOAM532R0GbEMPyRamf3NmbYuATNKJubulbQvlVVAhUQCRxBfntIjzuC vwgpdvOHXY25wY5NdWQ98qCrLstIvh/7ug== X-Received: by 2002:a1c:5415:0:b0:394:2c89:4f2a with SMTP id i21-20020a1c5415000000b003942c894f2amr13509268wmb.144.1652423312539; Thu, 12 May 2022 23:28:32 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:32 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 08/14] firmware: scmi: smccc transport: implement multi-channel Date: Fri, 13 May 2022 08:26:16 +0200 Message-Id: <20220513062622.155433-9-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 Fri May 13 06:26: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: 572073 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp198090mal; Thu, 12 May 2022 23:30:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3KXUi79BIzyvD37iR+lPMFIvGTEagXB66ZoWadCQ3HDVmjJaWEl7jkBionyCCKuS2Km2B X-Received: by 2002:a17:907:2d24:b0:6f4:3152:3d1a with SMTP id gs36-20020a1709072d2400b006f431523d1amr2870842ejc.324.1652423416940; Thu, 12 May 2022 23:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423416; cv=none; d=google.com; s=arc-20160816; b=nj9beV4RLP9uOCE4xmnNYC7HNjnU6ltmVRqyVdye8KPidtiMFWtqV7lhEuadsTESIu nwE6IEawHGH6CDCysa+a3CK6E2CkL4NkKiUqJLIuFLs5GzwrpOlZKeZMyMAF4oYoBsRV dVs09DII798duIzm8vn/0+9UqAWlMckq5WIgQnOBhcJImVk+/DaR787O0jLOtnw0XfzP n8V9Zn6rnP2qme8vqgeCvqTJH4xekW9rTAmY/OMZ9bs+0F5gm6z6LtyMZ4aT0xV81W/q A3vfVyCR4VgsIB1fURdGHWGp4HU/R+5XaInyv1ELpT3TOUdY5fWLBA13L6u5QVaQKTAE Ltgg== 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=ZzPYYKXq07NjOsbh/QsTJ+bAeJ/a0q0aVDyUvSJeXiI=; b=GvFU5GdElSxT/ME3y0dG/lQQC4I9WFd8XP8t5tuD2wpXBuKrePZTSDctDZ3gKEOXMe Q8wGBIf5ihu6XOTQ5E8BFCnXjAq3aEH8q40iWeTtX3LYSdKM8ghyNw5vRCCbKKjcHAPh 2U/N7LZV+gkEWuX3XuYWZZgNLj5co0xvR+jTsf4unUxORh9CDZaoX53SLXjtrDG9Rg2U TRQKZBX2Mmd+a6j/xqfEOWgeSa6VIw1mxa8yeWmilhft78ShWEn4pcgU0J5opObrzBwL XenNVNwmpdisVhYTRUOJPAeZtYOOmknPrnpsJxRBjPuCrIbbBSstybhNEzJECACpw59R OIew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qTRL4buU; 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 oz14-20020a1709077d8e00b006f3bb6fe60asi1418387ejc.275.2022.05.12.23.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:30:16 -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=qTRL4buU; 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 E0FEC83F53; Fri, 13 May 2022 08:29:03 +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="qTRL4buU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A7DD83EE0; Fri, 13 May 2022 08:28:39 +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-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (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 4A08483E43 for ; Fri, 13 May 2022 08:28: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=etienne.carriere@linaro.org Received: by mail-wm1-x332.google.com with SMTP id k126so4224335wme.2 for ; Thu, 12 May 2022 23:28:34 -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=ZzPYYKXq07NjOsbh/QsTJ+bAeJ/a0q0aVDyUvSJeXiI=; b=qTRL4buUlf42R0HB7WFRAh/0bOi2BUXXI49DU8bShuhfpu9SFZa4oiiPwEvSnwvQ57 qlHdcvCLRRYJWlpZkYiP1t5LPcFoi185Ep4k2kFfk98+r68T7+wYbg+vV8UotVEtqomj oOy1s48IVCEvx7o2miPcLrqwK69kA8vNnbIUkIE+lA2kWqqI+hroP3tgtyGXg8J8t8jm sHYFqDdVPROHbXG+mYWqHVeTvMKLKR6RT480AYu5s+KyJ8SCcqUzBoWT+vTzX4gNNjVZ IBFrqVXEdSUXF3w2WWC20bZjqw2PqG3OI35I8IohtRHxnkgbfXFPqMQuLCDDl2W5jHV+ ruOQ== 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=ZzPYYKXq07NjOsbh/QsTJ+bAeJ/a0q0aVDyUvSJeXiI=; b=qbmBL/hKbx9BpUHeYSTUwCjThyZC91cxotTcXkhSwbVh5EwURxi6prdp7z9TRV/XEM r258F1nJGbBur6lY64Kz1IJCMrzAzeXGfOOQkLaVf43Wp4/Cr3/+1BpzJf5gL9RU46Us D7tfQb3PWy0/8vVMyY3Eh7Cq5syE0IVDV1f0Ocsevx+AlKhGlmUc5u1WyNVTs399UTQb Q1ODWH1pNLdxqoGW90q0yoCHYCJzwCte31OwXGPCWMT2+TbmsKM57cBkZ4g3YRb1+nEX OSAnXss4NVplro3gwytfiuRcVBsqi5VU2SM6v5Ts0udP25n95Ab3DoGmaXTJrNBVvaic adSg== X-Gm-Message-State: AOAM533f4oHCWvFFt6GbFd2fF/d3alKsc4OtEBEHsp0DKECkEFOL6LLb xB+Zj6PG0rhk965vi+stntf2ryp3RnphUg== X-Received: by 2002:a05:600c:4e91:b0:394:8d30:d6dd with SMTP id f17-20020a05600c4e9100b003948d30d6ddmr2983353wmq.21.1652423313436; Thu, 12 May 2022 23:28:33 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:33 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 09/14] firmware: scmi: optee transport: implement multi-channel Date: Fri, 13 May 2022 08:26:17 +0200 Message-Id: <20220513062622.155433-10-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 Fri May 13 06:26: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: 572075 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp198251mal; Thu, 12 May 2022 23:30:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcu1/2Knmc634LDaq2HY4rB8UOs44WXaZW4HU5Te/bGYmHFwKZE41slh1TWljEsMsV0ES3 X-Received: by 2002:a05:6402:3508:b0:427:b100:b825 with SMTP id b8-20020a056402350800b00427b100b825mr38338768edd.268.1652423436389; Thu, 12 May 2022 23:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423436; cv=none; d=google.com; s=arc-20160816; b=DuKBBAfUjAmfsNYcL7KrAUY9oJaI4qzI/+/tqjArEEbJyUmj6Ck1OVxc0/+0Yt4Wvu 9MqwE70TaFcV8jgoQxcOjeGwGQlFMQKJX6+291r/TsWbJPLdmp9sN9mHnRLDTYqtbcVh sGKRRsqnARTC5NBSO9oNHWL4gvg47LZeOEK1eQEmjyDr2K51eUafSnQ3ijHnmn2BmWi7 TDbdX8SfDoH6T2RvVGDbO9BtDmM+hei9ulvnmbaQ83uo/HJzoYAqgi6wQH5h/rIG7TaE +gazC/BN2mZyv8dQFYX4IQvthyZrzS1EczTQp/ijCYHOE+ZSEnMkMj/NGOHfOSpTbupX Ny9Q== 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=bhY9Kggrb1UVzu8Uz27J07i1suMZXiIjoBxkG2uVzZY=; b=nL9e8zC7Lp8eMqQaI6Dv1QV9Ml3N4xDIS3xUfYCMU3uzGAWBLaqp5FrcVJi1Wj86Az bWWIMetU4WIaL9v3jqBgacaM2lbbKtXub4BlY8AZgGds0bJ/JTMPvXw58ZJciKwgIsNK Y66OYh3Cx1l7WGcYLZPT3AHj+LBSqvxxaRfYBtA0vSxs19QvQzkFZgBKYYdqu6c9oNYD 9e3KdREhkJCvWUAfKCuIzKGOpaXNzxv3ZQFbk40e8RfF8YGvKEHXGjxVy3TSFZh5HblO 5ed2YbOWNwieCBAzQxraQbXqMEUc5CpF2dKmjr8QzKvBCwO0MxgN+aqZ5L54/h/458Tg iQEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tNr6kOd9; 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 oz14-20020a1709077d8e00b006f424a70464si1279460ejc.868.2022.05.12.23.30.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:30: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=tNr6kOd9; 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 F3154840D8; Fri, 13 May 2022 08:29:19 +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="tNr6kOd9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 164B783EC5; Fri, 13 May 2022 08:28: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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (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 59E3183EC6 for ; Fri, 13 May 2022 08:28:35 +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-x329.google.com with SMTP id 129so4236892wmz.0 for ; Thu, 12 May 2022 23:28:35 -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=bhY9Kggrb1UVzu8Uz27J07i1suMZXiIjoBxkG2uVzZY=; b=tNr6kOd99eFZ9beytdQHwEtVJGvajM1a8HtYWUeR68spObEaAwYvsF0Y8bGZwIhdke tE8DdsJgEfVvLAHah0zfOSX9xgi/SC0q6X5P0cTwzOCABzDoztofCnjoBVzbKAVWveeQ ars70a9V2tgVo8gCfUvkRGkiGLtNt4rfGTcHr3azhr0x6wvFRsusJHC8TUvy86TCpawk KxN0bnkaEkXEigdFkSJ6QAOtXcH5MAHyrOt/Qga9DHho97j9gb0cEoS3PQqY8Ue4/hzj rxfipYNRwGlnsD9v2HV8aIQbzemmTBHOHxgBng67LIygTvv+hPVuWE6dnGoPTFZOI8C2 DDaw== 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=bhY9Kggrb1UVzu8Uz27J07i1suMZXiIjoBxkG2uVzZY=; b=5f5JrttS9IxKpbG+jpkco9mCDVf4RLQ9c+zqtccI6Xt+MKaMlttzSOuGrSywO6MEL/ 7hRfMWwUqgQD8rpH0dci5rebAWk+nQxdrChrTuXfDLNUGtRH0zn+R1VKjNmC4+30sDbb jeD6006B7wMRWVEgtazftFi9sFuxObUver2e+BK0Z94A5uRfSSuMKIWHE7uz5tmbreQ1 xqHbgctSSn96IS44sjtbTsrL28iDVr7q9G77YleXyFjpWggw9fLjtmfwR9YpKEeKok5c 2Xp1x0qX0dEph2NvYfaazVnw4qStIG2e41rNDc4o60tH6jyn+1hhGpz6p2KSW4skAyPb LMrQ== X-Gm-Message-State: AOAM5300FQPsnyPK+/GTrkUUes+h/MJBf6AmHVX2bnvM2tVrnkmhTUYz NAtmoNtSu8PqkQCbEhUSk35m5OAc17oyKw== X-Received: by 2002:a05:600c:190d:b0:394:8241:6454 with SMTP id j13-20020a05600c190d00b0039482416454mr3058118wmq.198.1652423314416; Thu, 12 May 2022 23:28:34 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:34 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere , Lukasz Majewski , Sean Anderson Subject: [PATCH 10/14] clk: scmi: support SCMI multi-channel Date: Fri, 13 May 2022 08:26:18 +0200 Message-Id: <20220513062622.155433-11-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- drivers/clk/clk_scmi.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c index 0d0bb72eaf7..5cf7bd73df5 100644 --- a/drivers/clk/clk_scmi.c +++ b/drivers/clk/clk_scmi.c @@ -15,6 +15,7 @@ static int scmi_clk_get_num_clock(struct udevice *dev, size_t *num_clocks) { + struct scmi_channel **scmi_channel_ref = dev_get_priv(dev); struct scmi_clk_protocol_attr_out out; struct scmi_msg msg = { .protocol_id = SCMI_PROTOCOL_ID_CLOCK, @@ -24,7 +25,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, *scmi_channel_ref, &msg); if (ret) return ret; @@ -35,6 +36,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_channel **scmi_channel_ref = dev_get_priv(dev); struct scmi_clk_attribute_in in = { .clock_id = clkid, }; @@ -49,7 +51,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, *scmi_channel_ref, &msg); if (ret) return ret; @@ -60,6 +62,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_channel **scmi_channel_ref = dev_get_priv(clk->dev); struct scmi_clk_state_in in = { .clock_id = clk->id, .attributes = enable, @@ -70,7 +73,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, *scmi_channel_ref, &msg); if (ret) return ret; @@ -89,6 +92,7 @@ static int scmi_clk_disable(struct clk *clk) static ulong scmi_clk_get_rate(struct clk *clk) { + struct scmi_channel **scmi_channel_ref = dev_get_priv(clk->dev); struct scmi_clk_rate_get_in in = { .clock_id = clk->id, }; @@ -98,7 +102,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, *scmi_channel_ref, &msg); if (ret < 0) return ret; @@ -111,6 +115,7 @@ static ulong scmi_clk_get_rate(struct clk *clk) static ulong scmi_clk_set_rate(struct clk *clk, ulong rate) { + struct scmi_channel **scmi_channel_ref = dev_get_priv(clk->dev); struct scmi_clk_rate_set_in in = { .clock_id = clk->id, .flags = SCMI_CLK_RATE_ROUND_CLOSEST, @@ -123,7 +128,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, *scmi_channel_ref, &msg); if (ret < 0) return ret; @@ -136,10 +141,15 @@ static ulong scmi_clk_set_rate(struct clk *clk, ulong rate) static int scmi_clk_probe(struct udevice *dev) { + struct scmi_channel **scmi_channel_ref = dev_get_priv(dev); struct clk *clk; size_t num_clocks, i; int ret; + ret = devm_scmi_of_get_channel(dev, scmi_channel_ref); + if (ret) + return ret; + if (!CONFIG_IS_ENABLED(CLK_CCF)) return 0; @@ -186,5 +196,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_channel *), }; From patchwork Fri May 13 06:26: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: 572076 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp198329mal; Thu, 12 May 2022 23:30:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBhc3YbqNcwGVosSVB5OkxhgN6IiVGRPP9hJhY+r3Rp1ajz7K51CKKXJaiUGUkX6WBNy2B X-Received: by 2002:a17:907:3f86:b0:6db:b745:f761 with SMTP id hr6-20020a1709073f8600b006dbb745f761mr2805871ejc.610.1652423447018; Thu, 12 May 2022 23:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423447; cv=none; d=google.com; s=arc-20160816; b=NSFhsoicL0q9qdxfCp5Vgqx9kVt1o+t0vWWz5/4ErR8AT52Bz97N+bbV1wax/wtsIH Q08XBJC1dOyv5+O9aJlTbaaIomfzSfJHLFDZBHNIeHUJVW1SQpySpDkDruUMiFyFgoln jYhwAWxykC7wYY/kqwjNz9BUhPvWHBHmk/h0Ew+TLbSjL3ay4bWsdC2Suj5jKgaTrbRW inWMknGNESWalZiBsefC/G8I7brEvF/suFezH1Dja7BvaeyFS/ZjnvWqqfeYHjeEmduQ 2CrQ1eXyrGsk1EYL1/4TAp9m4p3dTc3fKREJsRNLL+7BEqy6jpL7PaeeXfF8j+Y3it+d dh7w== 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=wK1Q0mcaCtwHUN6vXM1a1M5jRI4V554c9SUlteJk2HY=; b=yE/eimg3W0upwgWJq9cfIjE7cXceBTcr9B1CN4yYYLq4zXvZfgthWbSUrmwjk23STU JHS2xFH0BSqF3zMTxRxHE6RIa/rCxWZA3mV3JXNf/IUBBgs8jaClo3/iIFlINUz8GjpN 7ryvl6GsQLwJtlUwcTgH5NvxpoOS3oVI546wXjsPJtlNaK0BltKSqloxo/7fI1bDVIV1 RqbpjEpyBp0g33QYdvFhJZ7V1Wv+cpEgJp453g15szhATBnJieWSp3XOubjzLAokc6Ve 4Mza0D1b7XlC8OrLm8qkufYJZ2vX8TiugV5OH73Qn+C0hD5fVOWBJfs4WxdOleLJtLAY Zqtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lbSrtwC1; 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 r20-20020a056402235400b00427cb81f020si1140193eda.250.2022.05.12.23.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:30:47 -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=lbSrtwC1; 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 B7E4F840AD; Fri, 13 May 2022 08:29:24 +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="lbSrtwC1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CD57183ED4; Fri, 13 May 2022 08:28: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-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 851ED83EDC for ; Fri, 13 May 2022 08:28:36 +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-x429.google.com with SMTP id f2so3026407wrc.0 for ; Thu, 12 May 2022 23:28:36 -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=wK1Q0mcaCtwHUN6vXM1a1M5jRI4V554c9SUlteJk2HY=; b=lbSrtwC12TADg+MSR7ZSZUHGcOzBpvRDExWrLs/1HHAx9GqbDDoM3472yZD8DVr0TQ 3dt5+My2z21leY0g5+d8KRNJF0LvcDdVtEUztcwnFY8PeKKtFXTYKKeG0Ch/hkVeHtcE +JVVb+1Qg9AiDJfZ6Ufby2A9yfcocg66MNt4dyS9a9etEMqrGDEV6u+rxSkeT7cZdh53 QiB0yoekMwaC5+lHsl/UEka74sP6LDsJcw9G6jH8W1x/iR9KYvm9epM13JIKwzLPudn4 cXnpPEAKJCgV7NwkCkrkcxEXIZWcFZ+1YNAPgLg/Nb6A4ppFw7/zmPMeRRBrX8DndyLW /Y4g== 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=wK1Q0mcaCtwHUN6vXM1a1M5jRI4V554c9SUlteJk2HY=; b=RllwPWnAWClmLq7Z2n/uXMxO/S0sp38eiB8UAey3+SwS/W4bnL22xqXbN17xTLrZ8F l3ZHh6k2aX9ldrnKyVwKdNh6B/I67x5U2SMjj8fCZUniGl3p6O4h6+kXpOELQn521cSH LCe6Jg0pnEiHpDDC21rAkcWHLCFHbckRR5Xeh0oKN2WVa4I0W5hOFndCi165NCZuIEgJ 3NJl7zZ/dUK/u/dvlL5cL6uBnVDe++r1GhW9HMBnb6sOJn6UMyJ18bDjxe6aYvwu65pw NzM71ZHCQWQY4UdmtUv7N7mvw0gzOr7Zqj5U4bfaazoxXjwJRV+nUf9A3ywnDn9McPrp JQKw== X-Gm-Message-State: AOAM530eZyxb59x5BX44R/uYIb1eShIVRcvAO4/Ey18G1bdMW9qQhKd6 Q3yXbg9Ay6dh/gQN4wWBiUDYhN3ZHBpbbw== X-Received: by 2002:adf:e587:0:b0:20a:cfbb:ac08 with SMTP id l7-20020adfe587000000b0020acfbbac08mr2429477wrm.718.1652423315432; Thu, 12 May 2022 23:28:35 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:35 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 11/14] reset: scmi: support SCMI multi-channel Date: Fri, 13 May 2022 08:26:19 +0200 Message-Id: <20220513062622.155433-12-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- drivers/reset/reset-scmi.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c index 30b26ec9d31..6101bd2a1e8 100644 --- a/drivers/reset/reset-scmi.c +++ b/drivers/reset/reset-scmi.c @@ -15,6 +15,7 @@ static int scmi_reset_set_level(struct reset_ctl *rst, bool assert_not_deassert) { + struct scmi_channel **scmi_channel_ref = 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 +27,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, *scmi_channel_ref, &msg); if (ret) return ret; @@ -45,6 +46,7 @@ static int scmi_reset_deassert(struct reset_ctl *rst) static int scmi_reset_request(struct reset_ctl *rst) { + struct scmi_channel **scmi_channel_ref = dev_get_priv(rst->dev); struct scmi_rd_attr_in in = { .domain_id = rst->id, }; @@ -58,7 +60,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, *scmi_channel_ref, &msg); if (ret) return ret; @@ -71,8 +73,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_channel **scmi_channel_ref = dev_get_priv(dev); + + return devm_scmi_of_get_channel(dev, scmi_channel_ref); +} + 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_channel *), }; From patchwork Fri May 13 06:26: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: 572079 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp198638mal; Thu, 12 May 2022 23:31:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIinRm0FdskmlIIOnEEMOtYMynI2E/B/Ta1+sheSD6jwIOtOGHMhcrBVuumzWa4bX7QIXn X-Received: by 2002:a17:907:2d8e:b0:6f4:92ad:e38a with SMTP id gt14-20020a1709072d8e00b006f492ade38amr2904408ejc.365.1652423478949; Thu, 12 May 2022 23:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423478; cv=none; d=google.com; s=arc-20160816; b=eKbflwfO+OePNFk407YaSjcbQljJTPEuZjfN1nDEW2E0KJw6hxWgaDTk4sZhSIycrN G34E3VZBzCkcmEC7mrvMDGBPlOcsN9bHPTcn2xuvK+kJtXvB2dS6UgddAEWNMzmBQZPq g2oL8ydlZpEi5a4FnZ4MGGRT/q9Y2/AKGClAABqx0VDYjJN1dY7TCyfALJqkjZtTkOch e8KEhm8aJer/f2/i6JK9Nd/HSfbgYz4L4rSQAKw/1LMhLppBnQdPMKF9VSYQabArTRpj 53D2jGRChPa2GoTQkaZyTFiBxtwenPgdobifQxkQAqKSO0Ipt4PKCLUMRMVVHby/SWJZ MtJg== 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=ni+hQevD7eIpweO9wJM4jc4KEFesOk3xEfJogXHSGGs=; b=IqFY6SnvclaxmWTSp8FUwAnoa1D1//lFBzTPD56UE3CDOQIsxBDulic4vsLb3PxF4D iDj6EkU5kJyD5ptbCnexQCMC5w3sXRTe/N6F7b8XNsFytANylI0Qt+PkkzWDoimfUI3x hMWahKGlrzEJuTJWb3YcL0l22DWuqj43xhR5mOBZjUrd1Bxf78WL8iR5FLFpp6qf167G FVr1phDEOo9q/73Gi7CLpjb4kij0p3pKWrW8H6bWI648t8QOblFY9P13A/f/JIh/HtW/ C3sbPW58vMGGktJn4vNo7ZS1kdUJ7ZN578ZhaVkZdGthMhvTiNdyMPjyhZbM3upHFUPN Bsbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MNrWh5Bk; 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 r18-20020a1709060d5200b006f391d80336si1293067ejh.218.2022.05.12.23.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:31:18 -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=MNrWh5Bk; 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 1BE8283EA1; Fri, 13 May 2022 08:29:35 +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="MNrWh5Bk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 14CEA83EC5; Fri, 13 May 2022 08:28:45 +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-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 5911A83B2F for ; Fri, 13 May 2022 08:28: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-wr1-x429.google.com with SMTP id k2so10054403wrd.5 for ; Thu, 12 May 2022 23:28: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=ni+hQevD7eIpweO9wJM4jc4KEFesOk3xEfJogXHSGGs=; b=MNrWh5BkvQZG+FxOJedEDEWpK3cp0oY4sfG8FUu8pbWjJMULaJ5mGqhhnmmoOm7xRw kLgX6zP6/wCo6kLYy21DSSvePWpBM4z+0yCvaD0nw37TVzsXnQeGII6tWM4uOycW7so5 e7fAqb1YQnR5M8cBmIFnl/Kcx7Khn7AA0r/8Y7DdVs2GAX7S5zMvpf+i5HipMTeim59G eDRw6HhHitI0Hv0NLCVNokUF6auOJoT9HUAwg0wHnoWTRiBoYHthxj9k3YS/TxDcTnFe 5Td5nwCKyfeYlGwGCtJyP40nIqToE0DDj3qg1ejC/LrAm86AdeWKqGv/XuooFlMxH0Af lUww== 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=ni+hQevD7eIpweO9wJM4jc4KEFesOk3xEfJogXHSGGs=; b=uLDqwwrckz/NFQcCyYZkCKpxPVfel0wWEY8+cS0dm6uZg52Zf3MHoaRGmS39G8gkji caQYO0EVVEvuFPkac8TrYnRXXZiTIYwoezenHj/Z/zQSVLdjlvTaPJCoRzyXwm2jx8Z8 DhnX/UT400+uqeHbvgKWXnwE5Z60pynLZkDKxzt80yBPIvw2KEWZMsTVZwFrm8YsWtjc FwZ4lCOic1+nSEp3DdmcFWmOf9de22ide8IBpH62HYeyXq41NVjEpDJAX+us0OUnBsAR v/+Qh5b+BSnx5OesnzI5yvuZBs9r8dHffs5obsMNekWuHys1lYLL0zKMj16+PYCO/adt fLkw== X-Gm-Message-State: AOAM531sU94mV2WuV53XdLAybie+s6geBMUeINm4JunrKvr9C5b0Vefl yJ9Sc58izcyeFU4rdfyzYWcE4U6WqGwj1g== X-Received: by 2002:a05:6000:1ac7:b0:20c:6c81:c8e5 with SMTP id i7-20020a0560001ac700b0020c6c81c8e5mr2606770wry.580.1652423316447; Thu, 12 May 2022 23:28:36 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:36 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere , Jaehoon Chung Subject: [PATCH 12/14] power: regulator: scmi: support SCMI multi-channel Date: Fri, 13 May 2022 08:26:20 +0200 Message-Id: <20220513062622.155433-13-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- drivers/power/regulator/scmi_regulator.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/power/regulator/scmi_regulator.c b/drivers/power/regulator/scmi_regulator.c index 3325ddaf23b..e0343e913f4 100644 --- a/drivers/power/regulator/scmi_regulator.c +++ b/drivers/power/regulator/scmi_regulator.c @@ -27,6 +27,7 @@ struct scmi_regulator_platdata { static int scmi_voltd_set_enable(struct udevice *dev, bool enable) { + struct scmi_channel **scmi_channel_ref = dev_get_priv(dev); struct scmi_regulator_platdata *pdata = dev_get_plat(dev); struct scmi_voltd_config_set_in in = { .domain_id = pdata->domain_id, @@ -38,7 +39,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, *scmi_channel_ref, &msg); if (ret) return ret; @@ -51,6 +52,7 @@ static int scmi_voltd_set_enable(struct udevice *dev, bool enable) static int scmi_voltd_get_enable(struct udevice *dev) { + struct scmi_channel **scmi_channel_ref = dev_get_priv(dev); struct scmi_regulator_platdata *pdata = dev_get_plat(dev); struct scmi_voltd_config_get_in in = { .domain_id = pdata->domain_id, @@ -61,7 +63,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, *scmi_channel_ref, &msg); if (ret < 0) return ret; @@ -74,6 +76,7 @@ static int scmi_voltd_get_enable(struct udevice *dev) static int scmi_voltd_set_voltage_level(struct udevice *dev, int uV) { + struct scmi_channel **scmi_channel_ref = 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 +88,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, *scmi_channel_ref, &msg); if (ret < 0) return ret; @@ -94,6 +97,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_channel **scmi_channel_ref = 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 +108,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, *scmi_channel_ref, &msg); if (ret < 0) return ret; @@ -131,6 +135,7 @@ static int scmi_regulator_of_to_plat(struct udevice *dev) static int scmi_regulator_probe(struct udevice *dev) { + struct scmi_channel **scmi_channel_ref = dev_get_priv(dev); struct scmi_regulator_platdata *pdata = dev_get_plat(dev); struct scmi_voltd_attr_in in = { 0 }; struct scmi_voltd_attr_out out = { 0 }; @@ -144,10 +149,14 @@ static int scmi_regulator_probe(struct udevice *dev) }; int ret; + ret = devm_scmi_of_get_channel(dev->parent, scmi_channel_ref); + 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, *scmi_channel_ref, &scmi_msg); if (ret) { dev_err(dev, "Failed to query voltage domain %u: %d\n", pdata->domain_id, ret); @@ -171,6 +180,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_channel *), }; static int scmi_regulator_bind(struct udevice *dev) From patchwork Fri May 13 06:26: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: 572077 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp198411mal; Thu, 12 May 2022 23:30:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYTJ/R40A0O/vF2fAa2BC8yeMR662MF/ev/UXZF9xn/3fR1VWkrND8gX2DOLU+UErmmoqj X-Received: by 2002:a05:6402:4396:b0:427:f2dc:b11 with SMTP id o22-20020a056402439600b00427f2dc0b11mr39020578edc.298.1652423458139; Thu, 12 May 2022 23:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423458; cv=none; d=google.com; s=arc-20160816; b=k7fec5sinpNUzHnfBqQGJDEoMvdTVfYZyeTkSBRt0YkrlrgIEAmlDNGUFW7gpYn7dC lD6qGkv4ZTNGY1W1bRUI5q1pTuQtUBEQRLMWDxL8c6D+ypK6FordUffe17egb31yCJZK LvtQqlCCfgDouIxNPwdnPDxxwQHC+UNevez6HXPICUr4nvdaEibwqcIyuRAGu9d/7t45 guWam4MJE1Ato3HmpWqIi9GnHFvzl/K/azvxR1NQ/AFjWJ6HcPSvND5WToTCnMKPhHQ2 4LW0hQ3UBLyu1FdSB/IgpvHO8vC5Zk6uOywFbZGRmR1AwhPgjm6t/t/ZOPecTuNnCJaa eWRQ== 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=QSCG4xhEc59nDnZu8GJwTA9PqTEhzX+td3hwKVs6lJI=; b=sqHoutnjXp/BwA9NHJsMR7pbtpqOcg9jqHUPr75JSIpqgrz7RBqs/3E2ugW8tVsXcq y0EXu7hfFQNuVfrmrqca+R9EUgwqPAKEa6f8DSZFMRX5ASgr8m7+eAxQSpTrbeBAnwMu x7n/NwjaCLz2DBbT5OkDVT85PTeS5BBeNfgGSi2zqkptozuqu/YLm9qS/FCZPVKUu4NU IKP2aLFhxaAn+NKdgOUjrfUk6EOIOcn8woOlBZOIWEZvdxY6xx5mb/PM96fwrORfsiUL 2aYQml8avWxCRenq7btvEdxcyF3qUEJ2MYI0WffqmKvQu8aHsuTX334cc1ycuP1QNNJC YyDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FsLOwKAo; 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 dr2-20020a170907720200b006e06d4769f3si1197474ejc.692.2022.05.12.23.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:30:58 -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=FsLOwKAo; 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 A271F840D7; Fri, 13 May 2022 08:29:27 +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="FsLOwKAo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AE57883EDC; Fri, 13 May 2022 08:28:43 +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-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 478B983EA4 for ; Fri, 13 May 2022 08:28: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-wr1-x42c.google.com with SMTP id w4so9998092wrg.12 for ; Thu, 12 May 2022 23:28: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=QSCG4xhEc59nDnZu8GJwTA9PqTEhzX+td3hwKVs6lJI=; b=FsLOwKAoUQmT3excug3DGFbn07buveLGsZCQo7lYkWqE81JPZNcmm/UtVXL8fAyKJc kgKcC69NtAjyVo0h4xYGS36RYWKa/5BUxl8DS64eWugtO9foZWj18tDK05uMj2e/b+JT 3qMbvekYekdxps2qdg09MC7SbmKicGH+aR48wTG9S6DzEhmYjc4aVCskMtfoj9HIFPr1 j1o3U4EX9HYi3+5yfDaSsCfu5K5dkMN7y4SntyO/Hwn9P2or8Jcaw7gI6ZJeAdggcAe5 LotbMXMEeE8l/99x/f8SuwrE0Ge9F9L6qMt1uHvpixUzrpIO8TjvyUEdu3BYwZZ7WHN0 NQFw== 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=QSCG4xhEc59nDnZu8GJwTA9PqTEhzX+td3hwKVs6lJI=; b=Jq/jfJETGlE4Kpk++xlyXjml7susTDPyFY4UsaDDjhmY9i0YRv8C0aeBlQllAzqX6e 8VCVWLGHPlQ+ZlT6sd4LgY4dm9bOtnyJeLFv3kjQ2DwctlhYmGONL8gU/DpoXSBwvVcc 0XzGpPYgFQFWabMNiZnE4ooP4OGZJmWA6yB8PG9hqCmRmE0ZEtJpqYBUQAmBOMU9rbnx aQs9JcwJOKtcR9fVs/id/2FdE4BMQjpDzatgkuu7ui/4gP6Ik4o0YHvCc4QhvNSlRyI+ X+MAK/P6V6oGfMc1uDhbaR8lJb998w8ENR6YF/YZu/8CsqapviP1ayABqiwQ+idzmazJ LcwA== X-Gm-Message-State: AOAM531gJNLK8Mup8CnW64mq8dXcH+EAOhT38eMgWPSyPeFlrSzh7aUA FcoxZzT1rD5Z50otsrUSlBJP2kbMwzPzEg== X-Received: by 2002:a05:6000:1367:b0:20a:d222:35c8 with SMTP id q7-20020a056000136700b0020ad22235c8mr2506829wrz.577.1652423317335; Thu, 12 May 2022 23:28:37 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:37 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere , Jaehoon Chung Subject: [PATCH 13/14] power: regulator: scmi: simplify scmi_voltd_set_enable() Date: Fri, 13 May 2022 08:26:21 +0200 Message-Id: <20220513062622.155433-14-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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 e0343e913f4..6affa457991 100644 --- a/drivers/power/regulator/scmi_regulator.c +++ b/drivers/power/regulator/scmi_regulator.c @@ -43,11 +43,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 Fri May 13 06:26: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: 572078 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp198539mal; Thu, 12 May 2022 23:31:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZao+zYOVAtZB3PrFxpSwSqtbM4ZcK2owjJNC23thJFHk7+HC3SHV44fQqm7VWX1/QX5iR X-Received: by 2002:a17:907:2da7:b0:6f4:801c:6c3d with SMTP id gt39-20020a1709072da700b006f4801c6c3dmr2811976ejc.310.1652423469821; Thu, 12 May 2022 23:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652423469; cv=none; d=google.com; s=arc-20160816; b=P6+kFSoz8Iup4orvgiZ5WjJDe2yj6lZtkBKUyq08DmOdOJqP6u29ot5I1TuyyFOA5U GdQCRmqz6wRDRR2EVDviPF5Lp32112DQTJlxtTMiLiyRQ1w21mGkY0NqHb+JL2UgRmJr EkUMM9L69cgI3D+RaQKnjcjMjUWgEklxF/c12dZYDWeY48NjqXMh/hiMvcFQWG8BgDeU YG5Y2uJj2Y59o6QZsEY48mcuLkzHBGfLQNxuZ+qRKqU6pvJkjRJexRjQP9GBqrjBaZ4g WVPk3tOaQxU6IJ25P/u1quOLWDG6r1ZuZcdHCrV+gPQT50TXMnpJ9oKOSBBfnWaDrjBd 5PVw== 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=ftKjhXnxXieu1AqR2t6cJKJbzTLryBUIn+TNj0Ew9A8=; b=j0tD7QnYUkWLl4vWEZORl0h/HXzRE5XFA73Xjeu698PLzShmWB7QSnXO0/+WZUlxMo mMd6gVpVfKnfsm6Iv18Fnf8XX7NG+ZzuBSSvAX/PaYOh8XTsQ3Orx/QA0ie87OTtWM+Y VAARnJer11DjOaCnnxWtu65ep+yT1SxiAZaSV3NROriD+voQ64qbGZ58eLbOhXXrsmy/ tLlevWs5ZvZZtZCCCydQUK3VJ/MbVA9am6WAsxRFlR1pV/gveMUYEJb8EMMLjqoF1j7B BixNuc4821AGgpgHGR0w9SW4q+7hVDkhUccKh+/2LeaSVWIRjscCe8rirHibiuSX0GZW LkjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Iyj3cxu2; 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 ay5-20020a170906d28500b006ec0aaff9cfsi1165509ejb.932.2022.05.12.23.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:31:09 -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=Iyj3cxu2; 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 8E68E84189; Fri, 13 May 2022 08:29: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="Iyj3cxu2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 63C2C83E01; Fri, 13 May 2022 08:28:45 +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-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 7496D83EAE for ; Fri, 13 May 2022 08:28:39 +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-x42f.google.com with SMTP id m1so10027719wrb.8 for ; Thu, 12 May 2022 23:28:39 -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=ftKjhXnxXieu1AqR2t6cJKJbzTLryBUIn+TNj0Ew9A8=; b=Iyj3cxu2KsN+BZB9Cm7XIbvzOwTPDucV19BwxJr7CtPMcXOFmecQECreApbuMN1zjh noRq1sdqnJwjqUbYrAJ72FSgfowJaTxeX58+y7q4MHG1AUxMDUw1eAm+2X8OOtVlMfzf iWC3GpfEYA1pPoMaYR5mklmD/5t0XzPOn4JsJHSF9Td32l4eGLpO9SMcv1fNO/45WEQm R7kCWYqGp6wYMOFElRsy1RMuh5BwgVC0oiOpOf5pjbpd5xD8vUemwOsNwsJwRtrM2UlB gGywT5Sdr3Tr1KMBJ7neB2OcBKpkXG9J7w5PUdlzRLnXiok9JwoRWSym5Qxe36xcFJOE 2Z6Q== 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=ftKjhXnxXieu1AqR2t6cJKJbzTLryBUIn+TNj0Ew9A8=; b=Su3rzsKZnL+6FEH7p0fXot1+5VMfmzpKQkJM9lK3NUEJ7AeVa0fGOua3BfCj/xKwy8 Jrn3+QKPucmeDdCEkeBJFpt02LtGoOB7pgu1bQ/SeNKAIIqLfjX+6O1vOsb81+fu1Sy+ KaIYXV4RTs18ThwZfGQ5PeHx4LNvKbRTtnci7Lu4WnxaSnzMQk5ptoJVSxwfIqMhiLYN nbGRO52Sf+LXnFt3UYcZ6GrSgmwq79ujDQl3zYRF8crojfFBmdrHTw8yaFgFtTBSsIMO 2P/QrUsRAbKIg7uuqncsVOak22TAoMbKcV8t/UOdoelqs6XzV74HISmtn/nj7Oxwf/rC 8svA== X-Gm-Message-State: AOAM531ePClFNN30CZcKh3xZda+iX0CVqgcYEVeEBdGCvRgrSiGZKbbL EspgIT0ZTuGcAShXfKRqlsqZTgAZxEHxpw== X-Received: by 2002:adf:ec89:0:b0:20a:c0a4:e4a3 with SMTP id z9-20020adfec89000000b0020ac0a4e4a3mr2437267wrn.98.1652423318413; Thu, 12 May 2022 23:28:38 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1194:a3aa:dc31:6fc0:bd75:771a]) by smtp.gmail.com with ESMTPSA id s18-20020a7bc0d2000000b003942a244eebsm1414235wmh.48.2022.05.12.23.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 23:28:38 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Etienne Carriere Subject: [PATCH 14/14] firmware: scmi: use multi channel in mailbox, optee and smccc agents Date: Fri, 13 May 2022 08:26:22 +0200 Message-Id: <20220513062622.155433-15-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513062622.155433-1-etienne.carriere@linaro.org> References: <20220513062622.155433-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 --- 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;