From 0cab97574be2a2d1be35af3985425f898df6a731 Mon Sep 17 00:00:00 2001 From: philipchen Date: Sat, 25 Jun 2016 15:32:11 -0700 Subject: Cleanup: gate RTC console/host command behind new config options Put RTC code supporting console/host command behind new flags 'CONFIG_CMD_RTC'/'CONFIG_HOSTCMD_RTC' BUG=chromium:613699 TEST=make buildall BRANCH=master Change-Id: Ida52265d124978f48bd6ca522be3badee9f99588 Reviewed-on: https://chromium-review.googlesource.com/356206 Commit-Ready: Philip Chen Tested-by: Philip Chen Reviewed-by: Aseda Aboagye Reviewed-by: Shawn N --- board/kevin/board.h | 2 ++ chip/lm4/system.c | 4 ++++ chip/npcx/gpio.c | 2 ++ chip/npcx/system.c | 5 ++++- include/config.h | 4 ++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/board/kevin/board.h b/board/kevin/board.h index 1a5f7a75af..dea839bb54 100644 --- a/board/kevin/board.h +++ b/board/kevin/board.h @@ -11,6 +11,8 @@ /* Optional modules */ #define CONFIG_ADC #define CONFIG_CHIPSET_RK3399 +#define CONFIG_CMD_RTC +#define CONFIG_HOSTCMD_RTC #define CONFIG_HOSTCMD_SPS #define CONFIG_I2C #define CONFIG_I2C_MASTER diff --git a/chip/lm4/system.c b/chip/lm4/system.c index 38cde27e1c..5fec905517 100644 --- a/chip/lm4/system.c +++ b/chip/lm4/system.c @@ -625,6 +625,7 @@ const char *system_get_chip_revision(void) /*****************************************************************************/ /* Console commands */ +#ifdef CONFIG_CMD_RTC static int command_system_rtc(int argc, char **argv) { uint32_t rtc; @@ -686,10 +687,12 @@ DECLARE_CONSOLE_COMMAND(rtc_alarm, command_rtc_alarm_test, "Test alarm", NULL); #endif /* CONFIG_CMD_RTC_ALARM */ +#endif /* CONFIG_CMD_RTC */ /*****************************************************************************/ /* Host commands */ +#ifdef CONFIG_HOSTCMD_RTC static int system_rtc_get_value(struct host_cmd_handler_args *args) { struct ec_response_rtc *r = args->response; @@ -713,3 +716,4 @@ static int system_rtc_set_value(struct host_cmd_handler_args *args) DECLARE_HOST_COMMAND(EC_CMD_RTC_SET_VALUE, system_rtc_set_value, EC_VER_MASK(0)); +#endif /* CONFIG_HOSTCMD_RTC */ diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c index fb95f101f1..edd9597aad 100644 --- a/chip/npcx/gpio.c +++ b/chip/npcx/gpio.c @@ -805,11 +805,13 @@ void __gpio_wk0efgh_interrupt(void) void __gpio_rtc_interrupt(void) { /* Check pending bit 7 */ +#ifdef CONFIG_HOSTCMD_RTC 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 +#endif gpio_interrupt(NPCX_IRQ_MTC_WKINTAD_0); } diff --git a/chip/npcx/system.c b/chip/npcx/system.c index f014acb455..bda6fe6e3a 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -708,7 +708,7 @@ int system_is_reboot_warm(void) /*****************************************************************************/ /* Console commands */ - +#ifdef CONFIG_CMD_RTC static int command_system_rtc(int argc, char **argv) { uint32_t sec; @@ -767,10 +767,12 @@ DECLARE_CONSOLE_COMMAND(rtc_alarm, command_rtc_alarm_test, "Test alarm", NULL); #endif /* CONFIG_CMD_RTC_ALARM */ +#endif /* CONFIG_CMD_RTC */ /*****************************************************************************/ /* Host commands */ +#ifdef CONFIG_HOSTCMD_RTC static int system_rtc_get_value(struct host_cmd_handler_args *args) { struct ec_response_rtc *r = args->response; @@ -819,6 +821,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_GET_ALARM, system_rtc_get_alarm, EC_VER_MASK(0)); +#endif /* CONFIG_HOSTCMD_RTC */ #ifdef CONFIG_EXTERNAL_STORAGE void system_jump_to_booter(void) { diff --git a/include/config.h b/include/config.h index 701536a864..2db396f0a2 100644 --- a/include/config.h +++ b/include/config.h @@ -550,6 +550,7 @@ #undef CONFIG_CMD_ILIM #define CONFIG_CMD_INA #define CONFIG_CMD_REGULATOR +#undef CONFIG_CMD_RTC #undef CONFIG_CMD_JUMPTAGS #undef CONFIG_CMD_LID_ANGLE #undef CONFIG_CMD_MCDP @@ -1093,6 +1094,9 @@ /* Panic when status of PD MCU reflects that it has crashed */ #undef CONFIG_HOSTCMD_PD_PANIC +/* Board supports RTC host commands*/ +#undef CONFIG_HOSTCMD_RTC + /*****************************************************************************/ /* Enable debugging and profiling statistics for hook functions */ -- cgit v1.2.1