Skip to contentSkip to conversation

clk: scmi: Fix protocol version fetch for non-CCF platforms

PATCH Applied Kamlesh Gurudasani 2 participants 2 messages Mar 23 – Apr 9 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 clk: scmi: Fix protocol version fetch for non-CCF platforms

The SCMI clock protocol version was only being fetched when CLK_CCF was enabled. On non-CCF platforms, the probe function returned early without fetching the version, leaving priv->version as 0.

This caused issues because code paths like scmi_clk_gate() and scmi_clk_get_permissions() depend on priv->version to determine which protocol message format to use, even in non-CCF mode.

Fix this by moving the scmi_generic_protocol_version() call before the CLK_CCF check, ensuring the version is fetched for both CCF and non-CCF platforms.

Tested on am62lx_evm.

Fixes ae7e0330ce22 ("clk: scmi: add compatibility with clock protocol 2.0")

---
Changes in v2:
- added fixes tag
- added platform on which it was tested
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 drivers/clk/clk_scmi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/clk/clk_scmi.c +6 -6
index ee237ed6337..12c7b1e8254 100644
@@ -341,6 +341,12 @@ static int scmi_clk_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_CLOCK, &priv->version);
+	if (ret) {
+		dev_dbg(dev, "%s: get SCMI clock management protocol version failed\n", __func__);
+		return ret;
+	}
+
 	if (!CONFIG_IS_ENABLED(CLK_CCF))
 		return 0;
 
@@ -352,12 +358,6 @@ static int scmi_clk_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
-	ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_CLOCK, &priv->version);
-	if (ret) {
-		dev_dbg(dev, "%s: get SCMI clock management protocol version failed\n", __func__);
-		return ret;
-	}
-
 	clk_scmi_bulk = kzalloc(num_clocks * sizeof(*clk_scmi), GFP_KERNEL);
 	if (!clk_scmi_bulk)
 		return -ENOMEM;

---
base-commit: f6963fc232603007c661411fb31c57f1a9678a87
change-id: 20260227-ccf-d7f40a33985c

Best regards,

Signature · 1 line
Kamlesh Gurudasani <[email protected]>
#1 lore raw

From: Peng Fan <[email protected]>

Quoted 9 lines · Kamlesh Gurudasani

The SCMI clock protocol version was only being fetched when CLK_CCF was enabled. On non-CCF platforms, the probe function returned early without fetching the version, leaving priv->version as 0.

This caused issues because code paths like scmi_clk_gate() and scmi_clk_get_permissions() depend on priv->version to determine which protocol message format to use, even in non-CCF mode.

[...]

Applied to fsl-qoriq-for-2026.07-rc1, thanks!

[1/1] clk: scmi: Fix protocol version fetch for non-CCF platforms

      commit: d113b295232dd6d819140169d7178d10d155c7e5

Best regards,

Signature · 1 line
Peng Fan <[email protected]>