From patchwork Mon Feb 22 07:27:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 385741 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp1052502jap; Sun, 21 Feb 2021 23:29:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRYrale3vpKaSLiATRD1q6us+nF0mcM2KNmagFCoMXvzYULhCEICMH9WPdncTYf6Qk5lIg X-Received: by 2002:a17:907:c27:: with SMTP id ga39mr20302423ejc.68.1613978979740; Sun, 21 Feb 2021 23:29:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613978979; cv=none; d=google.com; s=arc-20160816; b=GZQB+vd2mMW5v+rySz3svhOuZBYf0/eYemdUJ3tvZnUJnFlLxLII1HYdxLWRipqluO 4pcxYVrWFIR8dghXI5PTs9l76Dlvo83Opd96C0WfgU5ksBYMqNrobnB4lO0ktZSf8eNz 0oIVRxYCiLC+QEIm/QGoll6TVUqBrtHOZISNsz/qp7Rs61P6G4XLB0CxAMwr9FUEXLou 8jgtzGf2V/NDb2nmWuAqvwC52kp2fipgGyaTIyghlzotyyTo8J4OBL1184IkGr8b6ZBQ 3iYcaE+WNykNxX3z4kQldjrGWB8oRR/evDa8jhbi18a5Lx6Js7LSLVgUXtSHXbRavgc9 dGvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=LbotzdFsTKAywJGMP5dT+GG767PCL4ehk+oRpp2r6/4=; b=B5tA9AB83zxoS29VUPcpohB71KwD6SjxovWgRH3EvbJPAyce5hFcHEeG+eOMdcUf1n X7YV8hJnFPozDKw2HI/GaOTOt63pS4wSgMXtrJTKS6R+yHP7KCV+CswHcD32wErfCT0b QixBWb10IEptCwTO2u4MHgnJeN2PsrDZwm/d2HGujXTksH1f443CJeSQJk9QC2HA/FSf Ssfs607ognVphGHBVj7Y7XEKLo7sBYWv7a4f18hGDtBG97vIOQCVD5iRA/hrmA69p3CI oTyOI4ZrlhZOyiKQUXiNEFcS1d8wPIXXYDLMZ7GNpa3PgLPPFrs0uEZ0scaoBVTHU/4n o22g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YCXm5Yzi; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id y16si5985188eds.139.2021.02.21.23.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Feb 2021 23:29:39 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YCXm5Yzi; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6F800828A8; Mon, 22 Feb 2021 08:29:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YCXm5Yzi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94E1182890; Mon, 22 Feb 2021 08:29:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E299A82890 for ; Mon, 22 Feb 2021 08:28:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x42c.google.com with SMTP id v14so17923089wro.7 for ; Sun, 21 Feb 2021 23:28:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LbotzdFsTKAywJGMP5dT+GG767PCL4ehk+oRpp2r6/4=; b=YCXm5YzifcAd0pQzOEpzlxr/XkwInl8yBjqm19IQB+zHR1qlxmEGY16vcKV072OiCX l9R1iAkePMd6eNrZpZI8Q7SXODBYQKjO1xnNEW6YsBPRV+9nTEZDmBwBRVsBYtuX6VZT 1R3MDs69wD3RIMflg3RJMSI9aR9WLoc6leGib2bF6nNiDb4sFvhUhTwMktyI9LV7b1ah TJ/Mlq1I/Opxy/LEPItDe6Y/9sf+XCDsrmrkuyWObckARaDObTfPi4LDa9UPX9AKrun0 1JimACAJpAsruzfBTAlaXgkuMjxwqwZC4IS0T5WzH1HtDJR4+1muCUWu7Cr7B3h6r/XG 0ezw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LbotzdFsTKAywJGMP5dT+GG767PCL4ehk+oRpp2r6/4=; b=bAccOc/XhBLWTptv3l1DFLrXe9i+6WNnaq0GcVyhs62MF66x81wBqnoKggeK3d9RGo /mJVgGqj1kkZAmQWgAxawR+NyguSRUWvQmiRHdtdW+Kj6iOIH400fOt7A7FSULGzWyYd 67PkiXUJe873wnGJdv4DDsfyDxNlP4yXx2szhlCDJPJ/s8KL2xvMAsOz8kL6lFhVb8Rc KDNynFL1tmBUH+FvGjcO3F1RCHqPIVdwzjMjmgNlVg1Y0R6k+wBvC1HmCZ0inQFqek34 OrwX7/iJqenkoRbSVV43uLIUoIUsJ9BbziH6kH5jF1cj7t5XzlZWboyvLcwmGzs7rtv+ mdXA== X-Gm-Message-State: AOAM532t37V6uSfaJPwi543CgKrmEibKin5ZhQ65KlipDpR6FMtqpv1T JghrvEjrltXD9krEUeqkrRJCBux0l8XouA== X-Received: by 2002:adf:fb03:: with SMTP id c3mr20343321wrr.395.1613978937323; Sun, 21 Feb 2021 23:28:57 -0800 (PST) Received: from lmecxl0524.lme.st.com (2a01cb058b850800b51a732fdac74386.ipv6.abo.wanadoo.fr. [2a01:cb05:8b85:800:b51a:732f:dac7:4386]) by smtp.gmail.com with ESMTPSA id u137sm25426244wmu.20.2021.02.21.23.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Feb 2021 23:28:57 -0800 (PST) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Simon Glass , Jaehoon Chung , Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v3 4/4] test: scmi: add local variables for scmi agent reference Date: Mon, 22 Feb 2021 08:27:47 +0100 Message-Id: <20210222072747.7514-4-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210222072747.7514-1-etienne.carriere@linaro.org> References: <20210222072747.7514-1-etienne.carriere@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add local variables agent0/agent1 to refer to SCMI sandbox context agent and ease readability of the test. For consistency, rename regul_dev to regul0_dev and remove sandbox_voltd in dm_test_scmi_voltage_domains(). Signed-off-by: Etienne Carriere --- Changes in v3 - new change added to the series, suggested from patch v2 review. --- test/dm/scmi.c | 100 +++++++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 45 deletions(-) -- 2.17.1 Reviewed-by: Simon Glass diff --git a/test/dm/scmi.c b/test/dm/scmi.c index 2eaf06392..c938e6d4f 100644 --- a/test/dm/scmi.c +++ b/test/dm/scmi.c @@ -39,6 +39,8 @@ static int ut_assert_scmi_state_postprobe(struct unit_test_state *uts, { struct sandbox_scmi_devices *scmi_devices; struct sandbox_scmi_service *scmi_ctx; + struct sandbox_scmi_agent *agent0; + struct sandbox_scmi_agent *agent1; /* Device references to check context against test sequence */ scmi_devices = sandbox_scmi_devices_ctx(dev); @@ -50,20 +52,22 @@ static int ut_assert_scmi_state_postprobe(struct unit_test_state *uts, /* State of the simulated SCMI server exposed */ scmi_ctx = sandbox_scmi_service_ctx(); + agent0 = scmi_ctx->agent[0]; + agent1 = scmi_ctx->agent[1]; ut_asserteq(2, scmi_ctx->agent_count); - ut_assertnonnull(scmi_ctx->agent[0]); - ut_asserteq(2, scmi_ctx->agent[0]->clk_count); - ut_assertnonnull(scmi_ctx->agent[0]->clk); - ut_asserteq(1, scmi_ctx->agent[0]->reset_count); - ut_assertnonnull(scmi_ctx->agent[0]->reset); - ut_asserteq(2, scmi_ctx->agent[0]->voltd_count); - ut_assertnonnull(scmi_ctx->agent[0]->voltd); + ut_assertnonnull(agent0); + ut_asserteq(2, agent0->clk_count); + ut_assertnonnull(agent0->clk); + ut_asserteq(1, agent0->reset_count); + ut_assertnonnull(agent0->reset); + ut_asserteq(2, agent0->voltd_count); + ut_assertnonnull(agent0->voltd); - ut_assertnonnull(scmi_ctx->agent[1]); - ut_assertnonnull(scmi_ctx->agent[1]->clk); - ut_asserteq(1, scmi_ctx->agent[1]->clk_count); + ut_assertnonnull(agent1); + ut_assertnonnull(agent1->clk); + ut_asserteq(1, agent1->clk_count); return 0; } @@ -114,6 +118,8 @@ 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 *agent0; + struct sandbox_scmi_agent *agent1; struct udevice *dev = NULL; int ret_dev; int ret; @@ -124,6 +130,8 @@ static int dm_test_scmi_clocks(struct unit_test_state *uts) scmi_devices = sandbox_scmi_devices_ctx(dev); scmi_ctx = sandbox_scmi_service_ctx(); + agent0 = scmi_ctx->agent[0]; + agent1 = scmi_ctx->agent[1]; /* Test SCMI clocks rate manipulation */ ut_asserteq(1000, clk_get_rate(&scmi_devices->clk[0])); @@ -133,9 +141,9 @@ static int dm_test_scmi_clocks(struct unit_test_state *uts) ret_dev = clk_set_rate(&scmi_devices->clk[1], 1088); ut_assert(!ret_dev || ret_dev == 1088); - ut_asserteq(1000, scmi_ctx->agent[0]->clk[0].rate); - ut_asserteq(1088, scmi_ctx->agent[0]->clk[1].rate); - ut_asserteq(44, scmi_ctx->agent[1]->clk[0].rate); + ut_asserteq(1000, agent0->clk[0].rate); + ut_asserteq(1088, agent0->clk[1].rate); + ut_asserteq(44, agent1->clk[0].rate); ut_asserteq(1000, clk_get_rate(&scmi_devices->clk[0])); ut_asserteq(1088, clk_get_rate(&scmi_devices->clk[1])); @@ -146,23 +154,23 @@ static int dm_test_scmi_clocks(struct unit_test_state *uts) ut_assert(!ret_dev || ret_dev == 333); /* Test SCMI clocks gating manipulation */ - ut_assert(!scmi_ctx->agent[0]->clk[0].enabled); - ut_assert(!scmi_ctx->agent[0]->clk[1].enabled); - ut_assert(!scmi_ctx->agent[1]->clk[0].enabled); + ut_assert(!agent0->clk[0].enabled); + ut_assert(!agent0->clk[1].enabled); + ut_assert(!agent1->clk[0].enabled); ut_asserteq(0, clk_enable(&scmi_devices->clk[1])); ut_asserteq(0, clk_enable(&scmi_devices->clk[2])); - ut_assert(!scmi_ctx->agent[0]->clk[0].enabled); - ut_assert(scmi_ctx->agent[0]->clk[1].enabled); - ut_assert(scmi_ctx->agent[1]->clk[0].enabled); + ut_assert(!agent0->clk[0].enabled); + ut_assert(agent0->clk[1].enabled); + ut_assert(agent1->clk[0].enabled); ut_assertok(clk_disable(&scmi_devices->clk[1])); ut_assertok(clk_disable(&scmi_devices->clk[2])); - ut_assert(!scmi_ctx->agent[0]->clk[0].enabled); - ut_assert(!scmi_ctx->agent[0]->clk[1].enabled); - ut_assert(!scmi_ctx->agent[1]->clk[0].enabled); + ut_assert(!agent0->clk[0].enabled); + ut_assert(!agent0->clk[1].enabled); + ut_assert(!agent1->clk[0].enabled); return release_sandbox_scmi_test_devices(uts, dev); } @@ -172,6 +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 *agent0; struct udevice *dev = NULL; int ret; @@ -181,15 +190,16 @@ static int dm_test_scmi_resets(struct unit_test_state *uts) scmi_devices = sandbox_scmi_devices_ctx(dev); scmi_ctx = sandbox_scmi_service_ctx(); + agent0 = scmi_ctx->agent[0]; /* Test SCMI resect controller manipulation */ - ut_assert(!scmi_ctx->agent[0]->reset[0].asserted) + ut_assert(!agent0->reset[0].asserted) ut_assertok(reset_assert(&scmi_devices->reset[0])); - ut_assert(scmi_ctx->agent[0]->reset[0].asserted) + ut_assert(agent0->reset[0].asserted) ut_assertok(reset_deassert(&scmi_devices->reset[0])); - ut_assert(!scmi_ctx->agent[0]->reset[0].asserted); + ut_assert(!agent0->reset[0].asserted); return release_sandbox_scmi_test_devices(uts, dev); } @@ -199,51 +209,51 @@ static int dm_test_scmi_voltage_domains(struct unit_test_state *uts) { struct sandbox_scmi_devices *scmi_devices; struct sandbox_scmi_service *scmi_ctx; - struct sandbox_scmi_voltd *sandbox_voltd; + struct sandbox_scmi_agent *agent0; struct dm_regulator_uclass_plat *uc_pdata; struct udevice *dev; - struct udevice *regul_dev; + struct udevice *regul0_dev; ut_assertok(load_sandbox_scmi_test_devices(uts, &dev)); scmi_devices = sandbox_scmi_devices_ctx(dev); scmi_ctx = sandbox_scmi_service_ctx(); + agent0 = scmi_ctx->agent[0]; /* Set/Get an SCMI voltage domain level */ - sandbox_voltd = &scmi_ctx->agent[0]->voltd[0]; - regul_dev = scmi_devices->regul[0]; - ut_assert(regul_dev); + regul0_dev = scmi_devices->regul[0]; + ut_assert(regul0_dev); - uc_pdata = dev_get_uclass_plat(regul_dev); + uc_pdata = dev_get_uclass_plat(regul0_dev); ut_assert(uc_pdata); - ut_assertok(regulator_set_value(regul_dev, uc_pdata->min_uV)); - ut_asserteq(sandbox_voltd->voltage_uv, uc_pdata->min_uV); + ut_assertok(regulator_set_value(regul0_dev, uc_pdata->min_uV)); + ut_asserteq(agent0->voltd[0].voltage_uv, uc_pdata->min_uV); - ut_assert(regulator_get_value(regul_dev) == uc_pdata->min_uV); + ut_assert(regulator_get_value(regul0_dev) == uc_pdata->min_uV); - ut_assertok(regulator_set_value(regul_dev, uc_pdata->max_uV)); - ut_asserteq(sandbox_voltd->voltage_uv, uc_pdata->max_uV); + ut_assertok(regulator_set_value(regul0_dev, uc_pdata->max_uV)); + ut_asserteq(agent0->voltd[0].voltage_uv, uc_pdata->max_uV); - ut_assert(regulator_get_value(regul_dev) == uc_pdata->max_uV); + ut_assert(regulator_get_value(regul0_dev) == uc_pdata->max_uV); /* Enable/disable SCMI voltage domains */ ut_assertok(regulator_set_enable(scmi_devices->regul[0], false)); ut_assertok(regulator_set_enable(scmi_devices->regul[1], false)); - ut_assert(!scmi_ctx->agent[0]->voltd[0].enabled); - ut_assert(!scmi_ctx->agent[0]->voltd[1].enabled); + ut_assert(!agent0->voltd[0].enabled); + ut_assert(!agent0->voltd[1].enabled); ut_assertok(regulator_set_enable(scmi_devices->regul[0], true)); - ut_assert(scmi_ctx->agent[0]->voltd[0].enabled); - ut_assert(!scmi_ctx->agent[0]->voltd[1].enabled); + ut_assert(agent0->voltd[0].enabled); + ut_assert(!agent0->voltd[1].enabled); ut_assertok(regulator_set_enable(scmi_devices->regul[1], true)); - ut_assert(scmi_ctx->agent[0]->voltd[0].enabled); - ut_assert(scmi_ctx->agent[0]->voltd[1].enabled); + ut_assert(agent0->voltd[0].enabled); + ut_assert(agent0->voltd[1].enabled); ut_assertok(regulator_set_enable(scmi_devices->regul[0], false)); - ut_assert(!scmi_ctx->agent[0]->voltd[0].enabled); - ut_assert(scmi_ctx->agent[0]->voltd[1].enabled); + ut_assert(!agent0->voltd[0].enabled); + ut_assert(agent0->voltd[1].enabled); return release_sandbox_scmi_test_devices(uts, dev); }