summaryrefslogtreecommitdiff
path: root/chip/npcx/gpio_chip.h
diff options
context:
space:
mode:
authorCHLin <CHLin56@nuvoton.com>2020-09-08 18:22:25 +0800
committerCommit Bot <commit-bot@chromium.org>2020-09-25 16:56:44 +0000
commitcd2ce1213b08f8a2365407d39a005918190888b8 (patch)
treee93585bda2fdb8fcc85e0636ef98e9afa4fdd662 /chip/npcx/gpio_chip.h
parent6aaa7d4a1907b97787dd4b28e727394e3e5eadd6 (diff)
downloadchrome-ec-cd2ce1213b08f8a2365407d39a005918190888b8.tar.gz
npcx: add GPIO support for npcx9 and refactor GPIO driver
1. Add GPIO driver support for npcx9. 2. move the GPIO interrupt handler (MIWU) from gpio.h to gpio-npcx5.h, gpio-npcx7.h, and gpio-npcx9.h separately. Note: gpio-npcx7.h is a link to gpio-npcx5.h because almost all of the source codes are the same. BRANCH=none BUG=b:165777478 TEST=pass "make buildall" TEST=with related CLs, build and flash image on the npcx5/7/9 EVB and yorp; verify GPIO functionality. Signed-off-by: CHLin <CHLin56@nuvoton.com> Change-Id: I665507f804ca3772f81f0ff8bd917a633bda2d11 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2402842 Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: CH Lin <chlin56@nuvoton.com>
Diffstat (limited to 'chip/npcx/gpio_chip.h')
-rw-r--r--chip/npcx/gpio_chip.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/chip/npcx/gpio_chip.h b/chip/npcx/gpio_chip.h
index 6282794e44..2d0b2b4e9b 100644
--- a/chip/npcx/gpio_chip.h
+++ b/chip/npcx/gpio_chip.h
@@ -29,7 +29,8 @@ struct npcx_wui {
.bit = NPCX_DEVALT##grp##_##pin, .inverted = 0 })
#define NPCX_ALT_INV(grp, pin) ((struct npcx_alt) {.group = ALT_GROUP_##grp, \
.bit = NPCX_DEVALT##grp##_##pin, .inverted = 1 })
-#define ALT(port, index, alt) { NPCX_GPIO(port, index), alt },
+#define ALT(port, index, _alt) { .gpio = NPCX_GPIO(port, index), \
+ .alt = (_alt) },
#define NPCX_LVOL_CTRL_ITEMS(ctrl) { NPCX_LVOL_CTRL_##ctrl##_0, \
NPCX_LVOL_CTRL_##ctrl##_1, \
@@ -54,6 +55,8 @@ void npcx_gpio2uart(void);
/* Set input buffer of all 1.8v i2c ports. */
void gpio_enable_1p8v_i2c_wake_up_input(int enable);
+void gpio_interrupt(struct npcx_wui wui_int);
+
/*
* Include the MIWU, alternative and low-Voltage macro functions for GPIOs
* depends on Nuvoton chip series.
@@ -62,6 +65,8 @@ void gpio_enable_1p8v_i2c_wake_up_input(int enable);
#include "gpio_chip-npcx5.h"
#elif defined(CHIP_FAMILY_NPCX7)
#include "gpio_chip-npcx7.h"
+#elif defined(CHIP_FAMILY_NPCX9)
+#include "gpio_chip-npcx9.h"
#else
#error "Unsupported chip family"
#endif