summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
Diffstat (limited to 'chip')
-rw-r--r--chip/it83xx/clock.c4
-rw-r--r--chip/it83xx/hwtimer_chip.h16
2 files changed, 16 insertions, 4 deletions
diff --git a/chip/it83xx/clock.c b/chip/it83xx/clock.c
index 3927091eff..49f99a167b 100644
--- a/chip/it83xx/clock.c
+++ b/chip/it83xx/clock.c
@@ -571,9 +571,9 @@ defined(CONFIG_HOSTCMD_ESPI)
if (IT83XX_ECPM_PLLCTRL == EC_PLL_DEEP_DOZE) {
clock_ec_pll_ctrl(EC_PLL_DOZE);
-
/* update free running timer */
- c = 0xffffffff - IT83XX_ETWD_ETXCNTOR(LOW_POWER_EXT_TIMER);
+ c = LOW_POWER_TIMER_MASK -
+ IT83XX_ETWD_ETXCNTOR(LOW_POWER_EXT_TIMER);
st_us = TIMER_32P768K_CNT_TO_US(c);
sleep_mode_t1.val = sleep_mode_t0.val + st_us;
__hw_clock_source_set(sleep_mode_t1.le.lo);
diff --git a/chip/it83xx/hwtimer_chip.h b/chip/it83xx/hwtimer_chip.h
index ef53c4e871..2ccdce1d96 100644
--- a/chip/it83xx/hwtimer_chip.h
+++ b/chip/it83xx/hwtimer_chip.h
@@ -19,8 +19,20 @@
#define FREE_EXT_TIMER_H EXT_TIMER_4
#define FAN_CTRL_EXT_TIMER EXT_TIMER_5
#define EVENT_EXT_TIMER EXT_TIMER_6
-#define WDT_EXT_TIMER EXT_TIMER_7
-#define LOW_POWER_EXT_TIMER EXT_TIMER_8
+/*
+ * The low power timer is used to continue system time when EC goes into low
+ * power in idle task. Timer 7 is 24bit timer and configured at 32.768khz.
+ * The configuration is enough for continuing system time, because periodic
+ * tick event (interval is 500ms on it8xxx2) will wake EC up.
+ *
+ * IMPORTANT:
+ * If you change low power timer to a non-24bit timer, you also have to change
+ * mask of observation register in clock_sleep_mode_wakeup_isr() or EC will get
+ * wrong system time after resume.
+ */
+#define LOW_POWER_EXT_TIMER EXT_TIMER_7
+#define LOW_POWER_TIMER_MASK (BIT(24) - 1)
+#define WDT_EXT_TIMER EXT_TIMER_8
enum ext_timer_clock_source {
EXT_PSR_32P768K_HZ = 0,