From 7903c214baaa8b8648a541d1147e702f4c6a7d80 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 10 Jun 2016 20:58:24 -0600 Subject: [PATCH] UPSTREAM: lib: Add real-time-clock functions Add functions to convert between seconds and a struct rtc_time. Also add a function that can display the time on the console. BUG=chrome-os-partner:52220 BRANCH=none TEST=(partial) with future commits and after setting RTC on the EC: boot on gru into linux shell, check firmware log: localhost ~ # grep Date: /sys/firmware/log Date: 2016-06-20 (Monday) Time: 18:01:44 Then reboot ~10 seconds and check again: localhost ~ # grep Date: /sys/firmware/log Date: 2016-06-20 (Monday) Time: 18:01:54 BUG=None BRANCH=None TEST=None Change-Id: Id148ccb7a18a05865b903307358666ff6c7b4a3d Original-Signed-off-by: Martin Roth Original-Original-Commit-Id: 3b02dbcd7d9023ce0acabebcf904e70007428d27 Original-Change-Id: I344c385e2e4cb995d3a374025c205f01c38b660d Original-Original-Signed-off-by: Simon Glass Original-Original-Reviewed-on: https://chromium-review.googlesource.com/351782 Original-Original-Commit-Ready: Vadim Bendebury Original-Original-Tested-by: Vadim Bendebury Original-Original-Reviewed-by: Vadim Bendebury Original-Reviewed-on: https://review.coreboot.org/15301 Original-Tested-by: build bot (Jenkins) Original-Reviewed-by: Aaron Durbin Signed-off-by: Aaron Durbin Reviewed-on: https://chromium-review.googlesource.com/358385 Reviewed-by: Martin Roth --- src/commonlib/Makefile.inc | 2 -- src/lib/Makefile.inc | 1 + src/{commonlib => lib}/rtc.c | 16 +++++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) rename src/{commonlib => lib}/rtc.c (85%) diff --git a/src/commonlib/Makefile.inc b/src/commonlib/Makefile.inc index ad55794cde..be22e0097d 100644 --- a/src/commonlib/Makefile.inc +++ b/src/commonlib/Makefile.inc @@ -25,5 +25,3 @@ verstage-y += lz4_wrapper.c romstage-y += lz4_wrapper.c ramstage-y += lz4_wrapper.c postcar-y += lz4_wrapper.c - -ramstage-y += rtc.c diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index 5d619d923a..2272b82dfd 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -81,6 +81,7 @@ ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c romstage-$(CONFIG_CACHE_AS_RAM) += ramtest.c romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c romstage-y += stack.c +ramstage-y += rtc.c ifeq ($(CONFIG_EARLY_CBMEM_INIT),y) romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c diff --git a/src/commonlib/rtc.c b/src/lib/rtc.c similarity index 85% rename from src/commonlib/rtc.c rename to src/lib/rtc.c index 08ce0d12c9..bd98590d96 100644 --- a/src/commonlib/rtc.c +++ b/src/lib/rtc.c @@ -1,8 +1,18 @@ /* - * (C) Copyright 2001 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * This file is part of the coreboot project. + * + * (C) Copyright 2001 Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * SPDX-License-Identifier: GPL-2.0+ * From U-Boot 2016.05 */