diff mbox series

[v5,04/16] test: dm: add protocol-specific channel test

Message ID 20230926065750.734440-5-takahiro.akashi@linaro.org
State Superseded
Headers show
Series firmware: scmi: add SCMI base protocol support | expand

Commit Message

AKASHI Takahiro Sept. 26, 2023, 6:57 a.m. UTC
Any SCMI protocol may have its own channel.
Test this feature on sandbox as the necessary framework was added
in a prior commit.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
v5
* new commit
---
 arch/sandbox/dts/test.dts |  1 +
 test/dm/scmi.c            | 20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

Comments

Simon Glass Oct. 2, 2023, 1:17 a.m. UTC | #1
On Tue, 26 Sept 2023 at 00:58, AKASHI Takahiro
<takahiro.akashi@linaro.org> wrote:
>
> Any SCMI protocol may have its own channel.
> Test this feature on sandbox as the necessary framework was added
> in a prior commit.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
> v5
> * new commit
> ---
>  arch/sandbox/dts/test.dts |  1 +
>  test/dm/scmi.c            | 20 ++++++++++++++++++--
>  2 files changed, 19 insertions(+), 2 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Etienne CARRIERE - foss Oct. 5, 2023, 7:08 a.m. UTC | #2
> From: U-Boot <u-boot-bounces@lists.denx.de> on behalf of Simon Glass <sjg@chromium.org>
> Sent: Monday, October 2, 2023 3:17 AM
> 
> On Tue, 26 Sept 2023 at 00:58, AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> >
> > Any SCMI protocol may have its own channel.
> > Test this feature on sandbox as the necessary framework was added
> > in a prior commit.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> > v5
> > * new commit
> > ---
> >  arch/sandbox/dts/test.dts |  1 +
> >  test/dm/scmi.c            | 20 ++++++++++++++++++--
> >  2 files changed, 19 insertions(+), 2 deletions(-)
> >
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 

Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
diff mbox series

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index f351d5cb84b0..5e2bf8623dff 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -700,6 +700,7 @@ 
 			clk_scmi: protocol@14 {
 				reg = <0x14>;
 				#clock-cells = <1>;
+				linaro,sandbox-channel-id = <0x14>;
 			};
 
 			reset_scmi: protocol@16 {
diff --git a/test/dm/scmi.c b/test/dm/scmi.c
index d87e2731ce42..e4fb1bc635cb 100644
--- a/test/dm/scmi.c
+++ b/test/dm/scmi.c
@@ -109,7 +109,7 @@  static int dm_test_scmi_clocks(struct unit_test_state *uts)
 	struct sandbox_scmi_devices *scmi_devices;
 	struct sandbox_scmi_service *scmi_ctx;
 	struct sandbox_scmi_agent *agent;
-	struct udevice *dev;
+	struct udevice *agent_dev, *clock_dev, *dev;
 	int ret_dev;
 	int ret;
 
@@ -124,6 +124,14 @@  static int dm_test_scmi_clocks(struct unit_test_state *uts)
 	agent = scmi_ctx->agent;
 	ut_assertnonnull(agent);
 
+	/* Sandbox SCMI clock protocol has its own channel */
+	ut_assertok(uclass_get_device_by_name(UCLASS_SCMI_AGENT, "scmi",
+					      &agent_dev));
+	ut_assertnonnull(agent_dev);
+	clock_dev = scmi_get_protocol(agent_dev, SCMI_PROTOCOL_ID_CLOCK);
+	ut_assertnonnull(clock_dev);
+	ut_asserteq(0x14, sandbox_scmi_channel_id(clock_dev));
+
 	/* Test SCMI clocks rate manipulation */
 	ut_asserteq(333, agent->clk[0].rate);
 	ut_asserteq(200, agent->clk[1].rate);
@@ -172,7 +180,7 @@  static int dm_test_scmi_resets(struct unit_test_state *uts)
 	struct sandbox_scmi_devices *scmi_devices;
 	struct sandbox_scmi_service *scmi_ctx;
 	struct sandbox_scmi_agent *agent;
-	struct udevice *dev = NULL;
+	struct udevice *agent_dev, *reset_dev, *dev = NULL;
 	int ret;
 
 	ret = load_sandbox_scmi_test_devices(uts, &dev);
@@ -186,6 +194,14 @@  static int dm_test_scmi_resets(struct unit_test_state *uts)
 	agent = scmi_ctx->agent;
 	ut_assertnonnull(agent);
 
+	/* Sandbox SCMI reset protocol doesn't have its own channel */
+	ut_assertok(uclass_get_device_by_name(UCLASS_SCMI_AGENT, "scmi",
+					      &agent_dev));
+	ut_assertnonnull(agent_dev);
+	reset_dev = scmi_get_protocol(agent_dev, SCMI_PROTOCOL_ID_RESET_DOMAIN);
+	ut_assertnonnull(reset_dev);
+	ut_asserteq(0x0, sandbox_scmi_channel_id(reset_dev));
+
 	/* Test SCMI resect controller manipulation */
 	ut_assert(!agent->reset[0].asserted);