diff options
author | Joel Kitching <kitching@google.com> | 2019-03-27 18:33:45 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-29 21:27:38 +0000 |
commit | 895ed80947d54730e0251767ec36a6d50db5f5c2 (patch) | |
tree | b2325e9ff3afa3f784608d0ba88ed434e1a5f675 | |
parent | a5c7821afa3cdbcf5a622f28e2277354de87453d (diff) | |
download | vboot-895ed80947d54730e0251767ec36a6d50db5f5c2.tar.gz |
vboot: deprecate ARM's VbGetVarGpio
This was originally used for some U-Boot devices which have
already reached AUE.
Keep gpiod_read (the current method), and VbGetPlatformGpioStatus
(deprecated, but still used in current devices).
BUG=chromium:942901
TEST=make clean && make runtests
BRANCH=none
Change-Id: I2a7b97f2ead0294027407cb4e9349cc5265f8f82
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1539434
Tested-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | host/arch/arm/lib/crossystem_arch.c | 73 |
1 files changed, 2 insertions, 71 deletions
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c index 75ed4ef9..5a6649ee 100644 --- a/host/arch/arm/lib/crossystem_arch.c +++ b/host/arch/arm/lib/crossystem_arch.c @@ -188,68 +188,6 @@ static int VbGetPlatformGpioStatus(const char* name) return (int)value; } -static int VbGetGpioStatus(unsigned gpio_number) -{ - char gpio_name[FNAME_SIZE]; - unsigned value; - - snprintf(gpio_name, sizeof(gpio_name), "%s/gpio%d/value", - GPIO_BASE_PATH, gpio_number); - if (ReadFileInt(gpio_name, &value) < 0) { - /* Try exporting the GPIO */ - FILE* f = fopen(GPIO_EXPORT_PATH, "wt"); - if (!f) - return -1; - fprintf(f, "%d", gpio_number); - fclose(f); - - /* Try re-reading the GPIO value */ - if (ReadFileInt(gpio_name, &value) < 0) - return -1; - } - - return (int)value; -} - -static int VbGetVarGpio(const char* name) -{ - int gpio_num; - void *pp = NULL; - int *prop; - size_t proplen = 0; - int ret = 0; - - /* TODO: This should at some point in the future use the phandle - * to find the gpio chip and thus the base number. Assume 0 now, - * which isn't 100% future-proof (i.e. if one of the switches gets - * moved to an offchip gpio controller. - */ - - ret = ReadFdtBlock(name, &pp, &proplen); - if (ret || !pp || proplen != 12) { - ret = 2; - goto out; - } - prop = pp; - gpio_num = ntohl(prop[1]); - - /* - * TODO(chrome-os-partner:11296): Use gpio_num == 0 to denote non-exist - * GPIO for now, at the risk that one day we might actually want to - * read from a GPIO port 0. We should figure out how to represent - * "non-exist" properly. - */ - if (gpio_num) - ret = VbGetGpioStatus(gpio_num); - else - ret = -1; -out: - if (pp) - free(pp); - - return ret; -} - #ifndef HAVE_MACOS static int gpioline_read_value(int chip_fd, int idx, bool active_low) { @@ -549,11 +487,7 @@ int VbGetArchPropertyInt(const char* name) if (value != -1) return value; /* Try the deprecated chromeos_arm platform device next. */ - value = VbGetPlatformGpioStatus("recovery"); - if (value != -1) - return value; - - return VbGetVarGpio("recovery-switch"); + return VbGetPlatformGpioStatus("recovery"); } else if (!strcasecmp(name, "wpsw_cur")) { int value; /* Try GPIO chardev API first. */ @@ -561,10 +495,7 @@ int VbGetArchPropertyInt(const char* name) if (value != -1) return value; /* Try the deprecated chromeos_arm platform device next. */ - value = VbGetPlatformGpioStatus("write-protect"); - if (value != -1) - return value; - return VbGetVarGpio("write-protect-switch"); + return VbGetPlatformGpioStatus("write-protect"); } else if (!strcasecmp(name, "recoverysw_ec_boot")) { /* TODO: read correct value using ectool */ return 0; |