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/max32660 | |
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/max32660')
-rw-r--r-- | chip/max32660/gpio_chip.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/chip/max32660/gpio_chip.c b/chip/max32660/gpio_chip.c index af2e96fd29..1ed7d386ae 100644 --- a/chip/max32660/gpio_chip.c +++ b/chip/max32660/gpio_chip.c @@ -23,20 +23,21 @@ /* 0-terminated list of GPIO base addresses */ static mxc_gpio_regs_t *gpio_bases[] = {MXC_GPIO0, 0}; -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) { mxc_gpio_regs_t *gpio = MXC_GPIO_GET_GPIO(port); switch (func) { - case 1: + case GPIO_ALT_FUNC_1: gpio->en_clr = mask; gpio->en1_clr = mask; break; - case 2: + case GPIO_ALT_FUNC_2: gpio->en_clr = mask; gpio->en1_set = mask; break; - case 3: + case GPIO_ALT_FUNC_3: gpio->en_set = mask; gpio->en1_set = mask; break; @@ -167,7 +168,8 @@ void gpio_pre_init(void) continue; /* 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); /* Set up GPIO based on flags */ gpio_set_flags_by_mask(g->port, g->mask, flags); |