[PATCH 2/3] soc/qcom: rpmh: only allow rpmh writes of a single command

Casey Connolly casey.connolly at linaro.org
Mon Apr 13 13:06:15 CEST 2026


With how we currently handle synchronous RPMh access in U-Boot (being
derived from the async-heavy Linux driver), with available documentation
it doesn't seem to be easy to get multiple commands per TCS request
to work correctly, resulting in a broken state. This likely needs more
testing to find a better fix but for now this seems to resolve issues we
hit in Linux on sm8650.

Signed-off-by: Casey Connolly <casey.connolly at linaro.org>
---
 drivers/interconnect/qcom/bcm-voter.c | 16 ++++++++++------
 drivers/soc/qcom/rpmh.c               |  6 ++++++
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c
index 361b03f207a9..5d284448fdf4 100644
--- a/drivers/interconnect/qcom/bcm-voter.c
+++ b/drivers/interconnect/qcom/bcm-voter.c
@@ -292,15 +292,19 @@ int qcom_icc_bcm_voter_commit(struct bcm_voter *voter)
 	tcs_list_gen(voter, QCOM_ICC_BUCKET_AMC, cmds, commit_idx);
 	if (!commit_idx[0])
 		goto out;
 
-	for (int i = 0 ; commit_idx[i] ; ++i) {
-		ret = rpmh_write(voter->dev, RPMH_ACTIVE_ONLY_STATE,
-				 &cmds[i], commit_idx[i]);
-		if (ret) {
-			pr_err("Error sending AMC RPMH requests (%d)\n", ret);
-			goto out;
+	/* U-Boot: don't combine votes into a single message since it doesn't work properly */
+	for (int i = 0, k = 0 ; commit_idx[i] ; ++i) {
+		for (int j = 0; j < commit_idx[i]; j++) {
+			ret = rpmh_write(voter->dev, RPMH_ACTIVE_ONLY_STATE,
+					 &cmds[k + j], 1);
+			if (ret) {
+				pr_err("Error sending AMC RPMH requests (%d)\n", ret);
+				goto out;
+			}
 		}
+		k += commit_idx[i];
 	}
 
 	/* TOFIX vote for WAKE & SLEEP ?? */
 
diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c
index b55e23c4417d..685ac5d27cef 100644
--- a/drivers/soc/qcom/rpmh.c
+++ b/drivers/soc/qcom/rpmh.c
@@ -132,8 +132,14 @@ int rpmh_write(const struct udevice *dev, enum rpmh_state state,
 {
 	DEFINE_RPMH_MSG_ONSTACK(dev, state, rpm_msg);
 	int ret;
 
+	// FIXME: can't seem to get multiple commands per message to work properly
+	if (n > 1) {
+		pr_err("%s: ERROR: RPMh writes with multiple commands don't work!\n", dev->name);
+		return -EINVAL;
+	}
+
 	ret = __fill_rpmh_msg(&rpm_msg, state, cmd, n, false);
 	if (ret)
 		return ret;
 

-- 
2.51.0



More information about the U-Boot mailing list