summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2021-04-12 18:41:55 +0200
committerCommit Bot <commit-bot@chromium.org>2021-04-15 14:29:56 +0000
commitc4d16d7601862373394aece980fae04194c369bb (patch)
tree814d8f3260ec519d89a346e1d9e99b88af731e8e
parent95ee60817646d81ea2d7341ec8086fbcbf4615ea (diff)
downloadchrome-ec-c4d16d7601862373394aece980fae04194c369bb.tar.gz
test/cbi: allow to use test with WP GPIO active low
CBI test is usable without setting CONFIG_WP_ACTIVE_HIGH option. BUG=b:185205123 BRANCH=none TEST=make run-cbi Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I3f33167eac0a6545f8f323ff6935c079e706560b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2821698 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--test/cbi.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cbi.c b/test/cbi.c
index 3553744f9b..2096ebce5a 100644
--- a/test/cbi.c
+++ b/test/cbi.c
@@ -16,6 +16,13 @@
static void test_setup(void)
{
+ /* Make sure that write protect is disabled */
+#ifdef CONFIG_WP_ACTIVE_HIGH
+ gpio_set_level(GPIO_WP, 0);
+#else
+ gpio_set_level(GPIO_WP_L, 1);
+#endif /* CONFIG_WP_ACTIVE_HIGH */
+
cbi_create();
cbi_write();
}
@@ -228,7 +235,11 @@ DECLARE_EC_TEST(test_all_tags)
zassert_equal(count, CBI_TAG_COUNT, "%d, %d", count, CBI_TAG_COUNT);
/* Write protect */
+#ifdef CONFIG_WP_ACTIVE_HIGH
gpio_set_level(GPIO_WP, 1);
+#else
+ gpio_set_level(GPIO_WP_L, 0);
+#endif /* CONFIG_WP_ACTIVE_HIGH */
zassert_equal(cbi_write(), EC_ERROR_ACCESS_DENIED, NULL);
return EC_SUCCESS;