From 31b1b4e4b5dc3995c30889f0d2d3cb415fa7c1eb Mon Sep 17 00:00:00 2001 From: Piotr Koziar Date: Fri, 16 May 2025 22:41:27 +0200 Subject: [PATCH] [nrf fromlist] modules: hal_nordic: nrf_802154: emit hfclk_ready with timer on nRF54LM20A Right now, the power_clock_irq is not available on nRF54LM20A. Since the onoff mechanism relies on the irq, the timer is used to emit the hfclk_ready callback. Upstream PR #: 90080 Signed-off-by: Piotr Koziar --- .../platform/nrf_802154_clock_zephyr.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) 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 87aa85261e9..3d18ad6077a 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 @@ -44,6 +44,19 @@ static void hfclk_on_callback(struct onoff_manager *mgr, } #if defined(CONFIG_CLOCK_CONTROL_NRF) + +#if defined(NRF54LM20A_ENGA_XXAA) +/* HF clock time to ramp-up. */ +#define MAX_HFXO_RAMP_UP_TIME_US 550 + +static void hfclk_started_timer_handler(struct k_timer *dummy) +{ + hfclk_on_callback(NULL, NULL, 0, 0); +} + +K_TIMER_DEFINE(hfclk_started_timer, hfclk_started_timer_handler, NULL); +#endif + void nrf_802154_clock_hfclk_start(void) { struct onoff_manager *mgr = @@ -64,6 +77,15 @@ void nrf_802154_clock_hfclk_start(void) int ret = onoff_request(mgr, &hfclk_cli); __ASSERT_NO_MSG(ret >= 0); (void)ret; + + #if defined(NRF54LM20A_ENGA_XXAA) + /* + * Right now, the power_clock_irq is not available on nRF54LM20A. + * Since the onoff mechanism relies on the irq, the timer is used + * to emit the hfclk_ready callback. + */ + k_timer_start(&hfclk_started_timer, K_USEC(MAX_HFXO_RAMP_UP_TIME_US), K_NO_WAIT); + #endif } void nrf_802154_clock_hfclk_stop(void)