summaryrefslogtreecommitdiff
path: root/test/flash_write_protect.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/flash_write_protect.c')
-rw-r--r--test/flash_write_protect.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/flash_write_protect.c b/test/flash_write_protect.c
index 5e34b1735b..2b69484e93 100644
--- a/test/flash_write_protect.c
+++ b/test/flash_write_protect.c
@@ -12,12 +12,22 @@
test_static int check_image_and_hardware_write_protect(void)
{
+ int wp;
+
if (system_get_image_copy() != EC_IMAGE_RO) {
ccprintf("This test is only works when running RO\n");
return EC_ERROR_UNKNOWN;
}
- if (gpio_get_level(GPIO_WP) != 1) {
+#ifdef CONFIG_WP_ALWAYS
+ wp = 1;
+#elif defined(CONFIG_WP_ACTIVE_HIGH)
+ wp = gpio_get_level(GPIO_WP);
+#else
+ wp = !gpio_get_level(GPIO_WP_L);
+#endif
+
+ if (!wp) {
ccprintf("Hardware write protect (GPIO_WP) must be enabled\n");
return EC_ERROR_UNKNOWN;
}