summaryrefslogtreecommitdiff
path: root/chip/lm4
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2019-10-25 03:38:30 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-01 02:46:00 +0000
commit3b390264a415ce121a8c6f8db9fa9c42c647aaec (patch)
treeef137798bf0672d035e644784c27f2f7162d3db2 /chip/lm4
parent946402100fd0589b5480eebd8444a7c3eb9b6aa5 (diff)
downloadchrome-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/lm4')
-rw-r--r--chip/lm4/gpio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/chip/lm4/gpio.c b/chip/lm4/gpio.c
index b3dff342e8..65d6548f90 100644
--- a/chip/lm4/gpio.c
+++ b/chip/lm4/gpio.c
@@ -42,7 +42,8 @@ static int find_gpio_port_index(uint32_t port_base)
return -1;
}
-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 port_index = find_gpio_port_index(port);
int cgmask;
@@ -56,7 +57,7 @@ void gpio_set_alternate_function(uint32_t port, uint32_t mask, int func)
clock_enable_peripheral(CGC_OFFSET_GPIO, cgmask,
CGC_MODE_RUN | CGC_MODE_SLEEP);
- if (func >= 0) {
+ if (func != GPIO_ALT_FUNC_NONE) {
int pctlmask = 0;
int i;
/* Expand mask from bits to nibbles */
@@ -261,7 +262,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);
}
#ifdef CONFIG_LOW_POWER_IDLE