Skip to content

Commit e2812b6

Browse files
travis3630Anton-TF
authored andcommitted
platform: nordic_nrf: nrf7120: Update nrf71_init.c
Add CONFIG_SOC_NRF71_WIFI_BOOT, so that ns sample does not start Wi-Fi, this is because wicr and lmac is initialised to some gibberish value when it is not loaded. Update nrf71_init.c to be the same with zephyr upstream. Change-Id: I74ab06bf54b6f7e7d41a6f7b3991b0db3b425ee6 Signed-off-by: Travis Lam <travis.lam@nordicsemi.no>
1 parent d2c6d1d commit e2812b6

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

platform/ext/target/nordic_nrf/common/nrf7120/nrf71_init.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,35 @@
1212
#define BIT_MASK(n) ((1UL << (n)) - 1UL)
1313
#endif
1414

15+
#define FLASH_PAGE_ERASE_MAX_TIME_US 42000UL
16+
#define FLASH_PAGE_MAX_CNT 381UL
17+
18+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pwr_antswc)
19+
20+
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(__NRF_TFM__)
21+
#define PWR_ANTSWC_REG (0x5010F780UL)
22+
#else /* CONFIG_TRUSTED_EXECUTION_NONSECURE */
23+
#define PWR_ANTSWC_REG (0x4010F780UL)
24+
#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE */
25+
26+
#define PWR_ANTSWC_ENABLE (0x3UL)
27+
#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pwr_antswc) */
28+
1529
/* This handler needs to be ported to the upstream TF-M project when Cracen is supported there.
1630
* The implementation of this is currently in sdk-nrf. We define it to avoid warnings when we build
1731
* the target_cfg.c file which is the same for both upsteam TF-M and sdk-nrf.
1832
* It is defined as weak to allow the sdk-nrf version to be used when available. */
1933
void __attribute__((weak)) CRACEN_IRQHandler(void){};
2034

35+
#if defined(CONFIG_SOC_NRF71_WIFI_BOOT)
2136
void __attribute__((weak)) wifi_setup(void){
2237
/* Kickstart the LMAC processor */
2338
NRF_WIFICORE_LRCCONF_LRC0->POWERON =
2439
(LRCCONF_POWERON_MAIN_AlwaysOn << LRCCONF_POWERON_MAIN_Pos);
2540
NRF_WIFICORE_LMAC_VPR->INITPC = NRF_WICR->RESERVED[0];
2641
NRF_WIFICORE_LMAC_VPR->CPURUN = (VPR_CPURUN_EN_Running << VPR_CPURUN_EN_Pos);
2742
}
43+
#endif
2844

2945
int __attribute__((weak)) soc_early_init_hook(void){
3046
/* Update the SystemCoreClock global variable with current core clock
@@ -33,7 +49,21 @@ int __attribute__((weak)) soc_early_init_hook(void){
3349
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(__NRF_TFM__)
3450
/* Currently not supported for non-secure */
3551
SystemCoreClockUpdate();
52+
53+
#if defined(CONFIG_SOC_NRF71_WIFI_BOOT)
3654
wifi_setup();
55+
#endif
56+
57+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pwr_antswc)
58+
*(volatile uint32_t *)PWR_ANTSWC_REG |= PWR_ANTSWC_ENABLE;
59+
#endif
60+
61+
/* Configure LFXO capacitive load if internal load capacitors are used */
62+
#if DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, internal)
63+
nrf_lfxo_cload_set(NRF_LFXO,
64+
(uint8_t)(DT_PROP(LFXO_NODE, load_capacitance_femtofarad) / 1000));
65+
#endif
66+
3767
#endif
3868
return 0;
3969
}

0 commit comments

Comments
 (0)