From cd8a312b8d865499c0fb5544d6860a369066bcb3 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 24 Nov 2025 18:27:04 +0800 Subject: [PATCH] switch on the xtal32 source for the rtc in baosec mode, in the loader --- loader/src/platform/bao1x/bao1x.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/loader/src/platform/bao1x/bao1x.rs b/loader/src/platform/bao1x/bao1x.rs index 1c3ed87e6..bc224bc5b 100644 --- a/loader/src/platform/bao1x/bao1x.rs +++ b/loader/src/platform/bao1x/bao1x.rs @@ -140,6 +140,11 @@ pub fn early_init_hw() -> u32 { // kernel expects the TRNG to be on iox.set_gpio_pin(trng_power.0, trng_power.1, bao1x_api::IoxValue::High); + // select the 32khz external xosc for baosec targets + // note that on dabao there is still a "32khz" source, but it's the internal ring oscillator + // and it's only accurate to within about 10%. + ao_sysctrl.rmwf(utra::ao_sysctrl::CR_CR_CLK32KSELREG, 1); + use bao1x_hal::udma::GlobalConfig; use ux_api::minigfx::FrameBuffer;