summaryrefslogtreecommitdiff
path: root/zephyr/Kconfig
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-22 16:10:20 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-02 09:27:32 +0000
commit086efb5aaab014a31ef2bd1ee54662e4698b522d (patch)
tree9271fe7fc75def695add371cf546c7c5f4e6bc4e /zephyr/Kconfig
parent53a4c4aaeb1cc1ced18cd2d308a7005c25cbf547 (diff)
downloadchrome-ec-086efb5aaab014a31ef2bd1ee54662e4698b522d.tar.gz
zephyr: Enable base support for real-time-clock (RTC)
Add Kconfig options for the various RTC features. Add stubs for the actual implementation, to be implemented using Zephyr API calls to the RTC driver, when available. The duplication of RTC functions across different chips can be addressed in b/179055201 Also add the <init.h> header to zephyr_host_command.h since otherwise we get a build error. It seems better to have the header there than in the files that use DECLARE_CONSOLE_COMMAND(). BUG=b:178230662, b:179055201 BRANCH=none TEST=build volteer for zephyr, try rtc and rtc_alarm command make BOARD=volteer -j8 Change-Id: I036b1f3d91543a357ad779e475a03584759a3de4 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645570 Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr/Kconfig')
-rw-r--r--zephyr/Kconfig54
1 files changed, 54 insertions, 0 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index 6b5f9e8ec5..002dbcaa9c 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -413,6 +413,60 @@ config PLATFORM_EC_PWM
support variable brightness LEDs, backlight controls, and
variable-speed fans.
+config PLATFORM_EC_RTC
+ bool "Real-time clock (RTC)"
+ default y
+ help
+ Enable support for a real-time clock. Typically this is available
+ on-chip in the EC. It provides a way to track the passage of time
+ in terms of second and minutes. Once set, and provided that it has a
+ suitable power source, it should be able to keep reasonably accurate
+ time over a period of days and weeks.
+
+ The starting EC clock is typically set by the AP, since it has access
+ to the outside world and can often obtain the current time when
+ desired.
+
+if PLATFORM_EC_RTC
+
+config PLATFORM_EC_CONSOLE_CMD_RTC
+ bool "Console command: rtc"
+ default y
+ help
+ This command allows getting and setting the current RTC value. The
+ value is in seconds since the Epoch (midnight on 1/1/70). You can
+ convert this to a human date on the command line with 'date -u -d @n'
+ where n is the numeric value. To convert a time to seconds, use:
+
+ date -d '1970-01-01 UTC + n seconds'
+
+config PLATFORM_EC_CONSOLE_CMD_RTC_ALARM
+ bool "Console command: rtc_alarm"
+ depends on PLATFORM_EC_CONSOLE_CMD_RTC
+ default y
+ help
+ This command supports setting a real-time-clock (RTC) alarm that
+ causes an interrupt when the timer reaches that point. To set the
+ alarm:
+
+ rtc <sec> [<usec>]
+
+ where:
+ <sec> is the number of seconds since the epoch
+ <usec> is the optional number of microseconds (fractional seconds)
+
+config PLATFORM_EC_HOSTCMD_RTC
+ bool "Host command: EC_CMD_RTC_GET_VALUE etc."
+ depends on PLATFORM_EC_HOSTCMD
+ default y
+ help
+ Enables support for EC_CMD_RTC_GET_VALUE, EC_CMD_RTC_SET_VALUE,
+ EC_CMD_RTC_GET_ALARM and EC_CMD_RTC_SET_ALARM which colectively allow
+ the AP to control the EC's real-time-clock. The AP typically makes
+ use of the EC's RTC to avoid needing a discrete RTC chip on the board.
+
+endif # PLATFORM_EC_RTC
+
config PLATFORM_EC_CONSOLE_CMD_SHMEM
bool "Console command: shmem"
default y