diff options
author | Dino Li <Dino.Li@ite.com.tw> | 2018-08-08 11:51:35 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-16 00:30:05 -0700 |
commit | 5f57eca28f604829c29ebf318d9675d6c6654724 (patch) | |
tree | 3eb06c28b265ec8c0b940e1ee01e313b53440851 /chip/it83xx/gpio.c | |
parent | 43899e1d9e3f523701d8d8b5c93890322894e6e4 (diff) | |
download | chrome-ec-5f57eca28f604829c29ebf318d9675d6c6654724.tar.gz |
it83xx: gpio: Set KSO/KSI pins to GPIO mode by gpio_set_flags_by_mask
With this change, we can reconfigure KSO/KSI pins as GPIO mode
by calling gpio_set_flags_by_mask().
BUG=b:111006203
BRANCH=none
TEST=Declare KSO/KSI signal with GPIO_INPUT flag and check if
these pins work as GPIO input.
Change-Id: I3b1fcc989745da08898d2f254dedc9655fd0ef83
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/1163584
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'chip/it83xx/gpio.c')
-rw-r--r-- | chip/it83xx/gpio.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/chip/it83xx/gpio.c b/chip/it83xx/gpio.c index 3709838f75..f89f791f11 100644 --- a/chip/it83xx/gpio.c +++ b/chip/it83xx/gpio.c @@ -451,6 +451,12 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags) uint32_t pin = 0; uint32_t mask_copy = mask; + if (port > GPIO_KBS_OFF) { + /* set up GPIO of KSO/KSI pins (support input only). */ + gpio_kbs_pin_gpio_mode(port, mask, flags); + return; + } + /* * Select open drain first, so that we don't glitch the signal * when changing the line to an output. @@ -631,12 +637,8 @@ void gpio_pre_init(void) if (is_warm) flags &= ~(GPIO_LOW | GPIO_HIGH); - if (g->port > GPIO_KBS_OFF) - /* KSO/KSI pins to GPIO mode (input only). */ - gpio_kbs_pin_gpio_mode(g->port, g->mask, flags); - else - /* Set up GPIO based on flags */ - gpio_set_flags_by_mask(g->port, g->mask, flags); + /* Set up GPIO based on flags */ + gpio_set_flags_by_mask(g->port, g->mask, flags); } } |