diff options
author | Lijian Zhao <lijian.zhao@intel.com> | 2017-09-06 16:47:17 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2017-09-11 18:14:35 +0000 |
commit | bfabe62a6e5cdd9e29394b12737c5ed9bd080036 (patch) | |
tree | 6a190f588a2da452fdfd89c68bf31279cd9aa61a /src/soc/intel/common/block/rtc/rtc.c | |
parent | 0a712c33379799b13215068e4dcbad8272d38ccc (diff) | |
download | coreboot-bfabe62a6e5cdd9e29394b12737c5ed9bd080036.tar.xz |
soc/intel/common/block: Update common rtc code
Move rtc init code into common area and update the implementation for
apollolake to avoid build break.
Change-Id: I702ce0efba25cb6fde33cc15698ae44312742367
Signed-off-by: Lijian Zhao <lijian.zhao@intel.com>
Reviewed-on: https://review.coreboot.org/21433
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc/intel/common/block/rtc/rtc.c')
-rw-r--r-- | src/soc/intel/common/block/rtc/rtc.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/soc/intel/common/block/rtc/rtc.c b/src/soc/intel/common/block/rtc/rtc.c index ea9987074b..04c07687db 100644 --- a/src/soc/intel/common/block/rtc/rtc.c +++ b/src/soc/intel/common/block/rtc/rtc.c @@ -13,9 +13,11 @@ * GNU General Public License for more details. */ -#include <soc/pcr_ids.h> #include <intelblocks/pcr.h> #include <intelblocks/rtc.h> +#include <soc/pcr_ids.h> +#include <pc80/mc146818rtc.h> +#include <vboot/vbnv.h> /* RTC PCR configuration */ #define PCR_RTC_CONF 0x3400 @@ -29,3 +31,22 @@ void enable_rtc_upper_bank(void) /* Enable upper 128 bytes of CMOS */ pcr_or32(PID_RTC, PCR_RTC_CONF, PCR_RTC_CONF_UCMOS_EN); } + +__attribute__((weak)) int soc_get_rtc_failed(void) +{ + return 0; +} + +void rtc_init(void) +{ + int rtc_failed; + + rtc_failed = soc_get_rtc_failed(); + /* Ensure the date is set including century byte. */ + cmos_check_update_date(); + + if (IS_ENABLED(CONFIG_VBOOT_VBNV_CMOS)) + init_vbnv_cmos(rtc_failed); + else + cmos_init(rtc_failed); +} |