summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2021-08-19 14:54:52 -0700
committerCommit Bot <commit-bot@chromium.org>2021-08-23 22:44:35 +0000
commit7cdd6a24aad8fcf33c1527ebdbe5a10547258b41 (patch)
tree9b100051419ee78bc7a7fcc1eac496b5ef121fdb
parent7b650e2cbad65413d48d539fd71e1593001d658c (diff)
downloadvboot-stabilize-14178.B.tar.gz
crossystem: arm: support active-high WP and RECOVERY GPIOsstabilize-14179.Bstabilize-14178.B
Some systems have an active-high GPIO for reading WP status, so support an inverted name for that. While we're at it, do this for recovery too, just in case someone needs it. BRANCH=none BUG=b:197258688 TEST=play with servo's `fw_wp_state`, check `crossystem wpsw_cur` on kevin-kernelnext + DTS change Signed-off-by: Brian Norris <briannorris@chromium.org> Change-Id: I28ad566568d6dc62843d0bc9b75cca1fc1a35633 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3108068 Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--host/arch/arm/lib/crossystem_arch.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c
index 0223b70c..116f8fc2 100644
--- a/host/arch/arm/lib/crossystem_arch.c
+++ b/host/arch/arm/lib/crossystem_arch.c
@@ -35,7 +35,9 @@
#define PLATFORM_DEV_PATH "/sys/devices/platform/chromeos_arm"
/* These should match the Linux GPIO name (i.e., 'gpio-line-names'). */
#define GPIO_NAME_RECOVERY_SW_L "RECOVERY_SW_L"
+#define GPIO_NAME_RECOVERY_SW "RECOVERY_SW"
#define GPIO_NAME_WP_L "AP_FLASH_WP_L"
+#define GPIO_NAME_WP "AP_FLASH_WP"
/* Device for NVCTX write */
#define NVCTX_PATH "/dev/mmcblk%d"
/* Base name for GPIO files */
@@ -481,6 +483,9 @@ int VbGetArchPropertyInt(const char* name)
value = gpiod_read(GPIO_NAME_RECOVERY_SW_L, true);
if (value != -1)
return value;
+ value = gpiod_read(GPIO_NAME_RECOVERY_SW, false);
+ if (value != -1)
+ return value;
/* Try the deprecated chromeos_arm platform device next. */
return VbGetPlatformGpioStatus("recovery");
} else if (!strcasecmp(name, "wpsw_cur")) {
@@ -489,6 +494,9 @@ int VbGetArchPropertyInt(const char* name)
value = gpiod_read(GPIO_NAME_WP_L, true);
if (value != -1)
return value;
+ value = gpiod_read(GPIO_NAME_WP, false);
+ if (value != -1)
+ return value;
/* Try the deprecated chromeos_arm platform device next. */
return VbGetPlatformGpioStatus("write-protect");
} else if (!strcasecmp(name, "recoverysw_ec_boot")) {