[coreboot-gerrit] Change in coreboot[master]: src/drivers/pc80/rtc/mc146818rtc.c: Reset RTC time on RTC power failure

Frans Hendriks (Code Review) gerrit at coreboot.org
Mon Oct 29 14:59:37 CET 2018


Frans Hendriks has uploaded this change for review. ( https://review.coreboot.org/29329


Change subject: src/drivers/pc80/rtc/mc146818rtc.c: Reset RTC time on RTC power failure
......................................................................

src/drivers/pc80/rtc/mc146818rtc.c: Reset RTC time on RTC power failure

RTC time contains invalid values on system without RTC battery
Add config to enable reset of RTC time when RTC power failure has been
detected.

BUG=N/A
TEST=Portwell PQ-M107

Change-Id: I5eae57d00f328400a8b03c28b7ecdbbc71522206
Signed-off-by: Frans Hendriks <fhendriks at eltan.com>
---
M src/drivers/pc80/rtc/Kconfig
M src/drivers/pc80/rtc/mc146818rtc.c
2 files changed, 13 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/29329/1

diff --git a/src/drivers/pc80/rtc/Kconfig b/src/drivers/pc80/rtc/Kconfig
index 350863e..fd4675a4 100644
--- a/src/drivers/pc80/rtc/Kconfig
+++ b/src/drivers/pc80/rtc/Kconfig
@@ -2,3 +2,8 @@
 	bool
 	default y if ARCH_X86
 	depends on PC80_SYSTEM
+
+config RESET_TIME_ON_RTC_POWERFAIL
+	bool
+	default n
+	depends on PC80_SYSTEM
diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c
index 3b22a46..81d10cd 100644
--- a/src/drivers/pc80/rtc/mc146818rtc.c
+++ b/src/drivers/pc80/rtc/mc146818rtc.c
@@ -3,6 +3,7 @@
  *
  * Copyright 2014 The Chromium OS Authors. All rights reserved.
  * Copyright (C) 2015 Timothy Pearson <tpearson at raptorengineeringinc.com>, Raptor Engineering
+ * Copyright (C) 2018 Eltan B.V.
  *
  * 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
@@ -122,6 +123,13 @@
 	x = cmos_read(RTC_VALID);
 	cmos_invalid = !(x & RTC_VRT);
 
+#if IS_ENABLED(CONFIG_RESET_TIME_ON_RTC_POWERFAIL)
+	if (invalid == true) {
+		cmos_invalid = true;
+		printk(BIOS_DEBUG, "Force cmos_invalid to true\n");
+	}
+#endif
+
 	if (IS_ENABLED(CONFIG_USE_OPTION_TABLE)) {
 		/* See if there is a CMOS checksum error */
 		checksum_invalid = !cmos_checksum_valid(PC_CKS_RANGE_START,

-- 
To view, visit https://review.coreboot.org/29329
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5eae57d00f328400a8b03c28b7ecdbbc71522206
Gerrit-Change-Number: 29329
Gerrit-PatchSet: 1
Gerrit-Owner: Frans Hendriks <fhendriks at eltan.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181029/b77f98da/attachment-0001.html>


More information about the coreboot-gerrit mailing list