summaryrefslogtreecommitdiff
path: root/chip/lm4/gpio.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-04-11 13:02:27 -0700
committerChromeBot <chrome-bot@google.com>2013-04-11 15:38:09 -0700
commit79c6132a6e6d9b5d00a33d7f73795cd88bd97017 (patch)
tree30943690ad8c61650359017b153cce026dc4a926 /chip/lm4/gpio.c
parentb9d0d9c60b2b826f37192f6ffb96b23f1c18d6de (diff)
downloadchrome-ec-79c6132a6e6d9b5d00a33d7f73795cd88bd97017.tar.gz
Allow GPIO alternate function 0
gpio_set_alternate_function() used 0 to mean "normal GPIO function". But on chips like STM32L, alternate function 0 is actually a function on some pins. So change "normal GPIO function" to -1. Also add support for this on STM32L. BUG=chrome-os-partner:18343 BRANCH=none TEST=build and boot link and daisy Change-Id: I9cdd9ad91a315b616e373a0dc9a50545cf9d20fa Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47903 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'chip/lm4/gpio.c')
-rw-r--r--chip/lm4/gpio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/chip/lm4/gpio.c b/chip/lm4/gpio.c
index bce2138ca2..50fa9dbce0 100644
--- a/chip/lm4/gpio.c
+++ b/chip/lm4/gpio.c
@@ -58,7 +58,7 @@ void gpio_set_alternate_function(int port, int mask, int func)
clock_wait_cycles(3);
}
- if (func) {
+ if (func >= 0) {
int pctlmask = 0;
int i;
/* Expand mask from bits to nibbles */
@@ -196,7 +196,7 @@ void gpio_pre_init(void)
/* Set all GPIOs to defaults */
for (i = 0; i < GPIO_COUNT; i++, g++) {
/* Use as GPIO, not alternate function */
- gpio_set_alternate_function(g->port, g->mask, 0);
+ gpio_set_alternate_function(g->port, g->mask, -1);
/* Set up GPIO based on flags */
gpio_set_flags(i, g->flags);