summaryrefslogtreecommitdiff
path: root/chip/npcx/gpio.c
diff options
context:
space:
mode:
authorShelley Chen <shchen@chromium.org>2016-05-19 16:02:45 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-05-23 13:14:17 -0700
commita84aa5ace71e5ed8ab5afc1a7c1450a3922ac5a0 (patch)
treedec8f142d4e541d4bc5c62a856ea9cb9a87fa5a6 /chip/npcx/gpio.c
parentb14f89cfdbf403af08f27472ac2d3ba355c85490 (diff)
downloadchrome-ec-a84aa5ace71e5ed8ab5afc1a7c1450a3922ac5a0.tar.gz
kevin: rk3399: enabling RTC wakeup
Enabled CONFIG_CMD_RTC_ALARM. EC_HOST_EVENT_RTC is enabled when the rtc_alarm goes off, alerting the AP to transition from S3->S0. BUG=chrome-os-partner:52218 BRANCH=None TEST=rtc_alarm <num> and see event set in ec console after <num> seconds. Also, check if new bit set through hostevent command in ec before/after rtc_alarm goes off. Change-Id: I53b1705ce0925000f35b9f80752035d198db3310 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/345474 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'chip/npcx/gpio.c')
-rw-r--r--chip/npcx/gpio.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c
index 99edf5a74f..93cfd278ef 100644
--- a/chip/npcx/gpio.c
+++ b/chip/npcx/gpio.c
@@ -18,6 +18,8 @@
#include "system.h"
#include "system_chip.h"
#include "lpc_chip.h"
+#include "ec_commands.h"
+#include "host_command.h"
/* Flags for PWM IO type */
#define PWM_IO_FUNC (1 << 1) /* PWM optional func bit */
@@ -800,6 +802,17 @@ void __gpio_wk0efgh_interrupt(void)
gpio_interrupt(NPCX_IRQ_WKINTEFGH_0);
}
+void __gpio_rtc_interrupt(void)
+{
+ /* Check pending bit 7 */
+ if (NPCX_WKPND(MIWU_TABLE_0, MIWU_GROUP_4) & 0x80) {
+ /* Clear pending bit for WUI */
+ SET_BIT(NPCX_WKPCL(MIWU_TABLE_0, MIWU_GROUP_4), 7);
+ host_set_events(EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC));
+ } else
+ gpio_interrupt(NPCX_IRQ_MTC_WKINTAD_0);
+}
+
GPIO_IRQ_FUNC(__gpio_wk0ad_interrupt , NPCX_IRQ_MTC_WKINTAD_0);
GPIO_IRQ_FUNC(__gpio_wk0b_interrupt , NPCX_IRQ_TWD_WKINTB_0);
GPIO_IRQ_FUNC(__gpio_wk0c_interrupt , NPCX_IRQ_WKINTC_0);
@@ -811,7 +824,7 @@ GPIO_IRQ_FUNC(__gpio_wk1f_interrupt , NPCX_IRQ_WKINTF_1);
GPIO_IRQ_FUNC(__gpio_wk1g_interrupt , NPCX_IRQ_WKINTG_1);
GPIO_IRQ_FUNC(__gpio_wk1h_interrupt , NPCX_IRQ_WKINTH_1);
-DECLARE_IRQ(NPCX_IRQ_MTC_WKINTAD_0, __gpio_wk0ad_interrupt, 1);
+DECLARE_IRQ(NPCX_IRQ_MTC_WKINTAD_0, __gpio_rtc_interrupt, 1);
DECLARE_IRQ(NPCX_IRQ_TWD_WKINTB_0, __gpio_wk0b_interrupt, 1);
DECLARE_IRQ(NPCX_IRQ_WKINTC_0, __gpio_wk0c_interrupt, 1);
DECLARE_IRQ(NPCX_IRQ_WKINTEFGH_0, __gpio_wk0efgh_interrupt, 1);