drivers: clock_control: Enable LFSTARTED event for nrf5

The LFSTARTED event was disabled so it was impossible to wake the
CPU up on LF clock being ready. The Bluetooth stack was putting
the CPU to sleep, expecting to be woken up on LFSTARTED event.
As the event never triggered, the CPU was woken up seconds later
by a different event introducing a multi-second startup delay.

Bug introduced by 23c92100ac.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2018-12-04 14:23:29 +01:00 committed by Johan Hedberg
parent 0c24e62f2c
commit d8e3ea6bc2

View File

@ -212,6 +212,7 @@ static int _k32src_start(struct device *dev, clock_control_subsys_t sub_system)
/* NOTE: LFCLK will initially start running from the LFRC if LFXO is
* selected.
*/
nrf_clock_int_enable(NRF_CLOCK_INT_LF_STARTED_MASK);
nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART);
#endif /* !CONFIG_CLOCK_CONTROL_NRF5_K32SRC_BLOCKING */
@ -344,8 +345,11 @@ static void _power_clock_isr(void *arg)
*/
NRF_CLOCK->INTENCLR = CLOCK_INTENCLR_LFCLKSTARTED_Msk;
/* Start HF Clock */
ctto = 1;
/* Start HF Clock if LF RC is used. */
if ((NRF_CLOCK->LFCLKSRCCOPY & CLOCK_LFCLKSRCCOPY_SRC_Msk) ==
CLOCK_LFCLKSRCCOPY_SRC_RC) {
ctto = 1;
}
}
}