From patchwork Tue May 31 16:09:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577449 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1300539mag; Tue, 31 May 2022 09:10:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeMno8/4zR1Hi7jZx2XnVz+uPyytivSP/2Fxj2MeyrrmxuVyw29cTk1abp2Axi4WSldcBi X-Received: by 2002:a92:c087:0:b0:2d3:96f3:1b1a with SMTP id h7-20020a92c087000000b002d396f31b1amr8681908ile.163.1654013424025; Tue, 31 May 2022 09:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013424; cv=none; d=google.com; s=arc-20160816; b=WRqMK7RxMLQOuQAzxgAoXpfO3Czyr+e7PFOf4e64Q5biToaVjmRv8NVa35H2FvcVoa bJVWlkik3yw1oeahIAGrAxBEPwEoYTYSH9QIKICBq03BNQh+1VOkhDFOZu9VoGjlALUw yn2TJR5/mbCvgIV9+MfiNQXWLjVNAeb4JrpTIK871JbZIog78Z039tZ0/84twzQ0VhNh xkuQOX208dKXwKUwnvFHnUKJGiWTS3L8gEcZ6Voxtyi+2YqOPUU0Dj0DXFLv4/AIuvWX kqKxbsHUDdjF6309CIgGCgj3pB9bDoFiTEr8NlWkDM2zz8PgMlCKgNLhzAYqIqpgpAvD 3NPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FWq3eaPqYmqa96WH3cVbXcogNmu+p/AyuTFZCmFwbgU=; b=aYzPWIh5u9gFcPEkUnYVT4DM00mt07GA8fAzrU1LBcK8U0RGIHGGFPHOhUK5zYYZIK v1xAHCGNG2hGdV8Bn4nq8ubL9Sn1X5SvQXZLjXpP3GE7RU0CsRYGEfqW4Kq97cT3TMJK dwx8dmbwK7rwO4yorvLUtUrk0NjS191hTqCWTGJvLcRYq25ux9KlFDC7NJ5I/bACJ0Zm 9pNN5pYeHAMQY8trTHb4X3eR8fOBPyiWHPN1kWsHH9z0qcfOiPiUNgAsuFWlgW7gNq6k qLAeYqqUZ7M/zD1Cu/mGXwwBNI7212u7OkgRgFzg+jMKCQnjXzUEKKPaiDdmEnroZhHM 1dwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TftKyqJu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id n14-20020a92d9ce000000b002d1c3dff02bsi14800437ilq.131.2022.05.31.09.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:10:24 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TftKyqJu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 978DE841A5; Tue, 31 May 2022 18:10:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TftKyqJu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5A43883E1B; Tue, 31 May 2022 18:09:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 51AB183E3C for ; Tue, 31 May 2022 18:09:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wm1-x335.google.com with SMTP id d5-20020a05600c34c500b0039776acee62so1172049wmq.1 for ; Tue, 31 May 2022 09:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FWq3eaPqYmqa96WH3cVbXcogNmu+p/AyuTFZCmFwbgU=; b=TftKyqJu0EeB4MXvnytcUx7G9e1foUMqlq+WUtrWF95dFK/YeQzsEEBdghaALwcFZQ 9aep6wTH5K/RPadYI4WTkvgeBhH3M6syjXWt8wYYl1LUUhDARLBeUavn0J5voFmIXiws 6KoExQAPxDahNJKsHwANl/nDRxnoDIy0zPqX3rQNOM3GJJoO3JRIVEJsMWdwSEjNNDtw DW/rB3V5Jy4//mgpV4uyRtYHBz5fj7Wt0LHMnpE6x4ICbI/JGAqzBsrhVxFezXm3lByc BJaPKpi/bSUy0ldHd7pP/6hgsJyXsJr9vgkNNs2pKDeoItWgKW0W4KOj8ziG9rDHqWkf +42g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FWq3eaPqYmqa96WH3cVbXcogNmu+p/AyuTFZCmFwbgU=; b=Nd20oCyCZEkowF1RWyGKEDPx8/MwebV0xqg4JttxfP6FJvIcnN/CeJAYpnmzpx5W0V dqTDm7QsiTR5PMirQnuV28G7T1W6nC7O5ggF++hvwaDQbp++da1/+dnD3iwF6546nq8H wZauuWLWhUM6ATryI8pVv5KgOLkQMHHm0f2+pgQF0ClVc1oSky0t2isNawqDn1Ea59q7 FwttqRzPI2y/xHDJI1SyjozWH8yJSR1EB2tGeOoS/t7GJ1PqxXVDtmegDXJQL5SF6mFT lReCCjvYepi6YtP8OVb0qs1sNRw0upm3+PN9NCEk821sUtpMsai3lb5N5SYZ5Px8ffCs 6A4w== X-Gm-Message-State: AOAM531F/3Gkb13TOLxl/m+TCqLKfwdQTUQKdbCX5pTd3tEnlaKl1Ueb lmOoVDAFbKaqaVTEZYYaj0niTkFj31RXJw== X-Received: by 2002:a05:600c:1c22:b0:397:5c31:6669 with SMTP id j34-20020a05600c1c2200b003975c316669mr24243108wms.78.1654013379418; Tue, 31 May 2022 09:09:39 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:38 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org, Lukasz Majewski , Sean Anderson , Jaehoon Chung Subject: [PATCH v2 03/14] firmware: scmi: prepare scmi uclass API to multi-channel Date: Tue, 31 May 2022 18:09:18 +0200 Message-Id: <20220531160929.931150-4-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Changes SCMI driver API function devm_scmi_process_msg() to add an SCMI channel reference argument for when SCMI agent supports SCMI protocol specific channels. First argument of devm_scmi_process_msg() is also change to point to the caller SCMI protocol device rather than its parent device (the SCMI agent device). The argument is a pointer to opaque struct scmi_channel known from the SCMI transport drivers. It is currently unused and caller a pass NULL value. A later change will enable such support once SCMI protocol drivers have means to get the channel reference during initialization. Cc: Lukasz Majewski Cc: Sean Anderson Cc: Jaehoon Chung Signed-off-by: Etienne Carriere --- No change since v1. --- drivers/clk/clk_scmi.c | 10 +++++----- drivers/firmware/scmi/scmi_agent-uclass.c | 3 ++- drivers/power/regulator/scmi_regulator.c | 10 +++++----- drivers/reset/reset-scmi.c | 4 ++-- include/scmi_agent-uclass.h | 2 +- include/scmi_agent.h | 5 ++++- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c index 5aaabcf0b44..0d0bb72eaf7 100644 --- a/drivers/clk/clk_scmi.c +++ b/drivers/clk/clk_scmi.c @@ -24,7 +24,7 @@ static int scmi_clk_get_num_clock(struct udevice *dev, size_t *num_clocks) }; int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret) return ret; @@ -49,7 +49,7 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name) }; int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret) return ret; @@ -70,7 +70,7 @@ static int scmi_clk_gate(struct clk *clk, int enable) in, out); int ret; - ret = devm_scmi_process_msg(clk->dev, &msg); + ret = devm_scmi_process_msg(clk->dev, NULL, &msg); if (ret) return ret; @@ -98,7 +98,7 @@ static ulong scmi_clk_get_rate(struct clk *clk) in, out); int ret; - ret = devm_scmi_process_msg(clk->dev, &msg); + ret = devm_scmi_process_msg(clk->dev, NULL, &msg); if (ret < 0) return ret; @@ -123,7 +123,7 @@ static ulong scmi_clk_set_rate(struct clk *clk, ulong rate) in, out); int ret; - ret = devm_scmi_process_msg(clk->dev, &msg); + ret = devm_scmi_process_msg(clk->dev, NULL, &msg); if (ret < 0) return ret; diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index 3819f2fa993..93cfc9c395b 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -114,7 +114,8 @@ static const struct scmi_agent_ops *transport_dev_ops(struct udevice *dev) return (const struct scmi_agent_ops *)dev->driver->ops; } -int devm_scmi_process_msg(struct udevice *dev, struct scmi_msg *msg) +int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel, + struct scmi_msg *msg) { const struct scmi_agent_ops *ops; struct udevice *parent = dev; diff --git a/drivers/power/regulator/scmi_regulator.c b/drivers/power/regulator/scmi_regulator.c index 2966bdcf830..3325ddaf23b 100644 --- a/drivers/power/regulator/scmi_regulator.c +++ b/drivers/power/regulator/scmi_regulator.c @@ -38,7 +38,7 @@ static int scmi_voltd_set_enable(struct udevice *dev, bool enable) in, out); int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret) return ret; @@ -61,7 +61,7 @@ static int scmi_voltd_get_enable(struct udevice *dev) in, out); int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret < 0) return ret; @@ -85,7 +85,7 @@ static int scmi_voltd_set_voltage_level(struct udevice *dev, int uV) in, out); int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret < 0) return ret; @@ -104,7 +104,7 @@ static int scmi_voltd_get_voltage_level(struct udevice *dev) in, out); int ret; - ret = devm_scmi_process_msg(dev, &msg); + ret = devm_scmi_process_msg(dev, NULL, &msg); if (ret < 0) return ret; @@ -147,7 +147,7 @@ static int scmi_regulator_probe(struct udevice *dev) /* Check voltage domain is known from SCMI server */ in.domain_id = pdata->domain_id; - ret = devm_scmi_process_msg(dev, &scmi_msg); + ret = devm_scmi_process_msg(dev, NULL, &scmi_msg); if (ret) { dev_err(dev, "Failed to query voltage domain %u: %d\n", pdata->domain_id, ret); diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c index 81d195a06a9..30b26ec9d31 100644 --- a/drivers/reset/reset-scmi.c +++ b/drivers/reset/reset-scmi.c @@ -26,7 +26,7 @@ static int scmi_reset_set_level(struct reset_ctl *rst, bool assert_not_deassert) in, out); int ret; - ret = devm_scmi_process_msg(rst->dev, &msg); + ret = devm_scmi_process_msg(rst->dev, NULL, &msg); if (ret) return ret; @@ -58,7 +58,7 @@ static int scmi_reset_request(struct reset_ctl *rst) * We don't really care about the attribute, just check * the reset domain exists. */ - ret = devm_scmi_process_msg(rst->dev, &msg); + ret = devm_scmi_process_msg(rst->dev, NULL, &msg); if (ret) return ret; diff --git a/include/scmi_agent-uclass.h b/include/scmi_agent-uclass.h index a501d1b4825..861ac6d1100 100644 --- a/include/scmi_agent-uclass.h +++ b/include/scmi_agent-uclass.h @@ -15,7 +15,7 @@ struct scmi_agent_ops { /* * process_msg - Request transport to get the SCMI message processed * - * @agent: Agent using the transport + * @dev: SCMI protocol device using the transport * @msg: SCMI message to be transmitted */ int (*process_msg)(struct udevice *dev, struct scmi_msg *msg); diff --git a/include/scmi_agent.h b/include/scmi_agent.h index 18bcd48a9d4..f4d85cae773 100644 --- a/include/scmi_agent.h +++ b/include/scmi_agent.h @@ -13,6 +13,7 @@ #include struct udevice; +struct scmi_channel; /* * struct scmi_msg - Context of a SCMI message sent and the response received @@ -52,10 +53,12 @@ struct scmi_msg { * On return, scmi_msg::out_msg_sz stores the response payload size. * * @dev: SCMI device + * @channel: Communication channel for the device * @msg: Message structure reference * Return: 0 on success and a negative errno on failure */ -int devm_scmi_process_msg(struct udevice *dev, struct scmi_msg *msg); +int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel, + struct scmi_msg *msg); /** * scmi_to_linux_errno() - Convert an SCMI error code into a Linux errno code