Skip to content

Commit b3a599b

Browse files
committed
[nrf fromlist] drivers: timer: nrf_rtc_timer: do not start LFCLK unless CLOCK_CONTROL
Do not start the LF clock unless CONFIG_CLOCK_CONTROL_NRF is enabled. This is similar to how it's done in Nordic's GRTC driver. Upstream PR: zephyrproject-rtos/zephyr#86762 Authored-by: Krzysztof Chruściński <[email protected]> Signed-off-by: Emanuele Di Santo <[email protected]>
1 parent 71f3da0 commit b3a599b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/timer/nrf_rtc_timer.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -726,13 +726,6 @@ void sys_clock_disable(void)
726726

727727
static int sys_clock_driver_init(void)
728728
{
729-
static const enum nrf_lfclk_start_mode mode =
730-
IS_ENABLED(CONFIG_SYSTEM_CLOCK_NO_WAIT) ?
731-
CLOCK_CONTROL_NRF_LF_START_NOWAIT :
732-
(IS_ENABLED(CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY) ?
733-
CLOCK_CONTROL_NRF_LF_START_AVAILABLE :
734-
CLOCK_CONTROL_NRF_LF_START_STABLE);
735-
736729
int_event_disable_rtc();
737730

738731
/* TODO: replace with counter driver to access RTC */
@@ -763,7 +756,16 @@ static int sys_clock_driver_init(void)
763756

764757
compare_set(0, initial_timeout, sys_clock_timeout_handler, NULL, false);
765758

759+
#if defined(CONFIG_CLOCK_CONTROL_NRF)
760+
static const enum nrf_lfclk_start_mode mode =
761+
IS_ENABLED(CONFIG_SYSTEM_CLOCK_NO_WAIT) ?
762+
CLOCK_CONTROL_NRF_LF_START_NOWAIT :
763+
(IS_ENABLED(CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY) ?
764+
CLOCK_CONTROL_NRF_LF_START_AVAILABLE :
765+
CLOCK_CONTROL_NRF_LF_START_STABLE);
766+
766767
z_nrf_clock_control_lf_on(mode);
768+
#endif
767769

768770
return 0;
769771
}

0 commit comments

Comments
 (0)