USBD + onoff_request on nRF54LM20 = spin forever

Hi,

When configuring an nRF54LM20A for usb and then using the `onoff_request()` API to enable the HFCLK after that, results in spinning sys_notify_fetch_result() forever.
If I disable the USB config, there's no problem (but still the HFCLK is still enabled by something else).

Root cause traced: on LM20 NRF_CLOCK_HAS_XO_TUNE=1, Zephyr's clock driver (external/zephyr/drivers/clock_control/clock_control_nrf.c:715-728) completes HF
onoff only on EVENTS_XOTUNED. nrfx_clock_xo_start() triggers TASKS_HFCLKSTART, which — per nrf54lm20a_types.h:1668 — auto-generates XOTUNED only on a fresh HFXO start. If HFXO was already running (USB bring-up did it), the task is a no-op, XOTUNED never fires, the first transition stays in ONOFF_STATE_TO_ON forever, and every subsequent onoff_request queues behind it.

From an instrumented boot:

A) With USB enabled:

[hf_req] pre XO.RUN=0x00000001 XO.STAT=0x00010001 PLL.RUN=0x00000001 PLL.STAT=0x00010000 EVENTS_XOSTARTED=0 EVENTS_PLLSTARTED=1 EVENTS_XOTUNED=0 INTENSET=0x00000070
[hf_req] request=6
[hf_req] spin iter=0 XO.RUN=0x00000001 XO.STAT=0x00010001 PLL.RUN=0x00000001 PLL.STAT=0x00010000 EVENTS_XOSTARTED=0 EVENTS_XOTUNED=0 EVENTS_PLLSTARTED=1 INTENSET=0x00000070 INTPEND=0x00000000 ISER[0..2]=00000000 00000000 04002000 ISPR[0..2]=00000000 00000000 00000000 PRIMASK=0x0 BASEPRI=0x0
[hf_req] done iter=1000 dt_us=1932 // CLIPPED at 1000 iterations...


-> With USB HID init enabled: request=6 (TO_ON), spin forever.

B) Without USB:

[hf_req] pre XO.RUN=0x00000001 XO.STAT=0x00010001 PLL.RUN=0x00000001 PLL.STAT=0x00010000 EVENTS_XOSTARTED=0 EVENTS_PLLSTARTED=1 EVENTS_XOTUNED=0 INTENSET=0x00000068
[hf_req] request=2 (ONOFF_FLAG_ONOFF)
[hf_req] done iter=0 dt_us=1

-> With USBHID init disabled: request=2 (ON, cleanly), done iter=0 dt_us=1.

It seems like there's something in the onoff / clock control API that isn't working correctly on the new nRF54LM20. 

Related