From 3c1943f14d73a321f4cb862e7c5850d9a2624c1c Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Thu, 7 Sep 2017 12:40:03 -0700 Subject: cr50: add board property deep sleep and detect ap flags Add the flags for board_deep_sleep_allowed and board_detect_ap_with_tpm_rst. BUG=b:35647982 BRANCH=cr50 TEST=run firmware_DeepCr50SleepStress on electro. Make sure Bob can still detect the AP state and doesn't enter deep sleep Change-Id: I39e45f6eacc1cbdcb3ab1caaecd0836f8a2c073a Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/699294 Reviewed-by: Randall Spangler --- board/cr50/board.c | 15 +++++++++++---- board/cr50/scratch_reg1.h | 4 ++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/board/cr50/board.c b/board/cr50/board.c index 932fddaf9b..96db395959 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -138,14 +138,19 @@ int board_use_plt_rst(void) return !!(board_properties & BOARD_USE_PLT_RESET); } +/* Allow enabling deep sleep if the board supports it. */ int board_deep_sleep_allowed(void) { - return board_use_plt_rst(); + return !(board_properties & BOARD_DEEP_SLEEP_DISABLED); } +/* + * If the board doesn't use CR50_RX_AP_TX to determine AP state, it uses + * TPM_RST_L. + */ int board_detect_ap_with_tpm_rst(void) { - return board_use_plt_rst(); + return !(board_properties & BOARD_DETECT_AP_WITH_UART); } int board_rst_pullup_needed(void) @@ -231,7 +236,8 @@ const struct strap_desc strap_regs[] = { static struct board_cfg board_cfg_table[] = { /* SPI Variants: DIOA12 = 1M PD, DIOA6 = 1M PD */ /* Kevin/Gru: DI0A9 = 5k PD, DIOA1 = 1M PU */ - { 0x02, BOARD_SLAVE_CONFIG_SPI | BOARD_NEEDS_SYS_RST_PULL_UP }, + { 0x02, BOARD_SLAVE_CONFIG_SPI | BOARD_NEEDS_SYS_RST_PULL_UP | + BOARD_DEEP_SLEEP_DISABLED | BOARD_DETECT_AP_WITH_UART }, /* Poppy: DI0A9 = 1M PU, DIOA1 = 1M PU */ { 0x0A, BOARD_SLAVE_CONFIG_SPI | BOARD_USE_PLT_RESET }, @@ -239,7 +245,8 @@ static struct board_cfg board_cfg_table[] = { /* Reef/Eve: DIOA12 = 5k PD, DIOA6 = 1M PU */ { 0x20, BOARD_SLAVE_CONFIG_I2C | BOARD_USE_PLT_RESET }, /* Rowan: DIOA12 = 5k PD, DIOA6 = 5k PU */ - { 0x30, BOARD_SLAVE_CONFIG_I2C }, + { 0x30, BOARD_SLAVE_CONFIG_I2C | BOARD_DEEP_SLEEP_DISABLED | + BOARD_DETECT_AP_WITH_UART }, }; void post_reboot_request(void) diff --git a/board/cr50/scratch_reg1.h b/board/cr50/scratch_reg1.h index 86dc8d7e4b..9ea550f1ca 100644 --- a/board/cr50/scratch_reg1.h +++ b/board/cr50/scratch_reg1.h @@ -45,6 +45,10 @@ #define BOARD_CCD_SHIFT 11 #define BOARD_CCD_STATE (3 << BOARD_CCD_SHIFT) +/* Prevent Cr50 from entering deep sleep when the AP is off */ +#define BOARD_DEEP_SLEEP_DISABLED (1 << 13) +/* Use Cr50_RX_AP_TX to determine if the AP is off or on */ +#define BOARD_DETECT_AP_WITH_UART (1 << 14) /* * Macro to capture all properties related to board strapping pins. This must be * updated if additional strap related properties are added. -- cgit v1.2.1