From 513b64dcc7eb70d96c4252a8ce9ed7444a94d9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Fri, 14 Feb 2025 12:30:17 +0100 Subject: [PATCH] [nrf fromlist] modules: hal_nordic: nrf_802154: enable constant latency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To ensure that the accesses to the radio peripheral are done with predictable timings, the constant latency must be enabled. The constant latency mode is enabled alongside the HFXO. Upstream PR #: 85883 Signed-off-by: Rafał Kuźnia --- modules/hal_nordic/Kconfig | 7 +++++++ .../platform/nrf_802154_clock_zephyr.c | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index 32ff1a6c74c..1b151cd4bfa 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -36,6 +36,13 @@ menuconfig NRF_802154_RADIO_DRIVER if NRF_802154_RADIO_DRIVER +config NRF_802154_CONSTLAT_CONTROL + def_bool y + depends on SOC_SERIES_NRF54LX + select NRF_SYS_EVENT if NRF_802154_SL_OPENSOURCE + help + Allows the nRF 802.15.4 radio driver to manage the constant latency state. + config NRF_802154_MULTIPROTOCOL_SUPPORT bool help diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index a55e63bc589..87aa85261e9 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -12,6 +12,7 @@ #include #include #include +#include static bool hfclk_is_running; @@ -52,6 +53,14 @@ void nrf_802154_clock_hfclk_start(void) sys_notify_init_callback(&hfclk_cli.notify, hfclk_on_callback); + /* + * todo: replace constlat request with PM policy API when + * controlling the event latency becomes possible. + */ + if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { + nrf_sys_event_request_global_constlat(); + } + int ret = onoff_request(mgr, &hfclk_cli); __ASSERT_NO_MSG(ret >= 0); (void)ret; @@ -67,6 +76,11 @@ void nrf_802154_clock_hfclk_stop(void) int ret = onoff_cancel_or_release(mgr, &hfclk_cli); __ASSERT_NO_MSG(ret >= 0); (void)ret; + + if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) { + nrf_sys_event_release_global_constlat(); + } + hfclk_is_running = false; }