[coreboot-gerrit] New patch to review for coreboot: rtc: Force negative edge on SET after battery replacement

Marshall Dawson (marshalldawson3rd@gmail.com) gerrit at coreboot.org
Thu Nov 10 22:52:53 CET 2016


Marshall Dawson (marshalldawson3rd at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17370

-gerrit

commit 58342e169f112a8f74a962900271f6a0ceb42835
Author: Marshall Dawson <marshalldawson3rd at gmail.com>
Date:   Sat Nov 5 18:47:51 2016 -0600

    rtc: Force negative edge on SET after battery replacement
    
    After the RTC coin cell has been replaced, the Update Cycle Inhibit
    bit must see at least one low transition to ensure the RTC counts.
    The reset value for this bit is undefined. Examples have been observed
    where batteries are installed on a manufacturing line, the bit's state
    comes up low, but the RTC does not count.
    
    Change-Id: I05f61efdf941297fa9ec90136124b0c8fe0639c6
    Signed-off-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
 src/drivers/pc80/rtc/mc146818rtc.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c
index c3026a4..6c4252a 100644
--- a/src/drivers/pc80/rtc/mc146818rtc.c
+++ b/src/drivers/pc80/rtc/mc146818rtc.c
@@ -114,11 +114,11 @@ void cmos_init(bool invalid)
 
 	printk(BIOS_DEBUG, "RTC Init\n");
 
-	if (IS_ENABLED(CONFIG_USE_OPTION_TABLE)) {
-		/* See if there has been a CMOS power problem. */
-		x = cmos_read(RTC_VALID);
-		cmos_invalid = !(x & RTC_VRT);
+	/* See if there has been a CMOS power problem. */
+	x = cmos_read(RTC_VALID);
+	cmos_invalid = !(x & RTC_VRT);
 
+	if (IS_ENABLED(CONFIG_USE_OPTION_TABLE)) {
 		/* See if there is a CMOS checksum error */
 		checksum_invalid = !cmos_checksum_valid(PC_CKS_RANGE_START,
 						PC_CKS_RANGE_END, PC_CKS_LOC);
@@ -128,6 +128,9 @@ void cmos_init(bool invalid)
 		clear_cmos = true;
 	}
 
+	if (cmos_invalid || invalid)
+		cmos_write(cmos_read(RTC_CONTROL) | RTC_SET, RTC_CONTROL);
+
 	if (invalid || cmos_invalid || checksum_invalid) {
 		if (clear_cmos) {
 			cmos_write(0, 0x01);



More information about the coreboot-gerrit mailing list