summaryrefslogtreecommitdiff
path: root/src/soc/intel/icelake/pmutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/icelake/pmutil.c')
-rw-r--r--src/soc/intel/icelake/pmutil.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/soc/intel/icelake/pmutil.c b/src/soc/intel/icelake/pmutil.c
index 108b919d78..f552a8c8e5 100644
--- a/src/soc/intel/icelake/pmutil.c
+++ b/src/soc/intel/icelake/pmutil.c
@@ -178,6 +178,22 @@ static int rtc_failed(uint32_t gen_pmcon_b)
return !!(gen_pmcon_b & RTC_BATTERY_DEAD);
}
+static void clear_rtc_failed(void)
+{
+ clrbits8(pmc_mmio_regs() + GEN_PMCON_B, RTC_BATTERY_DEAD);
+}
+
+static int check_rtc_failed(uint32_t gen_pmcon_b)
+{
+ const int failed = rtc_failed(gen_pmcon_b);
+ if (failed) {
+ clear_rtc_failed();
+ printk(BIOS_DEBUG, "rtc_failed = 0x%x\n", failed);
+ }
+
+ return failed;
+}
+
int soc_get_rtc_failed(void)
{
const struct chipset_power_state *ps;
@@ -185,12 +201,12 @@ int soc_get_rtc_failed(void)
if (acpi_pm_state_for_rtc(&ps) < 0)
return 1;
- return rtc_failed(ps->gen_pmcon_b);
+ return check_rtc_failed(ps->gen_pmcon_b);
}
int vbnv_cmos_failed(void)
{
- return rtc_failed(read32(pmc_mmio_regs() + GEN_PMCON_B));
+ return check_rtc_failed(read32(pmc_mmio_regs() + GEN_PMCON_B));
}
static inline int deep_s3_enabled(void)