* [PATCH 0/3] TF-A: AM62lx: Fixes for barebox support @ 2025-06-17 9:01 Sascha Hauer 2025-06-17 9:01 ` [PATCH 1/3] plat: ti: k3: fix SCMI parent clock ids Sascha Hauer ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Sascha Hauer @ 2025-06-17 9:01 UTC (permalink / raw) To: Barebox List The AM62lx ARM trusted firmware support is not yet merged upstream, the downstream support is currently available at [1] Unfortunately this contains some bugs in the SCMI clock implementation which confuses both the barebox and the Linux SCMI clock driver. TI is aware of this, see [2] and [3] for details. I am posting these patches here for others be able to build a usable AM62lx TF-A for barebox and to refer to these patches from the barebox documentation. Patches are based on the 11.00.11 tag. [1] https://github.com/TexasInstruments/arm-trusted-firmware.git. [2] https://lore.kernel.org/all/aCcSG5ah12N0yOwi@pengutronix.de/ [3] https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/34834/1 Sascha Hauer (3): plat: ti: k3: fix SCMI parent clock ids plat: ti: k3: return 0 parents for clocks which only have a single parent HACK: drop COPY_NAME_IDENTIFIER string length check drivers/scmi-msg/common.h | 1 - plat/ti/k3/common/drivers/scmi/scmi_clock.c | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) -- 2.39.5 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] plat: ti: k3: fix SCMI parent clock ids 2025-06-17 9:01 [PATCH 0/3] TF-A: AM62lx: Fixes for barebox support Sascha Hauer @ 2025-06-17 9:01 ` Sascha Hauer 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 2 siblings, 0 replies; 4+ messages in thread From: Sascha Hauer @ 2025-06-17 9:01 UTC (permalink / raw) To: Barebox List 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] plat: ti: k3: return 0 parents for clocks which only have a single parent 2025-06-17 9:01 [PATCH 0/3] TF-A: AM62lx: Fixes for barebox support Sascha Hauer 2025-06-17 9:01 ` [PATCH 1/3] plat: ti: k3: fix SCMI parent clock ids Sascha Hauer @ 2025-06-17 9:01 ` Sascha Hauer 2025-06-17 9:01 ` [PATCH 3/3] HACK: drop COPY_NAME_IDENTIFIER string length check Sascha Hauer 2 siblings, 0 replies; 4+ messages in thread From: Sascha Hauer @ 2025-06-17 9:01 UTC (permalink / raw) To: Barebox List Some clocks return one parent in their get_num_clock_parents() hook, but if asked for this parent it returns an error which goes down to device_clk_get_parent() where we have: if (!fail && (clock_data->type != DEV_CLK_TABLE_TYPE_MUX)) { fail = true; } A clock with only one parent is not a mux, but why should it be not allowed to to have a parent? This code all looks strange and I suspect more problems here. For now just report clocks with a single parent as clocks without parent. Change-Id: I6d120e6774b6b630e86ce921891823715126a905 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- plat/ti/k3/common/drivers/scmi/scmi_clock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plat/ti/k3/common/drivers/scmi/scmi_clock.c b/plat/ti/k3/common/drivers/scmi/scmi_clock.c index afda3f05b..9eee60e69 100644 --- a/plat/ti/k3/common/drivers/scmi/scmi_clock.c +++ b/plat/ti/k3/common/drivers/scmi/scmi_clock.c @@ -160,6 +160,9 @@ int32_t plat_scmi_clock_get_possible_parents(unsigned int agent_id, *nb_elts = (uint64_t)scmi_handler_clock_get_num_clock_parents(clock->dev_id, clock->clock_id); + if (*nb_elts == 1) + *nb_elts = 0; + if (plat_possible_parents) { for (uint32_t i = 0; i < (uint32_t)*nb_elts ; i++) { plat_possible_parents[i] = i + scmi_id + 1; -- 2.39.5 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] HACK: drop COPY_NAME_IDENTIFIER string length check 2025-06-17 9:01 [PATCH 0/3] TF-A: AM62lx: Fixes for barebox support Sascha Hauer 2025-06-17 9:01 ` [PATCH 1/3] plat: ti: k3: fix SCMI parent clock ids Sascha Hauer 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 ` Sascha Hauer 2 siblings, 0 replies; 4+ messages in thread From: Sascha Hauer @ 2025-06-17 9:01 UTC (permalink / raw) To: Barebox List Clock names are only allowed to be 16 characters long. Drop the assertion to check the string length because am62l has several clocks with longer names. Change-Id: I1356983e8314d9e9db11bcb7478cab633fa5802a Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/scmi-msg/common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scmi-msg/common.h b/drivers/scmi-msg/common.h index 6b186d07d..65f0471fb 100644 --- a/drivers/scmi-msg/common.h +++ b/drivers/scmi-msg/common.h @@ -28,7 +28,6 @@ */ #define COPY_NAME_IDENTIFIER(_dst_array, _name) \ do { \ - assert(strlen(_name) < sizeof(_dst_array)); \ strlcpy((_dst_array), (_name), sizeof(_dst_array)); \ } while (0) -- 2.39.5 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-17 9:02 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-06-17 9:01 [PATCH 0/3] TF-A: AM62lx: Fixes for barebox support Sascha Hauer 2025-06-17 9:01 ` [PATCH 1/3] plat: ti: k3: fix SCMI parent clock ids Sascha Hauer 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox