diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2019-02-26 16:25:28 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-01 01:08:44 -0800 |
commit | 528ff711f6f22c7899d2c29dae3e1ff2d331bef2 (patch) | |
tree | 481f987693cd547b1543f4cc6959587a3e5bf232 | |
parent | 0f85d578dfff59cf4b8800ba5b346d6ae8676db4 (diff) | |
download | chrome-ec-528ff711f6f22c7899d2c29dae3e1ff2d331bef2.tar.gz |
ec: cleanup: Add CONFIG_RTC
This allows the chipset task to print RTC information, without requiring
CONFIG_CMD_RTC to be enabled.
BUG=chromium:649851
BRANCH=none
TEST=Built and flashed on grunt (careena), confirmed RTC state printed
when the power state was changed, but without RTC command present
Change-Id: I6b11c4d2822117c57febdacf299a865710ed1edd
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1490672
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | chip/lm4/config_chip.h | 1 | ||||
-rw-r--r-- | chip/lm4/system.c | 2 | ||||
-rw-r--r-- | chip/npcx/config_chip.h | 1 | ||||
-rw-r--r-- | chip/npcx/system.c | 2 | ||||
-rw-r--r-- | chip/stm32/clock-f.c | 2 | ||||
-rw-r--r-- | chip/stm32/config_chip.h | 3 | ||||
-rw-r--r-- | include/config.h | 3 | ||||
-rw-r--r-- | include/system.h | 7 |
8 files changed, 15 insertions, 6 deletions
diff --git a/chip/lm4/config_chip.h b/chip/lm4/config_chip.h index 4db95cc42d..020a5d7c09 100644 --- a/chip/lm4/config_chip.h +++ b/chip/lm4/config_chip.h @@ -95,6 +95,7 @@ #define CONFIG_HOSTCMD_ALIGNED #define CONFIG_HOSTCMD_LPC #define CONFIG_PECI +#define CONFIG_RTC #define CONFIG_SWITCH #define CONFIG_MPU diff --git a/chip/lm4/system.c b/chip/lm4/system.c index 625a4076e2..45f6b91809 100644 --- a/chip/lm4/system.c +++ b/chip/lm4/system.c @@ -660,7 +660,6 @@ const char *system_get_chip_revision(void) /*****************************************************************************/ /* Console commands */ -#ifdef CONFIG_CMD_RTC void print_system_rtc(enum console_channel ch) { uint32_t rtc; @@ -671,6 +670,7 @@ void print_system_rtc(enum console_channel ch) rtc, rtcss, rtc, HIB_RTC_SUBSEC_TO_USEC(rtcss)); } +#ifdef CONFIG_CMD_RTC static int command_system_rtc(int argc, char **argv) { if (argc == 3 && !strcasecmp(argv[1], "set")) { diff --git a/chip/npcx/config_chip.h b/chip/npcx/config_chip.h index 494f76c352..97f52963fd 100644 --- a/chip/npcx/config_chip.h +++ b/chip/npcx/config_chip.h @@ -57,6 +57,7 @@ /* Optional features present on this chip */ #define CONFIG_ADC +#define CONFIG_RTC #define CONFIG_SWITCH #define CONFIG_MPU diff --git a/chip/npcx/system.c b/chip/npcx/system.c index edb9e2335e..726aa30350 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -914,7 +914,6 @@ int system_is_reboot_warm(void) /*****************************************************************************/ /* Console commands */ -#ifdef CONFIG_CMD_RTC void print_system_rtc(enum console_channel ch) { uint32_t sec = system_get_rtc_sec(); @@ -922,6 +921,7 @@ void print_system_rtc(enum console_channel ch) cprintf(ch, "RTC: 0x%08x (%d.00 s)\n", sec, sec); } +#ifdef CONFIG_CMD_RTC static int command_system_rtc(int argc, char **argv) { if (argc == 3 && !strcasecmp(argv[1], "set")) { diff --git a/chip/stm32/clock-f.c b/chip/stm32/clock-f.c index 3333538326..99a23ee138 100644 --- a/chip/stm32/clock-f.c +++ b/chip/stm32/clock-f.c @@ -364,7 +364,6 @@ DECLARE_HOOK(HOOK_SYSJUMP, reset_flash_cache, HOOK_PRIO_DEFAULT); /*****************************************************************************/ /* Console commands */ -#ifdef CONFIG_CMD_RTC void print_system_rtc(enum console_channel ch) { uint32_t sec; @@ -376,6 +375,7 @@ void print_system_rtc(enum console_channel ch) cprintf(ch, "RTC: 0x%08x (%d.00 s)\n", sec, sec); } +#ifdef CONFIG_CMD_RTC static int command_system_rtc(int argc, char **argv) { char *e; diff --git a/chip/stm32/config_chip.h b/chip/stm32/config_chip.h index 5fc0f47681..0305197996 100644 --- a/chip/stm32/config_chip.h +++ b/chip/stm32/config_chip.h @@ -118,6 +118,9 @@ /* Use DMA */ #define CONFIG_DMA +/* STM32 features RTC (optional feature) */ +#define CONFIG_RTC + /* Number of peripheral request signals per DMA channel */ #define STM32_DMA_PERIPHERALS_PER_CHANNEL 4 diff --git a/include/config.h b/include/config.h index ca698e5b6e..cd445e668e 100644 --- a/include/config.h +++ b/include/config.h @@ -2670,6 +2670,9 @@ */ #undef CONFIG_PWM_KBLIGHT +/* Support Real-Time Clock (RTC) */ +#undef CONFIG_RTC + /* Base address of RAM for the chip */ #undef CONFIG_RAM_BASE diff --git a/include/system.h b/include/system.h index ca7b24c624..f62ba4549a 100644 --- a/include/system.h +++ b/include/system.h @@ -392,24 +392,25 @@ void board_hibernate_late(void) __attribute__((weak)); /* Minimum duration to get proper hibernation */ #define SYSTEM_HIB_MINIMUM_DURATION 0, 150000 +#ifdef CONFIG_RTC /** * Read the real-time clock. * * @return The real-time clock value as a timestamp. */ timestamp_t system_get_rtc(void); +#endif /* defined(CONFIG_RTC) */ /** * Print out the current real-time clock value to the console. * * @param channel Console channel to print on. */ -/* TODO(aaboagye): Replace this with CONFIG_RTC eventually. */ -#ifdef CONFIG_CMD_RTC +#ifdef CONFIG_RTC void print_system_rtc(enum console_channel channel); #else static inline void print_system_rtc(enum console_channel channel) { } -#endif /* !defined(CONFIG_CMD_RTC) */ +#endif /* !defined(CONFIG_RTC) */ /** * Enable hibernate interrupt |