Browse Source

drivers: misc: nordic_vpr_launcher: move SoC-specific config to DT

Targets that require setting secure attribute to VPR should specify
it in devicetree.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
pull/90810/head
Marcin Szymczyk 3 months ago committed by Fabio Baltieri
parent
commit
b9d97aba21
  1. 13
      drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c
  2. 5
      dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml
  3. 1
      dts/vendor/nordic/nrf54l09.dtsi
  4. 1
      dts/vendor/nordic/nrf54l20.dtsi
  5. 1
      dts/vendor/nordic/nrf54l_05_10_15.dtsi

13
drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
#include <zephyr/toolchain.h>
#include <hal/nrf_vpr.h>
#if defined(CONFIG_SOC_NRF54L_CPUAPP_COMMON) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
#include <hal/nrf_spu.h>
#endif
@ -24,6 +24,7 @@ LOG_MODULE_REGISTER(nordic_vpr_launcher, CONFIG_NORDIC_VPR_LAUNCHER_LOG_LEVEL); @@ -24,6 +24,7 @@ LOG_MODULE_REGISTER(nordic_vpr_launcher, CONFIG_NORDIC_VPR_LAUNCHER_LOG_LEVEL);
struct nordic_vpr_launcher_config {
NRF_VPR_Type *vpr;
uintptr_t exec_addr;
bool enable_secure;
#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory)
uintptr_t src_addr;
size_t size;
@ -52,9 +53,12 @@ static int nordic_vpr_launcher_init(const struct device *dev) @@ -52,9 +53,12 @@ static int nordic_vpr_launcher_init(const struct device *dev)
}
#endif
#if defined(CONFIG_SOC_NRF54L_CPUAPP_COMMON) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
nrf_spu_periph_perm_secattr_set(NRF_SPU00, nrf_address_slave_get((uint32_t)config->vpr),
true);
#if DT_ANY_INST_HAS_BOOL_STATUS_OKAY(enable_secure) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
if (config->enable_secure) {
nrf_spu_periph_perm_secattr_set(NRF_SPU00,
nrf_address_slave_get((uint32_t)config->vpr),
true);
}
#endif
LOG_DBG("Launching VPR (%p) from %p", config->vpr, (void *)config->exec_addr);
nrf_vpr_initpc_set(config->vpr, config->exec_addr);
@ -81,6 +85,7 @@ static int nordic_vpr_launcher_init(const struct device *dev) @@ -81,6 +85,7 @@ static int nordic_vpr_launcher_init(const struct device *dev)
.vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \
IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, execution_memory), \
(.exec_addr = VPR_ADDR(DT_INST_PHANDLE(inst, execution_memory)),)) \
.enable_secure = DT_INST_PROP(inst, enable_secure), \
IF_ENABLED(NEEDS_COPYING(inst), \
(.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \
.size = DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)),))}; \

5
dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml

@ -25,3 +25,8 @@ properties: @@ -25,3 +25,8 @@ properties:
type: phandle
description: |
Memory area or partition from which the VPR code will be loaded.
enable-secure:
type: boolean
description: |
Enables setting VPR core's secure attribute to secure.

1
dts/vendor/nordic/nrf54l09.dtsi vendored

@ -146,6 +146,7 @@ @@ -146,6 +146,7 @@
#address-cells = <1>;
#size-cells = <1>;
status = "disabled";
enable-secure;
cpuflpr_clic: interrupt-controller@f0000000 {
compatible = "nordic,nrf-clic";

1
dts/vendor/nordic/nrf54l20.dtsi vendored

@ -141,6 +141,7 @@ @@ -141,6 +141,7 @@
#address-cells = <1>;
#size-cells = <1>;
status = "disabled";
enable-secure;
cpuflpr_clic: interrupt-controller@f0000000 {
compatible = "nordic,nrf-clic";

1
dts/vendor/nordic/nrf54l_05_10_15.dtsi vendored

@ -165,6 +165,7 @@ @@ -165,6 +165,7 @@
#address-cells = <1>;
#size-cells = <1>;
status = "disabled";
enable-secure;
cpuflpr_clic: interrupt-controller@f0000000 {
compatible = "nordic,nrf-clic";

Loading…
Cancel
Save