mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/3] plat: ti: k3: fix SCMI parent clock ids
Date: Tue, 17 Jun 2025 11:01:40 +0200	[thread overview]
Message-ID: <20250617090142.3000882-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20250617090142.3000882-1-s.hauer@pengutronix.de>

On AM62lx not the full clock tree is exposed to the normal world.
Instead only some muxes are exposed which do not have any connection
between them. When a mux has a clock_id of 'n' its possible inputs have
the clock_ids 'n+1', 'n+2',... Now the mux inputs are not exposed as
'n+x', but instead only as 'x', so when the normal world wants to select
the first mux input then it has to pass 0 as input, not n+0. This
confuses the Linux and barebox SCMI clock drivers which hang all muxes
to the first n clock_ids instead of their real parents.

Fix this by adding the scmi clock_id to the possible parents.

Change-Id: I5857e67b040e0060b1d2fe57937b5b44ccc3441e
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 plat/ti/k3/common/drivers/scmi/scmi_clock.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plat/ti/k3/common/drivers/scmi/scmi_clock.c b/plat/ti/k3/common/drivers/scmi/scmi_clock.c
index 48a362ed5..afda3f05b 100644
--- a/plat/ti/k3/common/drivers/scmi/scmi_clock.c
+++ b/plat/ti/k3/common/drivers/scmi/scmi_clock.c
@@ -162,7 +162,7 @@ int32_t plat_scmi_clock_get_possible_parents(unsigned int agent_id,
 									clock->clock_id);
 	if (plat_possible_parents) {
 		for (uint32_t i = 0; i < (uint32_t)*nb_elts ; i++) {
-			plat_possible_parents[i] = i;
+			plat_possible_parents[i] = i + scmi_id + 1;
 		}
 	}
 	VERBOSE("num_parents %d\n", (uint32_t)*nb_elts);
@@ -185,7 +185,7 @@ int32_t plat_scmi_clock_get_parent(unsigned int agent_id,
 	if (status)
 		return SCMI_GENERIC_ERROR;
 
-	parent_id = parent_id - clock->clock_id - 1;
+	parent_id = parent_id - clock->clock_id + scmi_id;
 
 	VERBOSE("scmi_clock_get_parent parent_id = %d\n", parent_id);
 	return parent_id;
@@ -204,7 +204,7 @@ int32_t plat_scmi_clock_set_parent(unsigned int agent_id,
 	if (clock == 0)
 		return SCMI_NOT_FOUND;
 
-	parent_id = parent_id + clock->clock_id + 1;
+	parent_id = parent_id + clock->clock_id - scmi_id;
 	status = scmi_handler_clock_set_clock_parent(clock->dev_id, clock->clock_id, parent_id);
 	if (status)
 		return SCMI_GENERIC_ERROR;
-- 
2.39.5




  reply	other threads:[~2025-06-17  9:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17  9:01 [PATCH 0/3] TF-A: AM62lx: Fixes for barebox support Sascha Hauer
2025-06-17  9:01 ` Sascha Hauer [this message]
2025-06-17  9:01 ` [PATCH 2/3] plat: ti: k3: return 0 parents for clocks which only have a single parent Sascha Hauer
2025-06-17  9:01 ` [PATCH 3/3] HACK: drop COPY_NAME_IDENTIFIER string length check Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250617090142.3000882-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox