From nobody Mon Feb 9 02:45:58 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9B7125228D; Sat, 27 Dec 2025 16:51:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766854293; cv=none; b=dT9F0R9G4/LSZrhonWrT7LfyDPxujpvH9miGAE35GF3rZEoFTbMKIIrlfwuwHpjhemmsM++QDmRZO67oCIEYF2taFkL4wPuZegplfpmWCv2oHAik+oT+nUFJASktU1sVd2n6TMJL/OWjY0TCV6+TdKTugC30qb08tjcCiqD0qN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766854293; c=relaxed/simple; bh=RKejtm7JxTvEQ1sU0AAFQFSvJjRGKFBBWFjb3Dgmuxs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZIqeIXNEys4zZF96mG96rsCRmDzDDS1o7rfhLnTTG4nrsEGPBWP4Bm/WZcj8FHN8U2+AH0ozGTrGMYiLZqSHzWEpVAWW6/dEKSLxQpdVpYgWf2Kb75WO+cfxXjOhH0R0iH68S+oQTrwMXqOxblu5VW9oMQegpFkPK/kPzd+r5xc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9FECF497; Sat, 27 Dec 2025 08:41:59 -0800 (PST) Received: from pluto (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 788BE3F694; Sat, 27 Dec 2025 08:42:04 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org Cc: sudeep.holla@arm.com, philip.radford@arm.com, peng.fan@oss.nxp.com, Cristian Marussi Subject: [PATCH 1/2] firmware: arm_scmi: Rework protocol version negotiation logic Date: Sat, 27 Dec 2025 16:41:31 +0000 Message-ID: <20251227164132.1311988-2-cristian.marussi@arm.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251227164132.1311988-1-cristian.marussi@arm.com> References: <20251227164132.1311988-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Protocol version negotiation can be used by an agent to request the server to downgrade the version effectively utilized by a specific protocol during the current session, if the latest version used by the server is newer than the latest version known to the client. In order for the negotiation process to be fully effective at preventing any possible version incompatibility, it must happen early on, well before the specific protocol initialization phase takes place. Delegate protocol version querying to the core SCMI stack and rework the protocol negotiation logic in order to execute the needed negotiation exchanges upfront, right before the initialization phase takes place. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/driver.c | 93 ++++++++++++++++++++++----- drivers/firmware/arm_scmi/protocols.h | 4 ++ 2 files changed, 81 insertions(+), 16 deletions(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi= /driver.c index 5caa9191a8d1..094cfcf51d28 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2112,6 +2112,76 @@ static int scmi_protocol_version_negotiate(struct sc= mi_protocol_handle *ph) return ret; } =20 +/** + * scmi_protocol_version_initialize - Initialize protocol version + * @dev: A device reference. + * @pi: A reference to the protocol instance being initialized + * + * At first retrieve the newest protocol version supported by the platform= for + * this specific protoocol. + * + * Negotiation is attempted only when the platform advertised a protocol + * version newer than the most recent version known to this agent, since + * backward compatibility is NOT assured in general between versions. + * + * Failing to negotiate a fallback version or to query supported version at + * all will result in an attempt to use the newest version known to this a= gent + * even though compatibility is NOT assured. + * + * Versions are defined as: + * + * pi->version: the version supported by the platform as returned by the q= uery. + * pi->proto->supported_version: the newest version supported by this agent + * for this protocol. + * pi->negotiated_version: The version successfully negotiated with the pl= atform. + * ph->version: The final version effectively chosen for this session. + */ +static void scmi_protocol_version_initialize(struct device *dev, + struct scmi_protocol_instance *pi) +{ + struct scmi_protocol_handle *ph =3D &pi->ph; + int ret; + + /* + * Query and store platform supported protocol version: this is usually + * the newest version the platfom can support. + */ + ret =3D version_get(ph, &pi->version); + if (ret) { + dev_warn(dev, + "Failed to query supported version for protocol 0x%X.\n", + pi->proto->id); + goto best_effort; + } + + /* Need to negotiate at all ? */ + if (pi->version <=3D pi->proto->supported_version) { + ph->version =3D pi->version; + return; + } + + /* Attempt negotiation */ + ret =3D scmi_protocol_version_negotiate(ph); + if (!ret) { + ph->version =3D pi->negotiated_version; + dev_info(dev, + "Protocol 0x%X successfully negotiated version 0x%X\n", + pi->proto->id, ph->version); + return; + } + + dev_warn(dev, + "Detected UNSUPPORTED higher version 0x%X for protocol 0x%X.\n", + pi->version, pi->proto->id); + +best_effort: + /* Fallback to use newest version known to this agent */ + ph->version =3D pi->proto->supported_version; + dev_warn(dev, + "Trying version 0x%X. Backward compatibility is NOT assured.\n", + ph->version); +} + /** * scmi_alloc_init_protocol_instance - Allocate and initialize a protocol * instance descriptor. @@ -2157,6 +2227,13 @@ scmi_alloc_init_protocol_instance(struct scmi_info *= info, pi->ph.set_priv =3D scmi_set_protocol_priv; pi->ph.get_priv =3D scmi_get_protocol_priv; refcount_set(&pi->users, 1); + + /* + * Initialize effectively used protocol version performing any + * possibly needed negotiations. + */ + scmi_protocol_version_initialize(handle->dev, pi); + /* proto->init is assured NON NULL by scmi_protocol_register */ ret =3D pi->proto->instance_init(&pi->ph); if (ret) @@ -2184,22 +2261,6 @@ scmi_alloc_init_protocol_instance(struct scmi_info *= info, devres_close_group(handle->dev, pi->gid); dev_dbg(handle->dev, "Initialized protocol: 0x%X\n", pi->proto->id); =20 - if (pi->version > proto->supported_version) { - ret =3D scmi_protocol_version_negotiate(&pi->ph); - if (!ret) { - dev_info(handle->dev, - "Protocol 0x%X successfully negotiated version 0x%X\n", - proto->id, pi->negotiated_version); - } else { - dev_warn(handle->dev, - "Detected UNSUPPORTED higher version 0x%X for protocol 0x%X.\n", - pi->version, pi->proto->id); - dev_warn(handle->dev, - "Trying version 0x%X. Backward compatibility is NOT assured.\n", - pi->proto->supported_version); - } - } - return pi; =20 clean: diff --git a/drivers/firmware/arm_scmi/protocols.h b/drivers/firmware/arm_s= cmi/protocols.h index d62c4469d1fd..2766c2b822b5 100644 --- a/drivers/firmware/arm_scmi/protocols.h +++ b/drivers/firmware/arm_scmi/protocols.h @@ -159,6 +159,9 @@ struct scmi_proto_helpers_ops; * struct scmi_protocol_handle - Reference to an initialized protocol ins= tance * * @dev: A reference to the associated SCMI instance device (handle->dev). + * @version: The protocol version currently effectively in use by this + * initialized instance of the protocol as determined at the end of + * any possibly needed negotiations performed by the core. * @xops: A reference to a struct holding refs to the core xfer operations= that * can be used by the protocol implementation to generate SCMI messages. * @set_priv: A method to set protocol private data for this instance. @@ -177,6 +180,7 @@ struct scmi_proto_helpers_ops; */ struct scmi_protocol_handle { struct device *dev; + unsigned int version; const struct scmi_xfer_ops *xops; const struct scmi_proto_helpers_ops *hops; int (*set_priv)(const struct scmi_protocol_handle *ph, void *priv, --=20 2.52.0 From nobody Mon Feb 9 02:45:58 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9C002561A2; Sat, 27 Dec 2025 16:51:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766854293; cv=none; b=EZUOEo8GvjZ4z/B3aXD01wYKk4BUxMu+lYn4WBOd4mxUfKb0LShp3roTS4NXpL8siaFYjkJ0lMWmBD1b6eFLlfj2kIxkK4q6TxcMoe+oFuGOWqAZRYp8byxEol2xSzhTHMhjlNIyEPhzi5j1KfpUdMuUZACOIGD8n9/r85hNNLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766854293; c=relaxed/simple; bh=wRuJq++J+Pc3TX+wUFfaYnwNuo9Gnb7ukxqxrwkPfZ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oviPfyR7XTgdoNXczAz9LrLhNpt6YxorbCZ/o5+Ovveub091KXrh4yrdX9jhpJcPCVY7jBvuEiqPPHGkBMobCkd/U7r2fxvLXSHuT5ZwQI+qNPqBNvYl5AGDDZWNt+r+tKcbhVNrYmxlwhPQAEF4+leZzJHK3hydiL9mBpB0ZqU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 95BD81684; Sat, 27 Dec 2025 08:42:02 -0800 (PST) Received: from pluto (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 45F9A3F694; Sat, 27 Dec 2025 08:42:06 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org Cc: sudeep.holla@arm.com, philip.radford@arm.com, peng.fan@oss.nxp.com, Cristian Marussi Subject: [PATCH 2/2] firmware: arm_scmi: Remove legacy protocol versioning logic Date: Sat, 27 Dec 2025 16:41:32 +0000 Message-ID: <20251227164132.1311988-3-cristian.marussi@arm.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251227164132.1311988-1-cristian.marussi@arm.com> References: <20251227164132.1311988-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Protocol version negotiation logic is centralized in the SCMI core stack so that most of the legacy per-protocol versioning logic is redundant and can be removed. Remove protocol-specific versioning code and refactor all the protocols to use the new simplified centralized logic. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/base.c | 11 +--- drivers/firmware/arm_scmi/clock.c | 24 +++----- drivers/firmware/arm_scmi/driver.c | 5 +- drivers/firmware/arm_scmi/perf.c | 57 +++++++------------ drivers/firmware/arm_scmi/pinctrl.c | 12 +--- drivers/firmware/arm_scmi/power.c | 18 ++---- drivers/firmware/arm_scmi/powercap.c | 21 +++---- drivers/firmware/arm_scmi/protocols.h | 5 +- drivers/firmware/arm_scmi/reset.c | 18 ++---- drivers/firmware/arm_scmi/sensors.c | 22 +++---- drivers/firmware/arm_scmi/system.c | 14 +---- .../arm_scmi/vendors/imx/imx-sm-bbm.c | 10 +--- .../arm_scmi/vendors/imx/imx-sm-cpu.c | 9 +-- .../arm_scmi/vendors/imx/imx-sm-lmm.c | 9 +-- .../arm_scmi/vendors/imx/imx-sm-misc.c | 10 +--- drivers/firmware/arm_scmi/voltage.c | 13 +---- 16 files changed, 72 insertions(+), 186 deletions(-) diff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/b= ase.c index 86b376c50a13..22267bbd0f4d 100644 --- a/drivers/firmware/arm_scmi/base.c +++ b/drivers/firmware/arm_scmi/base.c @@ -375,18 +375,13 @@ static int scmi_base_protocol_init(const struct scmi_= protocol_handle *ph) { int id, ret; u8 *prot_imp; - u32 version; char name[SCMI_SHORT_NAME_MAX_SIZE]; struct device *dev =3D ph->dev; struct scmi_revision_info *rev =3D scmi_revision_area_get(ph); =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - - rev->major_ver =3D PROTOCOL_REV_MAJOR(version); - rev->minor_ver =3D PROTOCOL_REV_MINOR(version); - ph->set_priv(ph, rev, version); + rev->major_ver =3D PROTOCOL_REV_MAJOR(ph->version); + rev->minor_ver =3D PROTOCOL_REV_MINOR(ph->version); + ph->set_priv(ph, rev); =20 ret =3D scmi_base_attributes_get(ph); if (ret) diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/= clock.c index afa7981efe82..ab36871650a1 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -157,7 +157,6 @@ struct scmi_clock_rate_notify_payld { }; =20 struct clock_info { - u32 version; int num_clocks; int max_async_req; bool notify_rate_changed_cmd; @@ -346,8 +345,7 @@ scmi_clock_get_permissions(const struct scmi_protocol_h= andle *ph, u32 clk_id, } =20 static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph, - u32 clk_id, struct clock_info *cinfo, - u32 version) + u32 clk_id, struct clock_info *cinfo) { int ret; u32 attributes; @@ -370,7 +368,7 @@ static int scmi_clock_attributes_get(const struct scmi_= protocol_handle *ph, attributes =3D le32_to_cpu(attr->attributes); strscpy(clk->name, attr->name, SCMI_SHORT_NAME_MAX_SIZE); /* clock_enable_latency field is present only since SCMI v3.1 */ - if (PROTOCOL_REV_MAJOR(version) >=3D 0x2) + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x2) latency =3D le32_to_cpu(attr->clock_enable_latency); clk->enable_latency =3D latency ? : U32_MAX; } @@ -381,7 +379,7 @@ static int scmi_clock_attributes_get(const struct scmi_= protocol_handle *ph, * If supported overwrite short name with the extended one; * on error just carry on and use already provided short name. */ - if (!ret && PROTOCOL_REV_MAJOR(version) >=3D 0x2) { + if (!ret && PROTOCOL_REV_MAJOR(ph->version) >=3D 0x2) { if (SUPPORTS_EXTENDED_NAMES(attributes)) ph->hops->extended_name_get(ph, CLOCK_NAME_GET, clk_id, NULL, clk->name, @@ -393,7 +391,7 @@ static int scmi_clock_attributes_get(const struct scmi_= protocol_handle *ph, if (cinfo->notify_rate_change_requested_cmd && SUPPORTS_RATE_CHANGE_REQUESTED_NOTIF(attributes)) clk->rate_change_requested_notifications =3D true; - if (PROTOCOL_REV_MAJOR(version) >=3D 0x3) { + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x3) { if (SUPPORTS_PARENT_CLOCK(attributes)) scmi_clock_possible_parents(ph, clk_id, clk); if (SUPPORTS_GET_PERMISSIONS(attributes)) @@ -1068,16 +1066,11 @@ static const struct scmi_protocol_events clk_protoc= ol_events =3D { =20 static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph) { - u32 version; int clkid, ret; struct clock_info *cinfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_dbg(ph->dev, "Clock Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 cinfo =3D devm_kzalloc(ph->dev, sizeof(*cinfo), GFP_KERNEL); if (!cinfo) @@ -1095,12 +1088,12 @@ static int scmi_clock_protocol_init(const struct sc= mi_protocol_handle *ph) for (clkid =3D 0; clkid < cinfo->num_clocks; clkid++) { struct scmi_clock_info *clk =3D cinfo->clk + clkid; =20 - ret =3D scmi_clock_attributes_get(ph, clkid, cinfo, version); + ret =3D scmi_clock_attributes_get(ph, clkid, cinfo); if (!ret) scmi_clock_describe_rates_get(ph, clkid, clk); } =20 - if (PROTOCOL_REV_MAJOR(version) >=3D 0x3) { + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x3) { cinfo->clock_config_set =3D scmi_clock_config_set_v2; cinfo->clock_config_get =3D scmi_clock_config_get_v2; } else { @@ -1108,8 +1101,7 @@ static int scmi_clock_protocol_init(const struct scmi= _protocol_handle *ph) cinfo->clock_config_get =3D scmi_clock_config_get; } =20 - cinfo->version =3D version; - return ph->set_priv(ph, cinfo, version); + return ph->set_priv(ph, cinfo); } =20 static const struct scmi_protocol scmi_clock =3D { diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi= /driver.c index 094cfcf51d28..3e76a3204ba4 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -1627,17 +1627,15 @@ static int version_get(const struct scmi_protocol_h= andle *ph, u32 *version) * * @ph: A reference to the protocol handle. * @priv: The private data to set. - * @version: The detected protocol version for the core to register. * * Return: 0 on Success */ static int scmi_set_protocol_priv(const struct scmi_protocol_handle *ph, - void *priv, u32 version) + void *priv) { struct scmi_protocol_instance *pi =3D ph_to_pi(ph); =20 pi->priv =3D priv; - pi->version =3D version; =20 return 0; } @@ -1657,7 +1655,6 @@ static void *scmi_get_protocol_priv(const struct scmi= _protocol_handle *ph) } =20 static const struct scmi_xfer_ops xfer_ops =3D { - .version_get =3D version_get, .xfer_get_init =3D xfer_get_init, .reset_rx_to_maxsz =3D reset_rx_to_maxsz, .do_xfer =3D do_xfer, diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/p= erf.c index 683fd9b85c5c..c4f6284ccb31 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -178,7 +178,6 @@ struct perf_dom_info { }) =20 struct scmi_perf_info { - u32 version; u16 num_domains; enum scmi_power_scale power_scale; u64 stats_addr; @@ -215,7 +214,7 @@ static int scmi_perf_attributes_get(const struct scmi_p= rotocol_handle *ph, =20 if (POWER_SCALE_IN_MILLIWATT(flags)) pi->power_scale =3D SCMI_POWER_MILLIWATTS; - if (PROTOCOL_REV_MAJOR(pi->version) >=3D 0x3) + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x3) if (POWER_SCALE_IN_MICROWATT(flags)) pi->power_scale =3D SCMI_POWER_MICROWATTS; =20 @@ -251,8 +250,7 @@ static void scmi_perf_xa_destroy(void *data) static int scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph, struct perf_dom_info *dom_info, - bool notify_lim_cmd, bool notify_lvl_cmd, - u32 version) + bool notify_lim_cmd, bool notify_lvl_cmd) { int ret; u32 flags; @@ -280,7 +278,7 @@ scmi_perf_domain_attributes_get(const struct scmi_proto= col_handle *ph, dom_info->perf_level_notify =3D SUPPORTS_PERF_LEVEL_NOTIFY(flags); dom_info->perf_fastchannels =3D SUPPORTS_PERF_FASTCHANNELS(flags); - if (PROTOCOL_REV_MAJOR(version) >=3D 0x4) + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x4) dom_info->level_indexing_mode =3D SUPPORTS_LEVEL_INDEXING(flags); dom_info->rate_limit_us =3D le32_to_cpu(attr->rate_limit_us) & @@ -323,7 +321,7 @@ scmi_perf_domain_attributes_get(const struct scmi_proto= col_handle *ph, * If supported overwrite short name with the extended one; * on error just carry on and use already provided short name. */ - if (!ret && PROTOCOL_REV_MAJOR(version) >=3D 0x3 && + if (!ret && PROTOCOL_REV_MAJOR(ph->version) >=3D 0x3 && SUPPORTS_EXTENDED_NAMES(flags)) ph->hops->extended_name_get(ph, PERF_DOMAIN_NAME_GET, dom_info->id, NULL, dom_info->info.name, @@ -345,19 +343,14 @@ static int opp_cmp_func(const void *opp1, const void = *opp2) return t1->perf - t2->perf; } =20 -struct scmi_perf_ipriv { - u32 version; - struct perf_dom_info *perf_dom; -}; - static void iter_perf_levels_prepare_message(void *message, unsigned int desc_index, const void *priv) { struct scmi_msg_perf_describe_levels *msg =3D message; - const struct scmi_perf_ipriv *p =3D priv; + const struct perf_dom_info *perf_dom =3D priv; =20 - msg->domain =3D cpu_to_le32(p->perf_dom->id); + msg->domain =3D cpu_to_le32(perf_dom->id); /* Set the number of OPPs to be skipped/already read */ msg->level_index =3D cpu_to_le32(desc_index); } @@ -445,21 +438,21 @@ iter_perf_levels_process_response(const struct scmi_p= rotocol_handle *ph, { int ret; struct scmi_opp *opp; - struct scmi_perf_ipriv *p =3D priv; + struct perf_dom_info *perf_dom =3D priv; =20 - opp =3D &p->perf_dom->opp[p->perf_dom->opp_count]; - if (PROTOCOL_REV_MAJOR(p->version) <=3D 0x3) - ret =3D process_response_opp(ph->dev, p->perf_dom, opp, + opp =3D &perf_dom->opp[perf_dom->opp_count]; + if (PROTOCOL_REV_MAJOR(ph->version) <=3D 0x3) + ret =3D process_response_opp(ph->dev, perf_dom, opp, st->loop_idx, response); else - ret =3D process_response_opp_v4(ph->dev, p->perf_dom, opp, + ret =3D process_response_opp_v4(ph->dev, perf_dom, opp, st->loop_idx, response); =20 /* Skip BAD duplicates received from firmware */ if (ret) return ret =3D=3D -EBUSY ? 0 : ret; =20 - p->perf_dom->opp_count++; + perf_dom->opp_count++; =20 dev_dbg(ph->dev, "Level %d Power %d Latency %dus Ifreq %d Index %d\n", opp->perf, opp->power, opp->trans_latency_us, @@ -470,7 +463,7 @@ iter_perf_levels_process_response(const struct scmi_pro= tocol_handle *ph, =20 static int scmi_perf_describe_levels_get(const struct scmi_protocol_handle *ph, - struct perf_dom_info *perf_dom, u32 version) + struct perf_dom_info *perf_dom) { int ret; void *iter; @@ -479,15 +472,11 @@ scmi_perf_describe_levels_get(const struct scmi_proto= col_handle *ph, .update_state =3D iter_perf_levels_update_state, .process_response =3D iter_perf_levels_process_response, }; - struct scmi_perf_ipriv ppriv =3D { - .version =3D version, - .perf_dom =3D perf_dom, - }; =20 iter =3D ph->hops->iter_response_init(ph, &ops, MAX_OPPS, PERF_DESCRIBE_LEVELS, sizeof(struct scmi_msg_perf_describe_levels), - &ppriv); + perf_dom); if (IS_ERR(iter)) return PTR_ERR(iter); =20 @@ -576,7 +565,6 @@ static int __scmi_perf_limits_set(const struct scmi_pro= tocol_handle *ph, static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph, u32 domain, u32 max_perf, u32 min_perf) { - struct scmi_perf_info *pi =3D ph->get_priv(ph); struct perf_dom_info *dom; =20 dom =3D scmi_perf_domain_lookup(ph, domain); @@ -586,7 +574,7 @@ static int scmi_perf_limits_set(const struct scmi_proto= col_handle *ph, if (!dom->set_limits) return -EOPNOTSUPP; =20 - if (PROTOCOL_REV_MAJOR(pi->version) >=3D 0x3 && !max_perf && !min_perf) + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x3 && !max_perf && !min_perf) return -EINVAL; =20 if (dom->level_indexing_mode) { @@ -1281,22 +1269,15 @@ static const struct scmi_protocol_events perf_proto= col_events =3D { static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph) { int domain, ret; - u32 version; struct scmi_perf_info *pinfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_dbg(ph->dev, "Performance Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 pinfo =3D devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) return -ENOMEM; =20 - pinfo->version =3D version; - ret =3D scmi_perf_attributes_get(ph, pinfo); if (ret) return ret; @@ -1311,8 +1292,8 @@ static int scmi_perf_protocol_init(const struct scmi_= protocol_handle *ph) =20 dom->id =3D domain; scmi_perf_domain_attributes_get(ph, dom, pinfo->notify_lim_cmd, - pinfo->notify_lvl_cmd, version); - scmi_perf_describe_levels_get(ph, dom, version); + pinfo->notify_lvl_cmd); + scmi_perf_describe_levels_get(ph, dom); =20 if (dom->perf_fastchannels) scmi_perf_domain_init_fc(ph, dom); @@ -1322,7 +1303,7 @@ static int scmi_perf_protocol_init(const struct scmi_= protocol_handle *ph) if (ret) return ret; =20 - return ph->set_priv(ph, pinfo, version); + return ph->set_priv(ph, pinfo); } =20 static const struct scmi_protocol scmi_perf =3D { diff --git a/drivers/firmware/arm_scmi/pinctrl.c b/drivers/firmware/arm_scm= i/pinctrl.c index 3855c98caf06..ecb83b329f23 100644 --- a/drivers/firmware/arm_scmi/pinctrl.c +++ b/drivers/firmware/arm_scmi/pinctrl.c @@ -117,7 +117,6 @@ struct scmi_pin_info { }; =20 struct scmi_pinctrl_info { - u32 version; int nr_groups; int nr_functions; int nr_pins; @@ -843,15 +842,10 @@ static const struct scmi_pinctrl_proto_ops pinctrl_pr= oto_ops =3D { static int scmi_pinctrl_protocol_init(const struct scmi_protocol_handle *p= h) { int ret; - u32 version; struct scmi_pinctrl_info *pinfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_dbg(ph->dev, "Pinctrl Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 pinfo =3D devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) @@ -876,9 +870,7 @@ static int scmi_pinctrl_protocol_init(const struct scmi= _protocol_handle *ph) if (!pinfo->functions) return -ENOMEM; =20 - pinfo->version =3D version; - - return ph->set_priv(ph, pinfo, version); + return ph->set_priv(ph, pinfo); } =20 static int scmi_pinctrl_protocol_deinit(const struct scmi_protocol_handle = *ph) diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/= power.c index 59aa16444c64..bb5062ab8280 100644 --- a/drivers/firmware/arm_scmi/power.c +++ b/drivers/firmware/arm_scmi/power.c @@ -67,7 +67,6 @@ struct power_dom_info { }; =20 struct scmi_power_info { - u32 version; bool notify_state_change_cmd; int num_domains; u64 stats_addr; @@ -109,7 +108,7 @@ static int scmi_power_attributes_get(const struct scmi_= protocol_handle *ph, static int scmi_power_domain_attributes_get(const struct scmi_protocol_handle *ph, u32 domain, struct power_dom_info *dom_info, - u32 version, bool notify_state_change_cmd) + bool notify_state_change_cmd) { int ret; u32 flags; @@ -141,7 +140,7 @@ scmi_power_domain_attributes_get(const struct scmi_prot= ocol_handle *ph, * If supported overwrite short name with the extended one; * on error just carry on and use already provided short name. */ - if (!ret && PROTOCOL_REV_MAJOR(version) >=3D 0x3 && + if (!ret && PROTOCOL_REV_MAJOR(ph->version) >=3D 0x3 && SUPPORTS_EXTENDED_NAMES(flags)) { ph->hops->extended_name_get(ph, POWER_DOMAIN_NAME_GET, domain, NULL, dom_info->name, @@ -323,15 +322,10 @@ static const struct scmi_protocol_events power_protoc= ol_events =3D { static int scmi_power_protocol_init(const struct scmi_protocol_handle *ph) { int domain, ret; - u32 version; struct scmi_power_info *pinfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_dbg(ph->dev, "Power Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 pinfo =3D devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) @@ -349,13 +343,11 @@ static int scmi_power_protocol_init(const struct scmi= _protocol_handle *ph) for (domain =3D 0; domain < pinfo->num_domains; domain++) { struct power_dom_info *dom =3D pinfo->dom_info + domain; =20 - scmi_power_domain_attributes_get(ph, domain, dom, version, + scmi_power_domain_attributes_get(ph, domain, dom, pinfo->notify_state_change_cmd); } =20 - pinfo->version =3D version; - - return ph->set_priv(ph, pinfo, version); + return ph->set_priv(ph, pinfo); } =20 static const struct scmi_protocol scmi_power =3D { diff --git a/drivers/firmware/arm_scmi/powercap.c b/drivers/firmware/arm_sc= mi/powercap.c index 1fa79bba492e..ab9733f4458b 100644 --- a/drivers/firmware/arm_scmi/powercap.c +++ b/drivers/firmware/arm_scmi/powercap.c @@ -122,7 +122,6 @@ struct scmi_powercap_state { }; =20 struct powercap_info { - u32 version; int num_domains; bool notify_cap_cmd; bool notify_measurements_cmd; @@ -434,7 +433,7 @@ static int __scmi_powercap_cap_set(const struct scmi_pr= otocol_handle *ph, } =20 /* Save the last explicitly set non-zero powercap value */ - if (PROTOCOL_REV_MAJOR(pi->version) >=3D 0x2 && !ret && power_cap) + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x2 && !ret && power_cap) pi->states[domain_id].last_pcap =3D power_cap; =20 return ret; @@ -454,7 +453,7 @@ static int scmi_powercap_cap_set(const struct scmi_prot= ocol_handle *ph, return -EINVAL; =20 /* Just log the last set request if acting on a disabled domain */ - if (PROTOCOL_REV_MAJOR(pi->version) >=3D 0x2 && + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x2 && !pi->states[domain_id].enabled) { pi->states[domain_id].last_pcap =3D power_cap; return 0; @@ -635,7 +634,7 @@ static int scmi_powercap_cap_enable_set(const struct sc= mi_protocol_handle *ph, u32 power_cap; struct powercap_info *pi =3D ph->get_priv(ph); =20 - if (PROTOCOL_REV_MAJOR(pi->version) < 0x2) + if (PROTOCOL_REV_MAJOR(ph->version) < 0x2) return -EINVAL; =20 if (enable =3D=3D pi->states[domain_id].enabled) @@ -676,7 +675,7 @@ static int scmi_powercap_cap_enable_get(const struct sc= mi_protocol_handle *ph, struct powercap_info *pi =3D ph->get_priv(ph); =20 *enable =3D true; - if (PROTOCOL_REV_MAJOR(pi->version) < 0x2) + if (PROTOCOL_REV_MAJOR(ph->version) < 0x2) return 0; =20 /* @@ -961,15 +960,10 @@ static int scmi_powercap_protocol_init(const struct scmi_protocol_handle *ph) { int domain, ret; - u32 version; struct powercap_info *pinfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_dbg(ph->dev, "Powercap Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 pinfo =3D devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) @@ -1006,7 +1000,7 @@ scmi_powercap_protocol_init(const struct scmi_protoco= l_handle *ph) &pinfo->powercaps[domain].fc_info); =20 /* Grab initial state when disable is supported. */ - if (PROTOCOL_REV_MAJOR(version) >=3D 0x2) { + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x2) { ret =3D __scmi_powercap_cap_get(ph, &pinfo->powercaps[domain], &pinfo->states[domain].last_pcap); @@ -1018,8 +1012,7 @@ scmi_powercap_protocol_init(const struct scmi_protoco= l_handle *ph) } } =20 - pinfo->version =3D version; - return ph->set_priv(ph, pinfo, version); + return ph->set_priv(ph, pinfo); } =20 static const struct scmi_protocol scmi_powercap =3D { diff --git a/drivers/firmware/arm_scmi/protocols.h b/drivers/firmware/arm_s= cmi/protocols.h index 2766c2b822b5..4c75970326e6 100644 --- a/drivers/firmware/arm_scmi/protocols.h +++ b/drivers/firmware/arm_scmi/protocols.h @@ -183,8 +183,7 @@ struct scmi_protocol_handle { unsigned int version; const struct scmi_xfer_ops *xops; const struct scmi_proto_helpers_ops *hops; - int (*set_priv)(const struct scmi_protocol_handle *ph, void *priv, - u32 version); + int (*set_priv)(const struct scmi_protocol_handle *ph, void *priv); void *(*get_priv)(const struct scmi_protocol_handle *ph); }; =20 @@ -291,7 +290,6 @@ struct scmi_proto_helpers_ops { =20 /** * struct scmi_xfer_ops - References to the core SCMI xfer operations. - * @version_get: Get this version protocol. * @xfer_get_init: Initialize one struct xfer if any xfer slot is free. * @reset_rx_to_maxsz: Reset rx size to max transport size. * @do_xfer: Do the SCMI transfer. @@ -304,7 +302,6 @@ struct scmi_proto_helpers_ops { * another protocol. */ struct scmi_xfer_ops { - int (*version_get)(const struct scmi_protocol_handle *ph, u32 *version); int (*xfer_get_init)(const struct scmi_protocol_handle *ph, u8 msg_id, size_t tx_size, size_t rx_size, struct scmi_xfer **p); diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/= reset.c index 0aa82b96f41b..06df8e40c6c6 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -65,7 +65,6 @@ struct reset_dom_info { }; =20 struct scmi_reset_info { - u32 version; int num_domains; bool notify_reset_cmd; struct reset_dom_info *dom_info; @@ -100,8 +99,7 @@ static int scmi_reset_attributes_get(const struct scmi_p= rotocol_handle *ph, =20 static int scmi_reset_domain_attributes_get(const struct scmi_protocol_handle *ph, - struct scmi_reset_info *pinfo, - u32 domain, u32 version) + struct scmi_reset_info *pinfo, u32 domain) { int ret; u32 attributes; @@ -137,7 +135,7 @@ scmi_reset_domain_attributes_get(const struct scmi_prot= ocol_handle *ph, * If supported overwrite short name with the extended one; * on error just carry on and use already provided short name. */ - if (!ret && PROTOCOL_REV_MAJOR(version) >=3D 0x3 && + if (!ret && PROTOCOL_REV_MAJOR(ph->version) >=3D 0x3 && SUPPORTS_EXTENDED_NAMES(attributes)) ph->hops->extended_name_get(ph, RESET_DOMAIN_NAME_GET, domain, NULL, dom_info->name, @@ -340,15 +338,10 @@ static const struct scmi_protocol_events reset_protoc= ol_events =3D { static int scmi_reset_protocol_init(const struct scmi_protocol_handle *ph) { int domain, ret; - u32 version; struct scmi_reset_info *pinfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_dbg(ph->dev, "Reset Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 pinfo =3D devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) @@ -364,10 +357,9 @@ static int scmi_reset_protocol_init(const struct scmi_= protocol_handle *ph) return -ENOMEM; =20 for (domain =3D 0; domain < pinfo->num_domains; domain++) - scmi_reset_domain_attributes_get(ph, pinfo, domain, version); + scmi_reset_domain_attributes_get(ph, pinfo, domain); =20 - pinfo->version =3D version; - return ph->set_priv(ph, pinfo, version); + return ph->set_priv(ph, pinfo); } =20 static const struct scmi_protocol scmi_reset =3D { diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scm= i/sensors.c index 791efd0f82d7..882d55f987d2 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -214,7 +214,6 @@ struct scmi_sensor_update_notify_payld { }; =20 struct sensors_info { - u32 version; bool notify_trip_point_cmd; bool notify_continuos_update_cmd; int num_sensors; @@ -524,8 +523,7 @@ scmi_sensor_axis_extended_names_get(const struct scmi_p= rotocol_handle *ph, } =20 static int scmi_sensor_axis_description(const struct scmi_protocol_handle = *ph, - struct scmi_sensor_info *s, - u32 version) + struct scmi_sensor_info *s) { int ret; void *iter; @@ -555,7 +553,7 @@ static int scmi_sensor_axis_description(const struct sc= mi_protocol_handle *ph, if (ret) return ret; =20 - if (PROTOCOL_REV_MAJOR(version) >=3D 0x3 && + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x3 && apriv.any_axes_support_extended_names) ret =3D scmi_sensor_axis_extended_names_get(ph, s); =20 @@ -621,7 +619,7 @@ iter_sens_descr_process_response(const struct scmi_prot= ocol_handle *ph, s->type =3D SENSOR_TYPE(attrh); /* Use pre-allocated pool wherever possible */ s->intervals.desc =3D s->intervals.prealloc_pool; - if (si->version =3D=3D SCMIv2_SENSOR_PROTOCOL) { + if (ph->version =3D=3D SCMIv2_SENSOR_PROTOCOL) { s->intervals.segmented =3D false; s->intervals.count =3D 1; /* @@ -659,7 +657,7 @@ iter_sens_descr_process_response(const struct scmi_prot= ocol_handle *ph, * one; on error just carry on and use already provided * short name. */ - if (PROTOCOL_REV_MAJOR(si->version) >=3D 0x3 && + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x3 && SUPPORTS_EXTENDED_NAMES(attrl)) ph->hops->extended_name_get(ph, SENSOR_NAME_GET, s->id, NULL, s->name, SCMI_MAX_STR_SIZE); @@ -683,7 +681,7 @@ iter_sens_descr_process_response(const struct scmi_prot= ocol_handle *ph, } =20 if (s->num_axis > 0) - ret =3D scmi_sensor_axis_description(ph, s, si->version); + ret =3D scmi_sensor_axis_description(ph, s); =20 st->priv =3D ((u8 *)sdesc + dsize); =20 @@ -1148,21 +1146,15 @@ static const struct scmi_protocol_events sensor_pro= tocol_events =3D { =20 static int scmi_sensors_protocol_init(const struct scmi_protocol_handle *p= h) { - u32 version; int ret; struct sensors_info *sinfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_dbg(ph->dev, "Sensor Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 sinfo =3D devm_kzalloc(ph->dev, sizeof(*sinfo), GFP_KERNEL); if (!sinfo) return -ENOMEM; - sinfo->version =3D version; =20 ret =3D scmi_sensor_attributes_get(ph, sinfo); if (ret) @@ -1176,7 +1168,7 @@ static int scmi_sensors_protocol_init(const struct sc= mi_protocol_handle *ph) if (ret) return ret; =20 - return ph->set_priv(ph, sinfo, version); + return ph->set_priv(ph, sinfo); } =20 static const struct scmi_protocol scmi_sensors =3D { diff --git a/drivers/firmware/arm_scmi/system.c b/drivers/firmware/arm_scmi= /system.c index ec3d355d1772..0f51c36f6a9d 100644 --- a/drivers/firmware/arm_scmi/system.c +++ b/drivers/firmware/arm_scmi/system.c @@ -34,7 +34,6 @@ struct scmi_system_power_state_notifier_payld { }; =20 struct scmi_system_info { - u32 version; bool graceful_timeout_supported; bool power_state_notify_cmd; }; @@ -141,29 +140,22 @@ static const struct scmi_protocol_events system_proto= col_events =3D { =20 static int scmi_system_protocol_init(const struct scmi_protocol_handle *ph) { - int ret; - u32 version; struct scmi_system_info *pinfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_dbg(ph->dev, "System Power Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 pinfo =3D devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) return -ENOMEM; =20 - pinfo->version =3D version; - if (PROTOCOL_REV_MAJOR(pinfo->version) >=3D 0x2) + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x2) pinfo->graceful_timeout_supported =3D true; =20 if (!ph->hops->protocol_msg_check(ph, SYSTEM_POWER_STATE_NOTIFY, NULL)) pinfo->power_state_notify_cmd =3D true; =20 - return ph->set_priv(ph, pinfo, version); + return ph->set_priv(ph, pinfo); } =20 static const struct scmi_protocol scmi_system =3D { diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c b/drivers/f= irmware/arm_scmi/vendors/imx/imx-sm-bbm.c index aa176c1a5eef..33f9ebf6092b 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c @@ -48,7 +48,6 @@ enum scmi_imx_bbm_protocol_cmd { #define SCMI_IMX_BBM_EVENT_RTC_MASK GENMASK(31, 24) =20 struct scmi_imx_bbm_info { - u32 version; int nr_rtc; int nr_gpr; }; @@ -345,16 +344,11 @@ static const struct scmi_imx_bbm_proto_ops scmi_imx_b= bm_proto_ops =3D { =20 static int scmi_imx_bbm_protocol_init(const struct scmi_protocol_handle *p= h) { - u32 version; int ret; struct scmi_imx_bbm_info *binfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_info(ph->dev, "NXP SM BBM Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 binfo =3D devm_kzalloc(ph->dev, sizeof(*binfo), GFP_KERNEL); if (!binfo) @@ -364,7 +358,7 @@ static int scmi_imx_bbm_protocol_init(const struct scmi= _protocol_handle *ph) if (ret) return ret; =20 - return ph->set_priv(ph, binfo, version); + return ph->set_priv(ph, binfo); } =20 static const struct scmi_protocol scmi_imx_bbm =3D { diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c b/drivers/f= irmware/arm_scmi/vendors/imx/imx-sm-cpu.c index 66f47f5371e5..753274af11d2 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c @@ -233,15 +233,10 @@ static int scmi_imx_cpu_attributes_get(const struct s= cmi_protocol_handle *ph, static int scmi_imx_cpu_protocol_init(const struct scmi_protocol_handle *p= h) { struct scmi_imx_cpu_info *info; - u32 version; int ret, i; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_info(ph->dev, "NXP SM CPU Protocol Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 info =3D devm_kzalloc(ph->dev, sizeof(*info), GFP_KERNEL); if (!info) @@ -257,7 +252,7 @@ static int scmi_imx_cpu_protocol_init(const struct scmi= _protocol_handle *ph) return ret; } =20 - return ph->set_priv(ph, info, version); + return ph->set_priv(ph, info); } =20 static const struct scmi_protocol scmi_imx_cpu =3D { diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c b/drivers/f= irmware/arm_scmi/vendors/imx/imx-sm-lmm.c index b519c67fe920..c56ae247774d 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c @@ -226,15 +226,10 @@ static int scmi_imx_lmm_protocol_attributes_get(const= struct scmi_protocol_handl static int scmi_imx_lmm_protocol_init(const struct scmi_protocol_handle *p= h) { struct scmi_imx_lmm_priv *info; - u32 version; int ret; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_info(ph->dev, "NXP SM LMM Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 info =3D devm_kzalloc(ph->dev, sizeof(*info), GFP_KERNEL); if (!info) @@ -244,7 +239,7 @@ static int scmi_imx_lmm_protocol_init(const struct scmi= _protocol_handle *ph) if (ret) return ret; =20 - return ph->set_priv(ph, info, version); + return ph->set_priv(ph, info); } =20 static const struct scmi_protocol scmi_imx_lmm =3D { diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c b/drivers/= firmware/arm_scmi/vendors/imx/imx-sm-misc.c index 700a3f24f4ef..73d80f221b9d 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c @@ -32,7 +32,6 @@ enum scmi_imx_misc_protocol_cmd { }; =20 struct scmi_imx_misc_info { - u32 version; u32 nr_dev_ctrl; u32 nr_brd_ctrl; u32 nr_reason; @@ -380,15 +379,10 @@ static const struct scmi_imx_misc_proto_ops scmi_imx_= misc_proto_ops =3D { static int scmi_imx_misc_protocol_init(const struct scmi_protocol_handle *= ph) { struct scmi_imx_misc_info *minfo; - u32 version; int ret; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_info(ph->dev, "NXP SM MISC Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 minfo =3D devm_kzalloc(ph->dev, sizeof(*minfo), GFP_KERNEL); if (!minfo) @@ -410,7 +404,7 @@ static int scmi_imx_misc_protocol_init(const struct scm= i_protocol_handle *ph) if (ret && ret !=3D -EOPNOTSUPP) return ret; =20 - return ph->set_priv(ph, minfo, version); + return ph->set_priv(ph, minfo); } =20 static const struct scmi_protocol scmi_imx_misc =3D { diff --git a/drivers/firmware/arm_scmi/voltage.c b/drivers/firmware/arm_scm= i/voltage.c index 17127880e10a..b9391c1ee8a0 100644 --- a/drivers/firmware/arm_scmi/voltage.c +++ b/drivers/firmware/arm_scmi/voltage.c @@ -66,7 +66,6 @@ struct scmi_resp_voltage_level_set_complete { }; =20 struct voltage_info { - unsigned int version; unsigned int num_domains; struct scmi_voltage_info *domains; }; @@ -243,7 +242,7 @@ static int scmi_voltage_descriptors_get(const struct sc= mi_protocol_handle *ph, * If supported overwrite short name with the extended one; * on error just carry on and use already provided short name. */ - if (PROTOCOL_REV_MAJOR(vinfo->version) >=3D 0x2) { + if (PROTOCOL_REV_MAJOR(ph->version) >=3D 0x2) { if (SUPPORTS_EXTENDED_NAMES(attributes)) ph->hops->extended_name_get(ph, VOLTAGE_DOMAIN_NAME_GET, @@ -405,20 +404,14 @@ static const struct scmi_voltage_proto_ops voltage_pr= oto_ops =3D { static int scmi_voltage_protocol_init(const struct scmi_protocol_handle *p= h) { int ret; - u32 version; struct voltage_info *vinfo; =20 - ret =3D ph->xops->version_get(ph, &version); - if (ret) - return ret; - dev_dbg(ph->dev, "Voltage Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); + PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); =20 vinfo =3D devm_kzalloc(ph->dev, sizeof(*vinfo), GFP_KERNEL); if (!vinfo) return -ENOMEM; - vinfo->version =3D version; =20 ret =3D scmi_protocol_attributes_get(ph, vinfo); if (ret) @@ -437,7 +430,7 @@ static int scmi_voltage_protocol_init(const struct scmi= _protocol_handle *ph) dev_warn(ph->dev, "No Voltage domains found.\n"); } =20 - return ph->set_priv(ph, vinfo, version); + return ph->set_priv(ph, vinfo); } =20 static const struct scmi_protocol scmi_voltage =3D { --=20 2.52.0