summaryrefslogtreecommitdiff
path: root/include/system.h
diff options
context:
space:
mode:
authorAlexandru M Stan <amstan@chromium.org>2014-09-23 14:26:00 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-01 22:42:25 +0000
commit786a45347d0573b6bc216251b384d733f86a9ad0 (patch)
tree596ba231051add2c0a47b9fc97795e0d8c659ca1 /include/system.h
parent813ac323805550ba5e42ee246045fba276ecd884 (diff)
downloadchrome-ec-786a45347d0573b6bc216251b384d733f86a9ad0.tar.gz
stm32f0: deep sleep in S0
Enabled deep sleeping during S0. This was previously inhibited by SLEEP_MASK_AP_RUN but the new config option (CONFIG_LOW_POWER_S0) will ignore it. SPI needed a sleep mask, it essentially gets enabled and disabled whenever the CS changes. Warning: waking up when the CS falls takes a little time, if the AP sends fast data before the 48MHz clock is enabled characters will get corrupted; leave about 30uS time for the clock to start. CQ-DEPEND=CL:219997 CQ-DEPEND=CL:220243 CQ-DEPEND=CL:220461 BUG=chrome-os-partner:32223 BRANCH=none TEST=load onto pinky, boot the AP(S0), use idlestats command to verify that we are going into deep sleep (STOP mode). Verify that everything works normally during S0(SPI, keyboard, anything that requires the EC to wakeup). Change-Id: I81c4fa472332f1ad8ad93301089a99dcdb108948 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219555 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/system.h')
-rw-r--r--include/system.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/system.h b/include/system.h
index 6d38cae769..4463c4baf9 100644
--- a/include/system.h
+++ b/include/system.h
@@ -292,6 +292,7 @@ enum {
SLEEP_MASK_CHARGING = (1 << 3), /* Charging loop on-going */
SLEEP_MASK_USB_PWR = (1 << 4), /* USB power loop on-going */
SLEEP_MASK_USB_PD = (1 << 5), /* USB PD device connected */
+ SLEEP_MASK_SPI = (1 << 6), /* SPI communications on-going */
SLEEP_MASK_FORCE_NO_DSLEEP = (1 << 15), /* Force disable. */
@@ -315,7 +316,13 @@ extern uint32_t sleep_mask;
* Macros to use to get whether deep sleep is allowed or whether
* low speed deep sleep is allowed.
*/
+
+#ifndef CONFIG_LOW_POWER_S0
#define DEEP_SLEEP_ALLOWED (!(sleep_mask & 0x0000ffff))
+#else
+#define DEEP_SLEEP_ALLOWED (!(sleep_mask & 0x0000ffff & \
+ (~SLEEP_MASK_AP_RUN)))
+#endif
#define LOW_SPEED_DEEP_SLEEP_ALLOWED (!(sleep_mask & 0xffff0000))
/**