mediatek/mt8183: Enable RTC eosc calibration feature to save power

When system shuts down, RTC enable eosc calibration feature to save
power. Then coreboot RTC driver needs to call rtc_enable_dcxo function
at every boot to switch RTC clock source to dcxo.

BUG=b:128467245
BRANCH=none
TEST=Boots correctly on Kukui

Change-Id: Iee21e7611df8959cbbc63b6e6655cfb462147748
Signed-off-by: Ran Bi <ran.bi@mediatek.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32339
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Ran Bi
2019-04-17 15:43:14 +08:00
committed by Martin Roth
parent e458bcd099
commit fcfa35670a
3 changed files with 33 additions and 26 deletions

View File

@@ -91,12 +91,15 @@ int rtc_xosc_write(u16 val)
u16 bbpu;
rtc_write(RTC_OSC32CON, RTC_OSC32CON_UNLOCK1);
udelay(200);
if (!rtc_busy_wait())
return 0;
rtc_write(RTC_OSC32CON, RTC_OSC32CON_UNLOCK2);
udelay(200);
if (!rtc_busy_wait())
return 0;
rtc_write(RTC_OSC32CON, val);
udelay(200);
if (!rtc_busy_wait())
return 0;
rtc_read(RTC_BBPU, &bbpu);
bbpu |= RTC_BBPU_KEY | RTC_BBPU_RELOAD;