[coreboot-gerrit] Patch set updated for coreboot: ec/google: Add support for the EC 'get time' function
Martin Roth (martinroth@google.com)
gerrit at coreboot.org
Wed Jun 22 18:51:24 CEST 2016
Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15302
-gerrit
commit 70be03e22fb2fec89ae7239116cbf7a5f598b818
Author: Simon Glass <sjg at chromium.org>
Date: Fri Jun 10 20:58:24 2016 -0600
ec/google: Add support for the EC 'get time' function
Some platforms have an RTC provided by the Chrome OS EC. Allow the EC to
implement rtc_get() so that this can be plumbed in.
BUG=chrome-os-partner:52220
BRANCH=none
TEST=(partial) with future commits, boot on gru and see output:
Date: 1970-01-17 (Saturday) Time: 1:42:44
Then reboot ~10 seconds later and see output:
Date: 1970-01-17 (Saturday) Time: 1:42:53
Change-Id: I3b38f23b259837cdd4bd99167961b7bd245683b3
Signed-off-by: Martin Roth <martinroth at chromium.org>
Original-Commit-Id: 4a4a26da37323c9ac33030c8f1510efae5ac2505
Original-Change-Id: Icaa381d32517dfed8d3b7927495b67a027d5ceea
Original-Signed-off-by: Simon Glass <sjg at chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/351780
Original-Commit-Ready: Vadim Bendebury <vbendeb at chromium.org>
Original-Tested-by: Vadim Bendebury <vbendeb at chromium.org>
Original-Reviewed-by: Vadim Bendebury <vbendeb at chromium.org>
---
src/ec/google/chromeec/Kconfig | 7 +++++++
src/ec/google/chromeec/ec.c | 21 +++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/src/ec/google/chromeec/Kconfig b/src/ec/google/chromeec/Kconfig
index 2e4affc..0e1b4f2 100644
--- a/src/ec/google/chromeec/Kconfig
+++ b/src/ec/google/chromeec/Kconfig
@@ -98,3 +98,10 @@ config EC_GOOGLE_CHROMEEC_PD_BOARDNAME
The board name used in the Chrome EC code base to build
the PD firmware. If set, the coreboot build with also
build the EC firmware and add it to the image.
+
+config EC_GOOGLE_CHROMEEC_RTC
+ depends on EC_GOOGLE_CHROMEEC
+ bool "Enable Chrome OS EC RTC"
+ help
+ Enable support for the real-time clock on the Chrome OS EC. This
+ uses the EC_CMD_RTC_GET_VALUE command to read the current time.
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index 87ab13a..1a381d7 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -22,6 +22,7 @@
#include <halt.h>
#include <reset.h>
#include <elog.h>
+#include <rtc.h>
#include <stdlib.h>
#include "chip.h"
@@ -142,6 +143,26 @@ int google_chromeec_check_feature(int feature)
return r.flags[feature / 32] & EC_FEATURE_MASK_0(feature);
}
+#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_RTC)
+int rtc_get(struct rtc_time *time)
+{
+ struct chromeec_command cmd;
+ struct ec_response_rtc r;
+
+ cmd.cmd_code = EC_CMD_RTC_GET_VALUE;
+ cmd.cmd_version = 0;
+ cmd.cmd_size_in = 0;
+ cmd.cmd_data_out = &r;
+ cmd.cmd_size_out = sizeof(r);
+ cmd.cmd_dev_index = 0;
+
+ if (google_chromeec_command(&cmd) != 0)
+ return -1;
+
+ return rtc_to_tm(r.time, time);
+}
+#endif
+
#ifndef __SMM__
#ifdef __PRE_RAM__
void google_chromeec_check_ec_image(int expected_type)
More information about the coreboot-gerrit
mailing list