diff options
author | David Hendricks <dhendrix@chromium.org> | 2014-11-06 15:09:27 -0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-10 11:59:25 +0200 |
commit | 3fc6368e1cb6800159acb769557d22a542c9bb93 (patch) | |
tree | d18541f9ba2969dae4e531bb85aecf6391ca0bb3 /src/lib | |
parent | 7a89d8550ddd3546e15a089da94436606bb75cc0 (diff) | |
download | coreboot-staging-3fc6368e1cb6800159acb769557d22a542c9bb93.zip coreboot-staging-3fc6368e1cb6800159acb769557d22a542c9bb93.tar.gz |
gpio: cosmetic changes to tristate_gpios.c
This patch makes a few cosmetic changes:
- Rename tristate_gpios.c to gpio.c since it will soon be used for
binary GPIOs as well.
- Rename gpio_get_tristates() to gpio_base3_value() - The binary
version will be called gpio_base2_value().
- Updates call sites.
- Change the variable name "id" to something more generic.
BUG=none
BRANCH=none
TEST=compiled for veyron_pinky and storm
Change-Id: Iab7e32f4e9d70853f782695cfe6842accff1df64
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: c47d0f33ea1a6e9515211b834009cf47a171953f
Original-Change-Id: I36d88c67cb118efd1730278691dc3e4ecb6055ee
Original-Signed-off-by: David Hendricks <dhendrix@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/228324
Reviewed-on: http://review.coreboot.org/9411
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Makefile.inc | 2 | ||||
-rw-r--r-- | src/lib/gpio.c (renamed from src/lib/tristate_gpios.c) | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index 079c855..0959359 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -92,7 +92,7 @@ ramstage-$(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) += edid.c ramstage-y += memrange.c ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c -ramstage-$(CONFIG_TERTIARY_BOARD_ID) += tristate_gpios.c +ramstage-$(CONFIG_TERTIARY_BOARD_ID) += gpio.c ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c romstage-y += cbmem_common.c dynamic_cbmem.c diff --git a/src/lib/tristate_gpios.c b/src/lib/gpio.c index 0967a8f..3a646e0 100644 --- a/src/lib/tristate_gpios.c +++ b/src/lib/gpio.c @@ -22,7 +22,7 @@ #include <delay.h> #include <gpio.h> -int gpio_get_tristates(gpio_t gpio[], int num_gpio) +int gpio_base3_value(gpio_t gpio[], int num_gpio) { /* * GPIOs which are tied to stronger external pull up or pull down @@ -36,7 +36,7 @@ int gpio_get_tristates(gpio_t gpio[], int num_gpio) static const char tristate_char[] = {[0] = '0', [1] = '1', [Z] = 'Z'}; int temp; int index; - int id = 0; + int result = 0; char value[num_gpio]; /* Enable internal pull up */ @@ -70,13 +70,13 @@ int gpio_get_tristates(gpio_t gpio[], int num_gpio) temp = gpio_get(gpio[index]); temp |= ((value[index] ^ temp) << 1); printk(BIOS_DEBUG, "%c ", tristate_char[temp]); - id = (id * 3) + temp; + result = (result * 3) + temp; } - printk(BIOS_DEBUG, "= %d\n", id); + printk(BIOS_DEBUG, "= %d\n", result); /* Disable pull up / pull down to conserve power */ for (index = 0; index < num_gpio; ++index) gpio_input(gpio[index]); - return id; + return result; } |