diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index d8584b0d7fa..a77b81a79fc 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -93,16 +93,7 @@ static inline uint64_t counter(void) static inline int get_comparator(uint32_t chan, uint64_t *cc) { - nrfx_err_t result; - - result = nrfx_grtc_syscounter_cc_value_read(chan, cc); - if (result != NRFX_SUCCESS) { - if (result != NRFX_ERROR_INVALID_PARAM) { - return -EAGAIN; - } - return -EPERM; - } - return 0; + return nrfx_grtc_syscounter_cc_value_read(chan, cc); } /* @@ -173,14 +164,14 @@ static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_conte int32_t z_nrf_grtc_timer_chan_alloc(void) { uint8_t chan; - nrfx_err_t err_code; + int err_code; /* Prevent allocating all available channels - one must be left for system purposes. */ if (ext_channels_allocated >= EXT_CHAN_COUNT) { return -ENOMEM; } err_code = nrfx_grtc_channel_alloc(&chan); - if (err_code != NRFX_SUCCESS) { + if (err_code < 0) { return -ENOMEM; } ext_channels_allocated++; @@ -190,9 +181,9 @@ int32_t z_nrf_grtc_timer_chan_alloc(void) void z_nrf_grtc_timer_chan_free(int32_t chan) { IS_CHANNEL_ALLOWED_ASSERT(chan); - nrfx_err_t err_code = nrfx_grtc_channel_free(chan); + int err_code = nrfx_grtc_channel_free(chan); - if (err_code == NRFX_SUCCESS) { + if (err_code == 0) { ext_channels_allocated--; } } @@ -249,19 +240,13 @@ int z_nrf_grtc_timer_compare_read(int32_t chan, uint64_t *val) static int compare_set_nolocks(int32_t chan, uint64_t target_time, z_nrf_grtc_timer_compare_handler_t handler, void *user_data) { - nrfx_err_t result; - __ASSERT_NO_MSG(target_time < COUNTER_SPAN); nrfx_grtc_channel_t user_channel_data = { .handler = handler, .p_context = user_data, .channel = chan, }; - result = nrfx_grtc_syscounter_cc_absolute_set(&user_channel_data, target_time, true); - if (result != NRFX_SUCCESS) { - return -EPERM; - } - return 0; + return nrfx_grtc_syscounter_cc_absolute_set(&user_channel_data, target_time, true); } static int compare_set(int32_t chan, uint64_t target_time, @@ -314,7 +299,6 @@ int z_nrf_grtc_timer_capture_prepare(int32_t chan) .p_context = NULL, .channel = chan, }; - nrfx_err_t result; IS_CHANNEL_ALLOWED_ASSERT(chan); @@ -322,13 +306,7 @@ int z_nrf_grtc_timer_capture_prepare(int32_t chan) * (makes CCEN=1). COUNTER_SPAN is used so as not to fire an event unnecessarily * - it can be assumed that such a large value will never be reached. */ - result = nrfx_grtc_syscounter_cc_absolute_set(&user_channel_data, COUNTER_SPAN, false); - - if (result != NRFX_SUCCESS) { - return -EPERM; - } - - return 0; + return nrfx_grtc_syscounter_cc_absolute_set(&user_channel_data, COUNTER_SPAN, false); } int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) @@ -336,9 +314,7 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) /* TODO: The implementation should probably go to nrfx_grtc and this * should be just a wrapper for some nrfx_grtc_syscounter_capture_read. */ - - uint64_t capt_time; - nrfx_err_t result; + int result; IS_CHANNEL_ALLOWED_ASSERT(chan); @@ -349,14 +325,8 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ return -EBUSY; } - result = nrfx_grtc_syscounter_cc_value_read(chan, &capt_time); - if (result != NRFX_SUCCESS) { - return -EPERM; - } - - __ASSERT_NO_MSG(capt_time < COUNTER_SPAN); - - *captured_time = capt_time; + result = nrfx_grtc_syscounter_cc_value_read(chan, captured_time); + __ASSERT_NO_MSG(*captured_time < COUNTER_SPAN); return 0; } @@ -369,7 +339,7 @@ uint64_t z_nrf_grtc_timer_startup_value_get(void) #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; + int err_code; static uint8_t systemoff_channel; uint64_t now = counter(); nrfx_grtc_sleep_config_t sleep_cfg; @@ -392,9 +362,9 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) k_spinlock_key_t key = k_spin_lock(&lock); err_code = nrfx_grtc_channel_alloc(&systemoff_channel); - if (err_code != NRFX_SUCCESS) { + if (err_code < 0) { k_spin_unlock(&lock, key); - return -ENOMEM; + return err_code; } (void)nrfx_grtc_syscounter_cc_int_disable(systemoff_channel); ret = compare_set(systemoff_channel, @@ -459,7 +429,7 @@ uint32_t sys_clock_elapsed(void) static int sys_clock_driver_init(void) { - nrfx_err_t err_code; + int err_code; IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr, nrfx_grtc_irq_handler, 0); @@ -477,19 +447,19 @@ static int sys_clock_driver_init(void) #endif err_code = nrfx_grtc_init(0); - if (err_code != NRFX_SUCCESS) { - return -EPERM; + if (err_code < 0) { + return err_code; } #if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) err_code = nrfx_grtc_syscounter_start(true, &system_clock_channel_data.channel); - if (err_code != NRFX_SUCCESS) { - return err_code == NRFX_ERROR_NO_MEM ? -ENOMEM : -EPERM; + if (err_code < 0) { + return err_code; } #else err_code = nrfx_grtc_channel_alloc(&system_clock_channel_data.channel); - if (err_code != NRFX_SUCCESS) { - return -ENOMEM; + if (err_code < 0) { + return err_code; } #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index d05e741c74c..11d67b9d5ff 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -127,17 +127,10 @@ zephyr_library_sources(nrfx_glue.c) zephyr_library_sources(${HELPERS_DIR}/nrfx_flag32_allocator.c) zephyr_library_sources_ifdef(CONFIG_HAS_NORDIC_RAM_CTRL ${HELPERS_DIR}/nrfx_ram_ctrl.c) -if(CONFIG_NRFX_GPPI) - zephyr_library_sources_ifdef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/internal/nrfx_gppiv1_shim.c) - if(CONFIG_HAS_HW_NRF_PPI) - zephyr_library_sources_ifdef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/internal/nrfx_gppiv1_ppi.c) - zephyr_library_sources_ifdef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/internal/nrfx_ppi.c) - zephyr_library_sources_ifndef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/nrfx_gppi_ppi.c) - else() - zephyr_library_sources_ifdef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/internal/nrfx_gppiv1_dppi.c) - zephyr_library_sources_ifndef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/nrfx_gppi_dppi.c) - zephyr_library_sources_ifdef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/internal/nrfx_dppi.c) - endif() +if(CONFIG_NRFX_GPPI AND NOT CONFIG_NRFX_GPPI_V1) + zephyr_library_sources_ifdef(CONFIG_HAS_HW_NRF_PPI ${HELPERS_DIR}/nrfx_gppi_ppi.c) + zephyr_library_sources_ifdef(CONFIG_HAS_HW_NRF_DPPIC ${HELPERS_DIR}/nrfx_gppi_dppi.c) + zephyr_library_sources_ifdef(CONFIG_SOC_COMPATIBLE_NRF54LX ${HELPERS_DIR}/nrfx_gppi_lumos.c) endif() zephyr_library_sources_ifdef(CONFIG_NRFX_PRS ${SRC_DIR}/prs/nrfx_prs.c) @@ -219,14 +212,9 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_DISABLE_FICR_TRIMCNF NRF_DIS zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE NRF_SKIP_GLITCHDETECTOR_DISABLE) zephyr_compile_definitions_ifndef(CONFIG_SOC_NRF54L_ANOMALY_56_WORKAROUND NRF54L_CONFIGURATION_56_ENABLE=0) -if(CONFIG_SOC_COMPATIBLE_NRF54LX AND CONFIG_NRFX_GPPI) - zephyr_library_sources_ifdef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/internal/nrfx_gppiv1_ppib.c) - zephyr_library_sources_ifdef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/internal/nrfx_ppib.c) - zephyr_library_sources_ifndef(CONFIG_NRFX_GPPI_V1 ${HELPERS_DIR}/nrfx_gppi_lumos.c) -endif() - if(CONFIG_SOC_SERIES_NRF54HX AND CONFIG_NRFX_GPPI_V1) zephyr_library_sources(${HELPERS_DIR}/internal/nrfx_gppiv1_ipct.c) + zephyr_library_sources(${HELPERS_DIR}/internal/nrfx_gppiv1_shim.c) endif() diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index a0a90975f15..ade8fc93ff1 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -56,93 +56,6 @@ config NRFX_CRACEN bool "CRACEN drivers" depends on SOC_COMPATIBLE_NRF54LX -config NRFX_DPPI - bool - -config NRFX_DPPI0 - bool "DPPI0 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic0) - select NRFX_DPPI - -config NRFX_DPPI00 - bool "DPPI00 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic00) - select NRFX_DPPI - -config NRFX_DPPI10 - bool "DPPI10 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic10) - select NRFX_DPPI - -config NRFX_DPPI20 - bool "DPPI20 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic20) - select NRFX_DPPI - -config NRFX_DPPI30 - bool "DPPI30 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic30) - select NRFX_DPPI - -config NRFX_DPPI020 - bool "DPPI020 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic020) - select NRFX_DPPI - -config NRFX_DPPI120 - bool "DPPI120 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic120) - select NRFX_DPPI - -config NRFX_DPPI130 - bool "DPPI130 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic130) - select NRFX_DPPI - -config NRFX_DPPI131 - bool "DPPI131 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic131) - select NRFX_DPPI - -config NRFX_DPPI132 - bool "DPPI132 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic132) - select NRFX_DPPI - -config NRFX_DPPI133 - bool "DPPI133 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic133) - select NRFX_DPPI - -config NRFX_DPPI134 - bool "DPPI134 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic134) - select NRFX_DPPI - -config NRFX_DPPI135 - bool "DPPI135 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic135) - select NRFX_DPPI - -config NRFX_DPPI136 - bool "DPPI136 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,dppic136) - select NRFX_DPPI - config NRFX_EGU bool @@ -292,62 +205,6 @@ config NRFX_POWER # internally the USBREG driver. select NRFX_USBREG if $(dt_nodelabel_exists,usbreg) -config NRFX_PPI - bool "PPI allocator" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,ppi) - -config NRFX_PPIB - bool - -config NRFX_PPIB00 - bool "PPIB00 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,ppib00) - select NRFX_PPIB - -config NRFX_PPIB01 - bool "PPIB01 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,ppib01) - select NRFX_PPIB - -config NRFX_PPIB10 - bool "PPIB10 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,ppib10) - select NRFX_PPIB - -config NRFX_PPIB11 - bool "PPIB11 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,ppib11) - select NRFX_PPIB - -config NRFX_PPIB20 - bool "PPIB20 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,ppib20) - select NRFX_PPIB - -config NRFX_PPIB21 - bool "PPIB21 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,ppib21) - select NRFX_PPIB - -config NRFX_PPIB22 - bool "PPIB22 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,ppib22) - select NRFX_PPIB - -config NRFX_PPIB30 - bool "PPIB30 driver instance" - default y if NRFX_GPPI_V1 - depends on $(dt_nodelabel_exists,ppib30) - select NRFX_PPIB - config NRFX_PWM bool "PWM driver" diff --git a/modules/hal_nordic/nrfx/Kconfig.logging b/modules/hal_nordic/nrfx/Kconfig.logging index 322660f40d1..871dc438215 100644 --- a/modules/hal_nordic/nrfx/Kconfig.logging +++ b/modules/hal_nordic/nrfx/Kconfig.logging @@ -16,10 +16,6 @@ config NRFX_COMP_LOG bool "COMP driver logging" depends on NRFX_COMP -config NRFX_DPPI_LOG - bool "DPPI driver logging" - depends on NRFX_DPPI - config NRFX_EGU_LOG bool "EGU driver logging" depends on NRFX_EGU @@ -64,14 +60,6 @@ config NRFX_POWER_LOG bool "POWER driver logging" depends on NRFX_POWER -config NRFX_PPI_LOG - bool "PPI driver logging" - depends on NRFX_PPI - -config NRFX_PPIB_LOG - bool "PPIB driver logging" - depends on NRFX_PPIB - config NRFX_PRS_LOG bool "PRS driver logging" depends on NRFX_PRS diff --git a/modules/hal_nordic/nrfx/nrfx_kconfig.h b/modules/hal_nordic/nrfx/nrfx_kconfig.h index 5fea1d893d1..20a5fe671d3 100644 --- a/modules/hal_nordic/nrfx/nrfx_kconfig.h +++ b/modules/hal_nordic/nrfx/nrfx_kconfig.h @@ -82,55 +82,6 @@ #define NRFX_CRACEN_ENABLED 1 #endif -#ifdef CONFIG_NRFX_DPPI -#define NRFX_DPPI_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI_LOG -#define NRFX_DPPI_CONFIG_LOG_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI0 -#define NRFX_DPPI0_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI00 -#define NRFX_DPPI00_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI10 -#define NRFX_DPPI10_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI20 -#define NRFX_DPPI20_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI30 -#define NRFX_DPPI30_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI020 -#define NRFX_DPPI020_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI120 -#define NRFX_DPPI120_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI130 -#define NRFX_DPPI130_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI131 -#define NRFX_DPPI131_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI132 -#define NRFX_DPPI132_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI133 -#define NRFX_DPPI133_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI134 -#define NRFX_DPPI134_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI135 -#define NRFX_DPPI135_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_DPPI136 -#define NRFX_DPPI136_ENABLED 1 -#endif - #ifdef CONFIG_NRFX_EGU #define NRFX_EGU_ENABLED 1 #endif @@ -274,44 +225,6 @@ #define NRFX_POWER_CONFIG_LOG_ENABLED 1 #endif -#ifdef CONFIG_NRFX_PPI -#define NRFX_PPI_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPI_LOG -#define NRFX_PPI_CONFIG_LOG_ENABLED 1 -#endif - -#ifdef CONFIG_NRFX_PPIB -#define NRFX_PPIB_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPIB_LOG -#define NRFX_PPIB_CONFIG_LOG_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPIB00 -#define NRFX_PPIB00_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPIB01 -#define NRFX_PPIB01_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPIB10 -#define NRFX_PPIB10_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPIB11 -#define NRFX_PPIB11_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPIB20 -#define NRFX_PPIB20_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPIB21 -#define NRFX_PPIB21_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPIB22 -#define NRFX_PPIB22_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PPIB30 -#define NRFX_PPIB30_ENABLED 1 -#endif - #ifdef CONFIG_NRFX_PRS #define NRFX_PRS_ENABLED 1 #endif @@ -546,13 +459,6 @@ CONFIG_NRF52_ANOMALY_109_WORKAROUND_EGU_INSTANCE #endif -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || \ - DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_local) -#ifndef NRFX_DPPI_ENABLED -#define NRFX_DPPI_ENABLED 1 -#endif -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || ... */ - /* If local or global DPPIC peripherals are used, provide the following macro * definitions required by the interconnect/ipct layer: * - NRFX_IPCTx_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num)