diff options
author | Aaron Durbin <adurbin@chromium.org> | 2016-07-06 22:37:10 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2016-07-07 20:44:36 +0200 |
commit | f41ac2298eb61f2a524731a07c915416d562f17c (patch) | |
tree | 08985e62901557a5c4fa1914ec788c58bb2149db /src/lib | |
parent | 85d80276281e179b4e6a896e731090e9580ce8b9 (diff) | |
download | coreboot-f41ac2298eb61f2a524731a07c915416d562f17c.tar.xz |
lib/gpio: add pullup & pulldown gpio_base2_value() variants
Provide common implementations for gpio_base2_value() variants
which configure the gpio for internal pullups and pulldowns.
BUG=chrome-os-partner:54949
BRANCH=None
TEST=Built and used on reef for memory config.
Change-Id: I9be8813328e99d28eb4145501450caab25d51f37
Signed-off-by: Aaron Durbin <adurbin@chromuim.org>
Reviewed-on: https://review.coreboot.org/15557
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/gpio.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/lib/gpio.c b/src/lib/gpio.c index 81d6f6bbad..03cc455a70 100644 --- a/src/lib/gpio.c +++ b/src/lib/gpio.c @@ -19,13 +19,10 @@ #include <delay.h> #include <gpio.h> -int gpio_base2_value(gpio_t gpio[], int num_gpio) +static int _gpio_base2_value(gpio_t gpio[], int num_gpio) { int i, result = 0; - for (i = 0; i < num_gpio; i++) - gpio_input(gpio[i]); - /* Wait until signals become stable */ udelay(10); @@ -35,6 +32,36 @@ int gpio_base2_value(gpio_t gpio[], int num_gpio) return result; } +int gpio_base2_value(gpio_t gpio[], int num_gpio) +{ + int i; + + for (i = 0; i < num_gpio; i++) + gpio_input(gpio[i]); + + return _gpio_base2_value(gpio, num_gpio); +} + +int gpio_pulldown_base2_value(gpio_t gpio[], int num_gpio) +{ + int i; + + for (i = 0; i < num_gpio; i++) + gpio_input_pulldown(gpio[i]); + + return _gpio_base2_value(gpio, num_gpio); +} + +int gpio_pullup_base2_value(gpio_t gpio[], int num_gpio) +{ + int i; + + for (i = 0; i < num_gpio; i++) + gpio_input_pullup(gpio[i]); + + return _gpio_base2_value(gpio, num_gpio); +} + int _gpio_base3_value(gpio_t gpio[], int num_gpio, int binary_first) { /* |