test/cbi: allow to use test with WP GPIO active low
CBI test is usable without setting CONFIG_WP_ACTIVE_HIGH option.
BRANCH=none
TEST=make run-cbi
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;
