From 5c611cedbfcff0c2fed25462b0477efcff014c36 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Fri, 23 Mar 2018 22:36:35 -0700 Subject: [PATCH] Add config for boards that cannot distinguish reset type We have a growing list of boards in chip/npcx/system.c that are unable to distinguish a reset from a power-on or a reset-pin type. Instead of being a temporary issue this is now solidified in the design on some kabylake boards. Instead of defining board-specific checks in the chip code this change adds a config option that the relevant boards can define. BUG=b:76232539 BRANCH=none TEST=make -j buildall passes Change-Id: I76e0f011d70ce6f778b1fb6a56c2779c39c3cbd6 Signed-off-by: Duncan Laurie Reviewed-on: https://chromium-review.googlesource.com/979575 Reviewed-by: Furquan Shaikh --- board/eve/board.h | 1 + board/nami/board.h | 1 + board/nautilus/board.h | 1 + board/poppy/board.h | 1 + board/wheatley/board.h | 1 + chip/npcx/system.c | 6 ++---- include/config.h | 6 ++++++ 7 files changed, 13 insertions(+), 4 deletions(-) diff --git a/board/eve/board.h b/board/eve/board.h index 2f843e96c2..b159e8a3e1 100644 --- a/board/eve/board.h +++ b/board/eve/board.h @@ -27,6 +27,7 @@ #define CONFIG_BACKLIGHT_LID #define CONFIG_BOARD_VERSION #define CONFIG_BOARD_SPECIFIC_VERSION +#define CONFIG_BOARD_FORCE_RESET_PIN #define CONFIG_DEVICE_EVENT #define CONFIG_DPTF #define CONFIG_DPTF_DEVICE_ORIENTATION diff --git a/board/nami/board.h b/board/nami/board.h index 6fa886f119..620fb9f936 100644 --- a/board/nami/board.h +++ b/board/nami/board.h @@ -20,6 +20,7 @@ #define CONFIG_BACKLIGHT_LID_ACTIVE_LOW #define CONFIG_BOARD_VERSION #define CONFIG_BOARD_SPECIFIC_VERSION +#define CONFIG_BOARD_FORCE_RESET_PIN #define CONFIG_CRC8 #define CONFIG_CROS_BOARD_INFO #define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL diff --git a/board/nautilus/board.h b/board/nautilus/board.h index b6362799a2..3179da37aa 100644 --- a/board/nautilus/board.h +++ b/board/nautilus/board.h @@ -18,6 +18,7 @@ #define CONFIG_ADC #define CONFIG_BACKLIGHT_LID #define CONFIG_BOARD_VERSION +#define CONFIG_BOARD_FORCE_RESET_PIN #define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL #define CONFIG_DPTF #define CONFIG_DPTF_DEVICE_ORIENTATION diff --git a/board/poppy/board.h b/board/poppy/board.h index 950728a7ac..d865890b11 100644 --- a/board/poppy/board.h +++ b/board/poppy/board.h @@ -19,6 +19,7 @@ #define CONFIG_BACKLIGHT_LID #define CONFIG_BOARD_VERSION #define CONFIG_BOARD_SPECIFIC_VERSION +#define CONFIG_BOARD_FORCE_RESET_PIN #define CONFIG_BUTTON_TRIGGERED_RECOVERY #define CONFIG_DPTF #define CONFIG_DPTF_DEVICE_ORIENTATION diff --git a/board/wheatley/board.h b/board/wheatley/board.h index dcd773f827..dd741c0fbc 100644 --- a/board/wheatley/board.h +++ b/board/wheatley/board.h @@ -18,6 +18,7 @@ #define CONFIG_BATTERY_SMART #define CONFIG_BOARD_VERSION #define CONFIG_CHARGE_MANAGER +#define CONFIG_BOARD_FORCE_RESET_PIN #define CONFIG_CHARGER #define CONFIG_CHARGER_V2 diff --git a/chip/npcx/system.c b/chip/npcx/system.c index 649ec25a89..b38b09aaf1 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -367,10 +367,8 @@ void system_check_reset_cause(void) /* Use scratch bit to check power on reset or VCC1_RST reset */ if (!IS_BIT_SET(NPCX_RSTCTL, NPCX_RSTCTL_VCC1_RST_SCRATCH)) { -#if defined(BOARD_WHEATLEY) || defined(BOARD_EVE) || defined(BOARD_POPPY) || defined(BOARD_SORAKA)\ - || defined(BOARD_NAUTILUS) || defined(BOARD_NAMI) - - /* TODO(crosbug.com/p/61028): Remove workaround for Eve */ +#ifdef CONFIG_BOARD_FORCE_RESET_PIN + /* Treat all resets as RESET_PIN */ flags |= RESET_FLAG_RESET_PIN; #else /* Check for VCC1 reset */ diff --git a/include/config.h b/include/config.h index c163ee5bb5..f96103a4af 100644 --- a/include/config.h +++ b/include/config.h @@ -420,6 +420,12 @@ /* EC responses to a board defined I2C slave address */ #undef CONFIG_BOARD_I2C_SLAVE_ADDR +/* + * The board is unable to distinguish EC reset from power-on so it should treat + * all resets as triggered by RESET_PIN even if it is a POWER_ON reset. + */ +#undef CONFIG_BOARD_FORCE_RESET_PIN + /* Permanent LM4 boot configuration */ #undef CONFIG_BOOTCFG_VALUE