From e75cb331df508c98e87c9f407484667c90577e6a Mon Sep 17 00:00:00 2001 From: Frans Hendriks Date: Fri, 22 Mar 2019 11:06:56 +0100 Subject: [PATCH] drivers/pc80/rtc/mc146818rtc.c: Reset RTC time on RTC power failure RTC time contains invalid values on system without RTC battery. Handle 'invalid' the same way as 'cmos_invalid'. This will reset CMOS date when calling function enables 'invalid'. BUG=N/A TEST=Portwell PQ-M107 booting Linux Embedded Change-Id: I5eae57d00f328400a8b03c28b7ecdbbc71522206 Signed-off-by: Frans Hendriks Reviewed-on: https://review.coreboot.org/c/coreboot/+/29329 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) --- src/drivers/pc80/rtc/mc146818rtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c index c18f1e947b..99079b985e 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 , Raptor Engineering + * Copyright (C) 2018-2019 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 @@ -144,7 +145,7 @@ static bool __cmos_init(bool invalid) cmos_write(0, i); } - if (cmos_invalid) + if (cmos_invalid || invalid) cmos_reset_date(); printk(BIOS_WARNING, "RTC:%s%s%s%s\n",