sandbox_scmi {
compatible = "sandbox,scmi-devices";
- clocks = <&clk_scmi 7>, <&clk_scmi 3>;
+ clocks = <&clk_scmi 2>, <&clk_scmi 0>;
resets = <&reset_scmi 3>;
regul0-supply = <®ul0_scmi>;
regul1-supply = <®ul1_scmi>;
*/
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[] = {
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;
}
ut_assertnonnull(scmi_ctx);
agent = scmi_ctx->agent;
ut_assertnonnull(agent);
- ut_asserteq(2, agent->clk_count);
+ ut_asserteq(3, agent->clk_count);
ut_assertnonnull(agent->clk);
ut_asserteq(1, agent->reset_count);
ut_assertnonnull(agent->reset);
ut_assertnonnull(agent);
/* Test SCMI clocks rate manipulation */
+ ut_asserteq(333, agent->clk[0].rate);
+ ut_asserteq(200, agent->clk[1].rate);
+ ut_asserteq(1000, agent->clk[2].rate);
+
ut_asserteq(1000, clk_get_rate(&scmi_devices->clk[0]));
ut_asserteq(333, clk_get_rate(&scmi_devices->clk[1]));
ret_dev = clk_set_rate(&scmi_devices->clk[1], 1088);
ut_assert(!ret_dev || ret_dev == 1088);
- ut_asserteq(1000, agent->clk[0].rate);
- ut_asserteq(1088, agent->clk[1].rate);
+ ut_asserteq(1088, agent->clk[0].rate);
+ ut_asserteq(200, agent->clk[1].rate);
+ ut_asserteq(1000, agent->clk[2].rate);
ut_asserteq(1000, clk_get_rate(&scmi_devices->clk[0]));
ut_asserteq(1088, clk_get_rate(&scmi_devices->clk[1]));
ut_asserteq(0, clk_enable(&scmi_devices->clk[1]));
- ut_assert(!agent->clk[0].enabled);
- ut_assert(agent->clk[1].enabled);
+ ut_assert(agent->clk[0].enabled);
+ ut_assert(!agent->clk[1].enabled);
ut_assert(!agent->clk[2].enabled);
ut_assertok(clk_disable(&scmi_devices->clk[1]));