Browse Source

drivers: timer: nrf_grtc_timer: Align Zephyr to new AUTOEN read manner

The new GRTC reading manner of the SYSCOUNTER uses hardware mechanism which
allows to keep it alive when any of CPUs is not sleeping. Otherwise
the SYSCOUNTER goes into sleep mode. Thus there is no
longer need to maintain the `CONFIG_NRF_GRTC_SLEEP_ALLOWED` symbol, however
if the user wants to have the SYSCOUNTER enabled all the time the
`CONFIG_NRF_GRTC_ALWAYS_ON` can be used instead.
The nrfx_grtc  driver no longer provides the `wakeup-read-sleep` reading
manner.
Also setting the GRTC clock source is performed by the nrfx_grtc driver so
it has been removed from the `sys_clock_driver_init()` function.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
pull/79262/head
Adam Kondraciuk 10 months ago committed by Carles Cufí
parent
commit
bc7a5b6781
  1. 9
      drivers/timer/Kconfig.nrf_grtc
  2. 13
      drivers/timer/nrf_grtc_timer.c
  3. 3
      modules/hal_nordic/nrfx/nrfx_config.h
  4. 9
      modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h
  5. 9
      modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_flpr.h
  6. 9
      modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_application.h
  7. 9
      modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_ppr.h
  8. 9
      modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_radiocore.h
  9. 2
      soc/nordic/nrf54l/Kconfig

9
drivers/timer/Kconfig.nrf_grtc

@ -15,11 +15,10 @@ menuconfig NRF_GRTC_TIMER @@ -15,11 +15,10 @@ menuconfig NRF_GRTC_TIMER
if NRF_GRTC_TIMER
config NRF_GRTC_SLEEP_ALLOWED
def_bool y
depends on POWEROFF
config NRF_GRTC_ALWAYS_ON
bool
help
This feature allows GRTC SYSCOUNTER to go to sleep state.
Always keep the SYSCOUNTER active even if the CPU is in sleep mode.
config NRF_GRTC_TIMER_APP_DEFINED_INIT
bool "Application defines GRTC initialization"
@ -44,7 +43,7 @@ config NRF_GRTC_TIMER_CLOCK_MANAGEMENT @@ -44,7 +43,7 @@ config NRF_GRTC_TIMER_CLOCK_MANAGEMENT
config NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY
int
default 1000
depends on NRF_GRTC_SLEEP_ALLOWED
depends on POWEROFF
help
The value (in us) ensures that the wakeup event will not fire
too early. In other words, applying SYSCOUNTER sleep state for less than

13
drivers/timer/nrf_grtc_timer.c

@ -367,7 +367,7 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) @@ -367,7 +367,7 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time)
return 0;
}
#if defined(CONFIG_NRF_GRTC_SLEEP_ALLOWED) && defined(CONFIG_NRF_GRTC_START_SYSCOUNTER)
#if defined(CONFIG_POWEROFF) && defined(CONFIG_NRF_GRTC_START_SYSCOUNTER)
int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us)
{
nrfx_err_t err_code;
@ -432,7 +432,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) @@ -432,7 +432,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us)
k_spin_unlock(&lock, key);
return 0;
}
#endif /* CONFIG_NRF_GRTC_SLEEP_ALLOWED */
#endif /* CONFIG_POWEROFF */
uint32_t sys_clock_cycle_get_32(void)
{
@ -465,12 +465,6 @@ static int sys_clock_driver_init(void) @@ -465,12 +465,6 @@ static int sys_clock_driver_init(void)
{
nrfx_err_t err_code;
#if defined(CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) && \
(defined(NRF_GRTC_HAS_CLKSEL) && (NRF_GRTC_HAS_CLKSEL == 1))
/* Use System LFCLK as the low-frequency clock source during initialization. */
nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFCLK);
#endif
IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr,
nrfx_grtc_irq_handler, 0);
@ -513,6 +507,9 @@ static int sys_clock_driver_init(void) @@ -513,6 +507,9 @@ static int sys_clock_driver_init(void)
nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO);
#endif
#if defined(CONFIG_NRF_GRTC_ALWAYS_ON)
nrfx_grtc_active_request_set(true);
#endif
return 0;
}

3
modules/hal_nordic/nrfx/nrfx_config.h

@ -132,9 +132,6 @@ @@ -132,9 +132,6 @@
#ifdef CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT
#define NRF_GRTC_HAS_EXTENDED 1
#endif
#ifdef CONFIG_NRF_GRTC_SLEEP_ALLOWED
#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 1
#endif
#ifdef CONFIG_NRF_GRTC_TIMER_AUTO_KEEP_ALIVE
#define NRFX_GRTC_CONFIG_AUTOEN 1
#endif

9
modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h

@ -283,15 +283,6 @@ @@ -283,15 +283,6 @@
#define NRFX_GRTC_ENABLED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED
*
* Boolean. Accepted values: 0 and 1.
*/
#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED
#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_AUTOEN
*

9
modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_flpr.h

@ -283,15 +283,6 @@ @@ -283,15 +283,6 @@
#define NRFX_GRTC_ENABLED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED
*
* Boolean. Accepted values: 0 and 1.
*/
#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED
#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_AUTOEN
*

9
modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_application.h

@ -367,15 +367,6 @@ @@ -367,15 +367,6 @@
#define NRFX_GRTC_ENABLED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED
*
* Boolean. Accepted values: 0 and 1.
*/
#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED
#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_AUTOEN
*

9
modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_ppr.h

@ -322,15 +322,6 @@ @@ -322,15 +322,6 @@
#define NRFX_GRTC_ENABLED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED
*
* Boolean. Accepted values: 0 and 1.
*/
#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED
#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_AUTOEN
*

9
modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_radiocore.h

@ -407,15 +407,6 @@ @@ -407,15 +407,6 @@
#define NRFX_GRTC_ENABLED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED
*
* Boolean. Accepted values: 0 and 1.
*/
#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED
#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0
#endif
/**
* @brief NRFX_GRTC_CONFIG_AUTOEN
*

2
soc/nordic/nrf54l/Kconfig

@ -86,7 +86,7 @@ if NRF_GRTC_TIMER @@ -86,7 +86,7 @@ if NRF_GRTC_TIMER
config ELV_GRTC_LFXO_ALLOWED
bool
depends on NRF_GRTC_SLEEP_ALLOWED
depends on POWEROFF
select EXPERIMENTAL
help
This feature allows using ELV mode when GRTC operates with the LFXO as

Loading…
Cancel
Save