drivers: clock_control: smartbond: Fix rc32k calibration

If RC32K oscillator was on during startup, calibration
work was never going to actually calibrate this oscillator.
It happen because lpc_clock_state.rc32k_started was only set when
oscillator was turned on after if was turned off.

Now lpc_clock_state.rc32k_started is also set when rc32k is already
started (possible during boot).

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
This commit is contained in:
Jerzy Kasenberg 2023-12-05 14:57:19 +01:00 committed by Carles Cufí
parent 1dc43605df
commit f1e7a0dd6c

View file

@ -73,8 +73,8 @@ static void smartbond_start_rc32k(void)
{
if ((CRG_TOP->CLK_RC32K_REG & CRG_TOP_CLK_RC32K_REG_RC32K_ENABLE_Msk) == 0) {
CRG_TOP->CLK_RC32K_REG |= CRG_TOP_CLK_RC32K_REG_RC32K_ENABLE_Msk;
lpc_clock_state.rc32k_started = true;
}
lpc_clock_state.rc32k_started = true;
if (!lpc_clock_state.rc32k_ready && (CALIBRATION_INTERVAL > 0)) {
if (!k_work_is_pending(&calibration_work.work)) {
k_work_schedule(&calibration_work,