diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2019-10-25 03:38:30 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-01 02:46:00 +0000 |
commit | 3b390264a415ce121a8c6f8db9fa9c42c647aaec (patch) | |
tree | ef137798bf0672d035e644784c27f2f7162d3db2 /chip/mec1322 | |
parent | 946402100fd0589b5480eebd8444a7c3eb9b6aa5 (diff) | |
download | chrome-ec-3b390264a415ce121a8c6f8db9fa9c42c647aaec.tar.gz |
Cleanup: Correct GPIO alternate function parameter
Added code to correct the GPIO alternate function parameter at Chipset
level. Optionally board level functions can cleanup the code in additional
change lists.
BUG=b:139427854
BRANCH=none
TEST=make buildall -j
Change-Id: I1171ca36a703291070fc89f972f84414adcf04fc
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1880974
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'chip/mec1322')
-rw-r--r-- | chip/mec1322/gpio.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/chip/mec1322/gpio.c b/chip/mec1322/gpio.c index fee9bfa79e..331022c87c 100644 --- a/chip/mec1322/gpio.c +++ b/chip/mec1322/gpio.c @@ -29,7 +29,8 @@ static const struct gpio_int_mapping int_map[22] = { {20, 20}, {20, 20} }; -void gpio_set_alternate_function(uint32_t port, uint32_t mask, int func) +void gpio_set_alternate_function(uint32_t port, uint32_t mask, + enum gpio_alternate_func func) { int i; uint32_t val; @@ -38,8 +39,8 @@ void gpio_set_alternate_function(uint32_t port, uint32_t mask, int func) i = __builtin_ffs(mask) - 1; val = MEC1322_GPIO_CTL(port, i); val &= ~(BIT(12) | BIT(13)); - /* mux_control = 0 indicates GPIO */ - if (func > 0) + /* mux_control = DEFAULT, indicates GPIO */ + if (func > GPIO_ALT_FUNC_DEFAULT) val |= (func & 0x3) << 12; MEC1322_GPIO_CTL(port, i) = val; mask &= ~BIT(i); @@ -215,7 +216,8 @@ void gpio_pre_init(void) gpio_set_flags_by_mask(g->port, g->mask, flags); /* Use as GPIO, not alternate function */ - gpio_set_alternate_function(g->port, g->mask, -1); + gpio_set_alternate_function(g->port, g->mask, + GPIO_ALT_FUNC_NONE); } } |