summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWealian Liao <whliao@nuvoton.corp-partner.google.com>2021-02-03 13:08:31 +0800
committerCommit Bot <commit-bot@chromium.org>2021-02-05 16:52:30 +0000
commit943d2bf5b51d6c967a9a57fb8f5a97aa28c66473 (patch)
tree10a9cc1f326dda7ffe07c08e5b6a3ce8db905b23
parent9b49eb469e64712804d3141bc730318f56509e71 (diff)
downloadchrome-ec-943d2bf5b51d6c967a9a57fb8f5a97aa28c66473.tar.gz
zephyr: remove interrupt setting when GPIO init
Zephyr doesn't have specific GPIO interrupt enable/disable functions. Set gpio_pin_configure() with interrupt enable/disable flag will set the interrupt function. This will cause GPIO interrupt is triggered when other modules haven't init. For the original chromium EC GPIO setting, EC doesn't enable GPIO interrupts when GPIO init. This CL removes the GPIO interrupt setting when GPIO init. All the GPIO interrupt setting is in gpio_enable_interrupt(). BUG=b:179217432 BRANCH=none TEST=zmake testall TEST=check doesn't have bus fault when EC boot-up Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I273134184d63fa16d7d0e7f3bc717449569394e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2670447 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--zephyr/shim/src/gpio.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/zephyr/shim/src/gpio.c b/zephyr/shim/src/gpio.c
index 99be7ba6a9..141c9ee77d 100644
--- a/zephyr/shim/src/gpio.c
+++ b/zephyr/shim/src/gpio.c
@@ -239,8 +239,7 @@ static int init_gpios(const struct device *unused)
}
/*
- * Loop through all interrupt pins and set their callback and interrupt-
- * related gpio flags.
+ * Loop through all interrupt pins and set their callback.
*/
for (size_t i = 0; i < ARRAY_SIZE(gpio_interrupts); ++i) {
const enum gpio_signal signal = gpio_interrupts[i].signal;
@@ -256,19 +255,6 @@ static int init_gpios(const struct device *unused)
configs[signal].name, rv);
continue;
}
-
- /*
- * Reconfigure the GPIO pin with the original device tree
- * flags (e.g. INPUT, PULL-UP) combined with the interrupts
- * flags (e.g. INT_EDGE_BOTH).
- */
- rv = gpio_pin_configure(data[signal].dev, configs[signal].pin,
- (configs[signal].init_flags |
- gpio_interrupts[i].flags));
- if (rv < 0) {
- LOG_ERR("Int config failed %s (%d)",
- configs[signal].name, rv);
- }
}
return 0;
@@ -285,6 +271,10 @@ int gpio_enable_interrupt(enum gpio_signal signal)
if (!interrupt)
return -1;
+ /*
+ * Config interrupt flags (e.g. INT_EDGE_BOTH) & enable interrupt
+ * together.
+ */
rv = gpio_pin_interrupt_configure(data[signal].dev, configs[signal].pin,
(interrupt->flags | GPIO_INT_ENABLE) &
~GPIO_INT_DISABLE);
@@ -306,7 +296,7 @@ int gpio_disable_interrupt(enum gpio_signal signal)
rv = gpio_pin_interrupt_configure(data[signal].dev, configs[signal].pin,
GPIO_INT_DISABLE);
if (rv < 0) {
- LOG_ERR("Failed to enable interrupt on %s (%d)",
+ LOG_ERR("Failed to disable interrupt on %s (%d)",
configs[signal].name, rv);
}