Skip to content

Commit 8e2f6a8

Browse files
ananglioannisg
authored andcommitted
trusted-firmware-m: platform: nrf5340: fix target configuration
Add configuration of the XL1/XL2 pins that can be done only from secure code. This configuration enables the low-frequency crystal oscillator (LFXO) functionality that may be required in the non-secure code image or in the network core firmware. Signed-off-by: Andrzej Głąbek <[email protected]> Change-Id: Ic2cb923aa6049fd37d10e857335354bde78fb50b Signed-off-by: Ioannis Glaropoulos <[email protected]>
1 parent b742e7c commit 8e2f6a8

File tree

1 file changed

+11
-0
lines changed
  • trusted-firmware-m/platform/ext/target/nordic_nrf/common/nrf5340

1 file changed

+11
-0
lines changed

trusted-firmware-m/platform/ext/target/nordic_nrf/common/nrf5340/target_cfg.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222

2323
#include <spu.h>
2424
#include <nrfx.h>
25+
#include <hal/nrf_gpio.h>
2526

27+
#define PIN_XL1 0
28+
#define PIN_XL2 1
2629

2730
struct tfm_spm_partition_platform_data_t tfm_peripheral_timer0 = {
2831
NRF_TIMER0_S_BASE,
@@ -270,6 +273,14 @@ enum tfm_plat_err_t spu_periph_init_cfg(void)
270273
spu_gpio_config_non_secure(0, false);
271274
spu_gpio_config_non_secure(1, false);
272275

276+
/* Configure properly the XL1 and XL2 pins so that the low-frequency crystal
277+
* oscillator (LFXO) can be used.
278+
* This configuration can be done only from secure code, as otherwise those
279+
* register fields are not accessible. That's why it is placed here.
280+
*/
281+
nrf_gpio_pin_mcu_select(PIN_XL1, NRF_GPIO_PIN_MCUSEL_PERIPHERAL);
282+
nrf_gpio_pin_mcu_select(PIN_XL2, NRF_GPIO_PIN_MCUSEL_PERIPHERAL);
283+
273284
return TFM_PLAT_ERR_SUCCESS;
274285
}
275286

0 commit comments

Comments
 (0)