aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware/scmi
diff options
context:
space:
mode:
authorEtienne Carriere2022-02-21 09:22:41 +0100
committerTom Rini2022-03-02 17:42:06 -0500
commit10d3e5d20b284025cb6a734fcc7e1c8231ff56b6 (patch)
tree27201b686319e0f8fa61c171f24377bb35837eab /drivers/firmware/scmi
parent6983710a31a0d6fb782eb0ea18b9325e4075f4c3 (diff)
firmware: scmi: fix sandbox and related tests for clock discovery
Updates sandbox SCMI clock driver and tests since enabling CCF will mandate clock discovery that is all exposed SCMI clocks shall be discovered at initialization. For this reason, sandbox SCMI clock driver must emulate all clocks exposed by SCMI server, not only those effectively consumed by some other U-Boot devices. Therefore the sandbox SCMI test driver exposes 3 clocks (IDs 0, 1 and 2) and sandbox SCMI clock consumer driver gets 2 of them. Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Diffstat (limited to 'drivers/firmware/scmi')
-rw-r--r--drivers/firmware/scmi/sandbox-scmi_agent.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c
index 51474b57608..fc717a8aeab 100644
--- a/drivers/firmware/scmi/sandbox-scmi_agent.c
+++ b/drivers/firmware/scmi/sandbox-scmi_agent.c
@@ -34,8 +34,9 @@
*/
static struct sandbox_scmi_clk scmi_clk[] = {
- { .id = 7, .rate = 1000 },
- { .id = 3, .rate = 333 },
+ { .rate = 333 },
+ { .rate = 200 },
+ { .rate = 1000 },
};
static struct sandbox_scmi_reset scmi_reset[] = {
@@ -81,11 +82,8 @@ static void debug_print_agent_state(struct udevice *dev, char *str)
static struct sandbox_scmi_clk *get_scmi_clk_state(uint clock_id)
{
- size_t n;
-
- for (n = 0; n < ARRAY_SIZE(scmi_clk); n++)
- if (scmi_clk[n].id == clock_id)
- return scmi_clk + n;
+ if (clock_id < ARRAY_SIZE(scmi_clk))
+ return scmi_clk + clock_id;
return NULL;
}