Bluetooth: controller: Fix MRAM latency race condition on nRF54H20#22
Conversation
nrf54h20 cpurad bt_ll_sw_split support. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
FICR compile error fixed ECB compile error fixed SWI compile error fixed draft modification for radio Update radio.c due to miss some device check Signed-off-by: Jui-Chou Chung <jui-chou.chung@nordicsemi.no> Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added initial implementation for nrf54hx LF clock control. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added initial implementation for nrf54hx GRTC use for Radio. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added initial implementation for nrf54hx HF clock control. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added initial implementation for nrf54hx MRAM no latency control. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nRF54H20 cpuapp peripheral_hr quirks. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Co-authored-by: cvinayak <6350656+cvinayak@users.noreply.github.com>
Co-authored-by: cvinayak <6350656+cvinayak@users.noreply.github.com>
Co-authored-by: cvinayak <6350656+cvinayak@users.noreply.github.com>
| static void mram_no_latency_callback(struct onoff_manager *mgr, | ||
| struct onoff_client *cli, | ||
| uint32_t state, int res) | ||
| { | ||
| /* Mark that the MRAM no latency request has completed */ | ||
| atomic_set(&mram_no_latency_complete, 1); | ||
| } |
There was a problem hiding this comment.
@copilot add implementation to check state and res values.
There was a problem hiding this comment.
Added validation checks for state and res parameters in the callback using LL_ASSERT_DBG. The callback now verifies that res == 0 (success) and state == ONOFF_STATE_ON (on state). Commit: f3f0574
| /* Use callback-based notification instead of spinwait */ | ||
| sys_notify_init_callback(&mram_cli.notify, mram_no_latency_callback); | ||
|
|
||
| (void)mram_no_latency_request(&mram_cli); |
There was a problem hiding this comment.
Added check for the return value of mram_no_latency_request(). The function now stores the return value and validates that it's non-negative using LL_ASSERT_DBG(ret >= 0). Commit: f3f0574
| * if the callback hasn't fired within the timeout period. | ||
| */ | ||
|
|
||
| (void)mram_no_latency_cancel_or_release(&mram_cli); |
There was a problem hiding this comment.
Added check for the return value of mram_no_latency_cancel_or_release(). The function now stores the return value and validates that it's non-negative using LL_ASSERT_DBG(ret >= 0). Commit: f3f0574
…lback parameters Co-authored-by: cvinayak <6350656+cvinayak@users.noreply.github.com>
33ce3e3 to
ac07e93
Compare
0e0746d to
15252bd
Compare
636ae76 to
2582a3b
Compare
2582a3b to
29f739a
Compare
Summary
Successfully implemented callback-based MRAM no latency synchronization to fix race conditions when requests and releases happen in quick succession. The solution includes:
sys_notify_init_spinwait()withsys_notify_init_callback()to properly track request completionradio_stop()before calling cancel/releasearch_spin_relax()to avoid wasting CPU cyclesLL_ASSERT_DBGchecks for callback parameters and return valuesOriginal prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.