soc/mediatek/mt8196: Set RTC EOSC calibration to 8 seconds

Set the RTC EOSC (External Oscillator) calibration to 8 seconds in
rtc_boot flow to ensure the accuracy of the RTC time during long period
of suspend. Without this setting, default value is 0, meaning no EOSC
calibration.

BRANCH=rauru
BUG=b:441304060
TEST=emerge-rauru coreboot chromeos-bootimage, when suspend/
warmboot/coldboot, RTC boots and works normally.

Signed-off-by: Shunxi Zhang <ot_shunxi.zhang@mediatek.corp-partner.google.com>
Change-Id: Ia7f15a6056cfa6bd808bc5a91147c1d64aff1223
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89307
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Yidi Lin <yidilin@google.com>
This commit is contained in:
Shunxi Zhang 2025-09-05 18:00:43 +08:00 committed by Yidi Lin
commit 4a7d779ed0
2 changed files with 7 additions and 0 deletions

View file

@ -120,6 +120,8 @@
#define RTC_K_EOSC_RSV_1 (1 << 9)
#define RTC_K_EOSC_RSV_2 (1 << 10)
#define RTC_EOSC_CALI_TD_8SEC (6 << 8)
#define TMA_KEY 0x39e
#define TMA_KEY_MASK 0xFF
#define TMA_KEY_SHIFT 0

View file

@ -570,6 +570,11 @@ void rtc_boot(void)
}
}
/* Set RTC EOSC calibration period = 8sec */
rtc_read(RTC_AL_DOW, &rdata);
rtc_write(RTC_AL_DOW, rdata | RTC_EOSC_CALI_TD_8SEC);
rtc_write_trigger();
/* Make sure RTC get the latest register info. */
rtc_read(RTC_BBPU, &rtc_bbpu);
rtc_write(RTC_BBPU, rtc_bbpu | RTC_BBPU_KEY | RTC_BBPU_RELOAD);