Skip to content

Commit e2cb1f9

Browse files
committed
[nrf fromlist] boards: nrf53: config EXTDOMAIN in soc to reduce code duplication
Configure the "cpunet" to be secure from the soc system initialization to avoid code duplication across all the boards. cpunet is now configured to be secure earlier in the boot process, from POST_KERNEL to PRE_KERNEL, but AFAIK this is not a problem. Signed-off-by: Sebastian Bøe <[email protected]>
1 parent 6259caf commit e2cb1f9

File tree

9 files changed

+11
-54
lines changed

9 files changed

+11
-54
lines changed

boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,10 @@ static void remoteproc_mgr_config(void)
2626
/* Route Bluetooth Controller Debug Pins */
2727
DEBUG_SETUP();
2828
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */
29-
30-
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
31-
/* Retain nRF5340 Network MCU in Secure domain (bus
32-
* accesses by Network MCU will have Secure attribute set).
33-
*/
34-
NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4;
35-
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
3629
}
3730

3831
static int remoteproc_mgr_boot(void)
3932
{
40-
4133
/* Secure domain may configure permissions for the Network MCU. */
4234
remoteproc_mgr_config();
4335

boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,12 @@ static void remoteproc_mgr_config(void)
4040
/* Route Bluetooth Controller Debug Pins */
4141
DEBUG_SETUP();
4242
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */
43-
44-
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
45-
/* Retain nRF5340 Network MCU in Secure domain (bus
46-
* accesses by Network MCU will have Secure attribute set).
47-
*/
48-
NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4;
49-
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
5043
}
5144

5245
static int remoteproc_mgr_boot(void)
5346
{
5447
int ret;
5548

56-
5749
ret = core_config();
5850
if (ret) {
5951
return ret;

boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ static void remoteproc_mgr_config(void)
2525
/* Route Bluetooth Controller Debug Pins */
2626
DEBUG_SETUP();
2727
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */
28-
29-
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
30-
/* Retain nRF5340 Network MCU in Secure domain (bus
31-
* accesses by Network MCU will have Secure attribute set).
32-
*/
33-
NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4;
34-
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
3528
}
3629

3730
static int remoteproc_mgr_boot(void)

boards/nordic/thingy53/board.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ BUILD_ASSERT(CONFIG_THINGY53_INIT_PRIORITY < CONFIG_SENSOR_INIT_PRIORITY,
3636

3737
static void enable_cpunet(void)
3838
{
39-
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
40-
/* Retain nRF5340 Network MCU in Secure domain (bus
41-
* accesses by Network MCU will have Secure attribute set).
42-
*/
43-
NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4;
44-
#endif /* !CONFIG_TRUSTED_EXECUTION_NONSECURE */
45-
4639
#if !defined(CONFIG_TRUSTED_EXECUTION_SECURE)
4740
/*
4841
* Building Zephyr with CONFIG_TRUSTED_EXECUTION_SECURE=y implies

boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ static void remoteproc_mgr_config(void)
3131
{
3232
/* Route Bluetooth Controller Debug Pins */
3333
DEBUG_SETUP();
34-
35-
/* Retain nRF5340 Network MCU */
36-
NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4;
3734
}
3835

3936
static int remoteproc_mgr_boot(void)

boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ static void remoteproc_mgr_config(void)
2626
/* Route Bluetooth Controller Debug Pins */
2727
DEBUG_SETUP();
2828
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */
29-
30-
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
31-
/* Retain nRF5340 Network MCU in Secure domain (bus
32-
* accesses by Network MCU will have Secure attribute set).
33-
*/
34-
NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4;
35-
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
3629
}
3730

3831
static int remoteproc_mgr_boot(const struct device *dev)

boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ static void remoteproc_mgr_config(void)
2525
/* Route Bluetooth Controller Debug Pins */
2626
DEBUG_SETUP();
2727
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */
28-
29-
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
30-
/* Retain nRF5340 Network MCU in Secure domain (bus
31-
* accesses by Network MCU will have Secure attribute set).
32-
*/
33-
NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4;
34-
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
3528
}
3629

3730
static int remoteproc_mgr_boot(const struct device *dev)

drivers/bluetooth/hci/nrf53_support.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ int bt_hci_transport_setup(const struct device *dev)
3535
DEBUG_SETUP();
3636
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */
3737

38-
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
39-
/* Retain nRF5340 Network MCU in Secure domain (bus
40-
* accesses by Network MCU will have Secure attribute set).
41-
*/
42-
NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4;
43-
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
44-
4538
/* Release the Network MCU, 'Release force off signal' */
4639
nrf53_cpunet_enable(true);
4740

soc/nordic/nrf53/soc.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,17 @@ static int nordicsemi_nrf53_init(void)
563563
nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_HIGH, true);
564564
#endif
565565

566+
#if defined(NRF_SPU) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
567+
/* Retain nRF5340 Network MCU in Secure domain (bus
568+
* accesses by Network MCU will have Secure attribute set).
569+
*
570+
* Note that this source file is also used for the network core,
571+
* which doesn't have an SPU, so we ifdef on NRF_SPU being
572+
* available.
573+
*/
574+
NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4;
575+
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
576+
566577
#if defined(CONFIG_SOC_NRF_GPIO_FORWARDER_FOR_NRF5340)
567578
static const uint8_t forwarded_psels[] = {
568579
DT_FOREACH_STATUS_OKAY(nordic_nrf_gpio_forwarder, ALL_GPIOS_IN_FORWARDER)

0 commit comments

Comments
 (0)