42
42
#include <hal/nrf_power.h>
43
43
#endif /* NRF54L_ERRATA_20_PRESENT */
44
44
45
- #define NRF54H20_ERRATA_216_PRESENT \
46
- DT_NODE_HAS_STATUS(DT_NODELABEL(cpurad_cpusys_errata216_mboxes), okay)
47
-
48
- #if NRF54H20_ERRATA_216_PRESENT
45
+ #if NRF54H_ERRATA_216_PRESENT
49
46
#include <zephyr/drivers/mbox.h>
50
-
51
- /* Delay time from triggering the task "ON" for SysCtrl to starting RADIO (setting RADIO TASK RXEN
52
- * or TXEN)
53
- */
54
- #define HMPAN_216_DELAY_US (40)
55
- #endif /* NRF54H20_ERRATA_216_PRESENT */
47
+ #endif /* NRF54H_ERRATA_216_PRESENT */
56
48
57
49
#if defined(CONFIG_SOC_SERIES_NRF54HX )
58
50
#define DEFAULT_TIMER_INSTANCE 020
@@ -455,12 +447,19 @@ static struct dtm_instance {
455
447
#endif
456
448
};
457
449
458
- #if NRF54H20_ERRATA_216_PRESENT
450
+ #if NRF54H_ERRATA_216_PRESENT
459
451
static const struct mbox_dt_spec on_channel =
460
452
MBOX_DT_SPEC_GET (DT_NODELABEL (cpurad_cpusys_errata216_mboxes ), on_req );
461
453
static const struct mbox_dt_spec off_channel =
462
454
MBOX_DT_SPEC_GET (DT_NODELABEL (cpurad_cpusys_errata216_mboxes ), off_req );
463
- static K_SEM_DEFINE (errata216_sem , 0 , 1 ) ;
455
+ #endif /* NRF54H_ERRATA_216_PRESENT */
456
+
457
+ /* Delay time from triggering the task "ON" for SysCtrl to starting RADIO (setting RADIO TASK RXEN
458
+ * or TXEN)
459
+ */
460
+ #define HMPAN_216_DELAY_US (40)
461
+
462
+ static K_SEM_DEFINE (errata_216_sem , 0 , 1 ) ;
464
463
465
464
/**
466
465
* @brief Send errata HMPAN-216 on request signal to SysCtrl
@@ -472,8 +471,12 @@ static K_SEM_DEFINE(errata216_sem, 0, 1);
472
471
*
473
472
* @return 0 if successful, otherwise a negative error code
474
473
*/
475
- static int errata216_on_wait (void )
474
+ static int errata_216_on_wait (void )
476
475
{
476
+ if (!nrf54h_errata_216 ()) {
477
+ return 0 ;
478
+ }
479
+
477
480
int err = 0 ;
478
481
479
482
nrfx_timer_disable (& dtm_inst .timer );
@@ -485,13 +488,15 @@ static int errata216_on_wait(void)
485
488
nrfx_timer_us_to_ticks (& dtm_inst .timer , HMPAN_216_DELAY_US ),
486
489
true);
487
490
491
+ #if NRF54H_ERRATA_216_PRESENT
488
492
err = mbox_send_dt (& on_channel , NULL );
493
+ #endif /* NRF54H_ERRATA_216_PRESENT */
489
494
490
495
if (!err ) {
491
496
nrfx_timer_enable (& dtm_inst .timer );
492
497
493
498
/* Wait for the TIMER to count the required delay before starting the Radio*/
494
- err = k_sem_take (& errata216_sem , K_FOREVER );
499
+ err = k_sem_take (& errata_216_sem , K_FOREVER );
495
500
}
496
501
497
502
return err ;
@@ -506,37 +511,33 @@ static int errata216_on_wait(void)
506
511
*
507
512
* @return 0 if successful, otherwise a negative error code
508
513
*/
509
- static int errata216_off (void )
514
+ static int errata_216_off (void )
510
515
{
516
+ if (!nrf54h_errata_216 ()) {
517
+ return 0 ;
518
+ }
519
+
520
+ #if NRF54H_ERRATA_216_PRESENT
511
521
return mbox_send_dt (& off_channel , NULL );
522
+ #else
523
+ return 0 ;
524
+ #endif /* NRF54H_ERRATA_216_PRESENT */
512
525
}
513
526
514
527
/**
515
528
* @brief Return to code execution after the required delay for errata HMPAN-216 has elapsed.
516
529
*/
517
- static void errata216_release (void )
530
+ static void errata_216_release (void )
518
531
{
519
- /* Release the waiting semaphore, coninue code execution and disable TIMER */
520
- k_sem_give (& errata216_sem );
532
+ if (!nrf54h_errata_216 ()) {
533
+ return ;
534
+ }
535
+
536
+ /* Release the waiting semaphore, continue code execution and disable TIMER */
537
+ k_sem_give (& errata_216_sem );
521
538
nrfx_timer_disable (& dtm_inst .timer );
522
539
nrf_timer_int_disable (dtm_inst .timer .p_reg , ~0 );
523
540
}
524
- #else
525
- static int errata216_on_wait (void )
526
- {
527
- return 0 ;
528
- }
529
-
530
- static int errata216_off (void )
531
- {
532
- return 0 ;
533
- }
534
-
535
- static void errata216_release (void )
536
- {
537
- /* Do nothing */
538
- }
539
- #endif /* NRF54H20_ERRATA_216_PRESENT */
540
541
541
542
/* The PRBS9 sequence used as packet payload.
542
543
* The bytes in the sequence is in the right order, but the bits of each byte
@@ -1879,7 +1880,7 @@ static int dtm_vendor_specific_pkt(uint32_t vendor_cmd, uint32_t vendor_option)
1879
1880
case CARRIER_TEST :
1880
1881
case CARRIER_TEST_STUDIO :
1881
1882
/* Send the nRF54H20 errata 216 on signal */
1882
- if (errata216_on_wait ()) {
1883
+ if (errata_216_on_wait ()) {
1883
1884
printk ("Failed to send errata HMPAN-216 on signal\n" );
1884
1885
}
1885
1886
@@ -2371,7 +2372,7 @@ int dtm_test_receive(uint8_t channel)
2371
2372
memset (& dtm_inst .pdu , 0 , sizeof (dtm_inst .pdu ));
2372
2373
2373
2374
/* Send the nRF54H20 errata 216 on signal */
2374
- if (errata216_on_wait ()) {
2375
+ if (errata_216_on_wait ()) {
2375
2376
printk ("Failed to send errata HMPAN-216 on signal\n" );
2376
2377
}
2377
2378
@@ -2529,7 +2530,7 @@ int dtm_test_transmit(uint8_t channel, uint8_t length, enum dtm_packet pkt)
2529
2530
}
2530
2531
2531
2532
/* Send the nRF54H20 errata 216 on signal */
2532
- if (errata216_on_wait ()) {
2533
+ if (errata_216_on_wait ()) {
2533
2534
printk ("Failed to send errata HMPAN-216 on signal\n" );
2534
2535
}
2535
2536
@@ -2582,7 +2583,7 @@ int dtm_test_end(uint16_t *pack_cnt)
2582
2583
dtm_test_done ();
2583
2584
2584
2585
/* Send the nRF54H20 errata 216 off signal */
2585
- if (errata216_off ()) {
2586
+ if (errata_216_off ()) {
2586
2587
printk ("Failed to send errata HMPAN-216 off signal\n" );
2587
2588
}
2588
2589
@@ -2698,7 +2699,7 @@ static void dtm_timer_handler(nrf_timer_event_t event_type, void *context)
2698
2699
* errata workaround for nRF54H20 SoCs
2699
2700
*/
2700
2701
if (event_type == NRF_TIMER_EVENT_COMPARE1 ) {
2701
- errata216_release ();
2702
+ errata_216_release ();
2702
2703
} else {
2703
2704
/* Do nothing */
2704
2705
}
0 commit comments