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