drivers: mbox: nrf: Change VEVIFs and BELLBOARD nomenclature

Renaming 'LOCAL' to 'RX' and 'REMOTE' to 'TX'.
This seems more descriptive and intuitive to use.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
This commit is contained in:
Jakub Zymelka 2024-05-22 13:26:25 +02:00 committed by Anas Nashif
parent c7b36517ec
commit 8091e93838
17 changed files with 314 additions and 281 deletions

View file

@ -10,10 +10,10 @@ zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_S32_MRU mbox_nxp_s32_mru.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_IMX_MU mbox_nxp_imx_mu.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_IMX_MU mbox_nxp_imx_mu.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_MAILBOX mbox_nxp_mailbox.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_MAILBOX mbox_nxp_mailbox.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_ANDES_PLIC_SW mbox_andes_plic_sw.c) zephyr_library_sources_ifdef(CONFIG_MBOX_ANDES_PLIC_SW mbox_andes_plic_sw.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_LOCAL mbox_nrf_vevif_local.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_TASK_RX mbox_nrf_vevif_task_rx.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_REMOTE mbox_nrf_vevif_remote.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_TASK_TX mbox_nrf_vevif_task_tx.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_EVENT_RX mbox_nrf_vevif_event_rx.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_EVENT_RX mbox_nrf_vevif_event_rx.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_EVENT_TX mbox_nrf_vevif_event_tx.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_EVENT_TX mbox_nrf_vevif_event_tx.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_LOCAL mbox_nrf_bellboard_local.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_RX mbox_nrf_bellboard_rx.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_REMOTE mbox_nrf_bellboard_remote.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_TX mbox_nrf_bellboard_tx.c)
zephyr_library_sources_ifdef(CONFIG_MBOX_STM32_HSEM mbox_stm32_hsem.c) zephyr_library_sources_ifdef(CONFIG_MBOX_STM32_HSEM mbox_stm32_hsem.c)

View file

@ -17,7 +17,7 @@ source "drivers/mbox/Kconfig.nxp_s32"
source "drivers/mbox/Kconfig.nxp_imx" source "drivers/mbox/Kconfig.nxp_imx"
source "drivers/mbox/Kconfig.nxp_mailbox" source "drivers/mbox/Kconfig.nxp_mailbox"
source "drivers/mbox/Kconfig.andes" source "drivers/mbox/Kconfig.andes"
source "drivers/mbox/Kconfig.nrf_vevif" source "drivers/mbox/Kconfig.nrf_vevif_task"
source "drivers/mbox/Kconfig.nrf_vevif_event" source "drivers/mbox/Kconfig.nrf_vevif_event"
source "drivers/mbox/Kconfig.nrf_bellboard" source "drivers/mbox/Kconfig.nrf_bellboard"
source "drivers/mbox/Kconfig.stm32_hsem" source "drivers/mbox/Kconfig.stm32_hsem"

View file

@ -1,16 +1,16 @@
# Copyright (c) 2024 Nordic Semiconductor ASA # Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
config MBOX_NRF_BELLBOARD_LOCAL config MBOX_NRF_BELLBOARD_RX
bool "nRF BELLBOARD local driver" bool "nRF BELLBOARD RX driver"
depends on DT_HAS_NORDIC_NRF_BELLBOARD_LOCAL_ENABLED depends on DT_HAS_NORDIC_NRF_BELLBOARD_RX_ENABLED
default y default y
help help
Mailbox driver for local Nordic nRF BELLBOARD Mailbox driver for RX Nordic nRF BELLBOARD
config MBOX_NRF_BELLBOARD_REMOTE config MBOX_NRF_BELLBOARD_TX
bool "nRF BELLBOARD remote driver" bool "nRF BELLBOARD TX driver"
depends on DT_HAS_NORDIC_NRF_BELLBOARD_REMOTE_ENABLED depends on DT_HAS_NORDIC_NRF_BELLBOARD_TX_ENABLED
default y default y
help help
Mailbox driver for remote Nordic nRF BELLBOARD Mailbox driver for TX Nordic nRF BELLBOARD

View file

@ -1,16 +0,0 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
config MBOX_NRF_VEVIF_LOCAL
bool "nRF VEVIF local driver"
depends on DT_HAS_NORDIC_NRF_VEVIF_LOCAL_ENABLED
default y
help
Mailbox driver for local Nordic nRF VEVIF (VPR Event Interface)
config MBOX_NRF_VEVIF_REMOTE
bool "nRF VEVIF remote driver"
depends on DT_HAS_NORDIC_NRF_VEVIF_REMOTE_ENABLED
default y
help
Mailbox driver for remote Nordic nRF VEVIF (VPR Event Interface)

View file

@ -0,0 +1,16 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
config MBOX_NRF_VEVIF_TASK_RX
bool "nRF VEVIF task RX driver"
depends on DT_HAS_NORDIC_NRF_VEVIF_TASK_RX_ENABLED
default y
help
Mailbox driver for receiving VEVIF tasks on VPR as CLIC interrupts
config MBOX_NRF_VEVIF_TASK_TX
bool "nRF VEVIF task TX driver"
depends on DT_HAS_NORDIC_NRF_VEVIF_TASK_TX_ENABLED
default y
help
Mailbox driver for transmitting VEVIF tasks to VPR as CLIC interrupts

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#define DT_DRV_COMPAT nordic_nrf_bellboard_local #define DT_DRV_COMPAT nordic_nrf_bellboard_rx
#include <zephyr/devicetree.h> #include <zephyr/devicetree.h>
#include <zephyr/drivers/mbox.h> #include <zephyr/drivers/mbox.h>
@ -37,7 +37,7 @@ static mbox_callback_t cbs[NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT];
static void *cbs_ctx[NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT]; static void *cbs_ctx[NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT];
static uint32_t evt_enabled_masks[BELLBOARD_NUM_IRQS]; static uint32_t evt_enabled_masks[BELLBOARD_NUM_IRQS];
static void bellboard_local_isr(const void *parameter) static void bellboard_rx_isr(const void *parameter)
{ {
uint8_t irq_idx = (uint8_t)(uintptr_t)parameter; uint8_t irq_idx = (uint8_t)(uintptr_t)parameter;
uint32_t int_pend; uint32_t int_pend;
@ -59,15 +59,15 @@ static void bellboard_local_isr(const void *parameter)
} }
} }
static uint32_t bellboard_local_max_channels_get(const struct device *dev) static uint32_t bellboard_rx_max_channels_get(const struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT; return NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT;
} }
static int bellboard_local_register_callback(const struct device *dev, uint32_t id, static int bellboard_rx_register_callback(const struct device *dev, uint32_t id, mbox_callback_t cb,
mbox_callback_t cb, void *user_data) void *user_data)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
@ -81,7 +81,7 @@ static int bellboard_local_register_callback(const struct device *dev, uint32_t
return 0; return 0;
} }
static int bellboard_local_set_enabled(const struct device *dev, uint32_t id, bool enable) static int bellboard_rx_set_enabled(const struct device *dev, uint32_t id, bool enable)
{ {
bool valid_found = false; bool valid_found = false;
@ -125,21 +125,21 @@ static int bellboard_local_set_enabled(const struct device *dev, uint32_t id, bo
return 0; return 0;
} }
static const struct mbox_driver_api bellboard_local_driver_api = { static const struct mbox_driver_api bellboard_rx_driver_api = {
.max_channels_get = bellboard_local_max_channels_get, .max_channels_get = bellboard_rx_max_channels_get,
.register_callback = bellboard_local_register_callback, .register_callback = bellboard_rx_register_callback,
.set_enabled = bellboard_local_set_enabled, .set_enabled = bellboard_rx_set_enabled,
}; };
#define BELLBOARD_IRQ_CONFIGURE(name, idx) \ #define BELLBOARD_IRQ_CONFIGURE(name, idx) \
COND_CODE_1(DT_INST_IRQ_HAS_NAME(0, name), \ COND_CODE_1(DT_INST_IRQ_HAS_NAME(0, name), \
(IRQ_CONNECT(DT_INST_IRQ_BY_NAME(0, name, irq), \ (IRQ_CONNECT(DT_INST_IRQ_BY_NAME(0, name, irq), \
DT_INST_IRQ_BY_NAME(0, name, priority), bellboard_local_isr, \ DT_INST_IRQ_BY_NAME(0, name, priority), bellboard_rx_isr, \
(const void *)idx, 0); \ (const void *)idx, 0); \
irq_enable(DT_INST_IRQ_BY_NAME(0, name, irq));), \ irq_enable(DT_INST_IRQ_BY_NAME(0, name, irq));), \
()) ())
static int bellboard_local_init(const struct device *dev) static int bellboard_rx_init(const struct device *dev)
{ {
uint32_t evt_all_mappings = uint32_t evt_all_mappings =
evt_mappings[0] | evt_mappings[1] | evt_mappings[2] | evt_mappings[3]; evt_mappings[0] | evt_mappings[1] | evt_mappings[2] | evt_mappings[3];
@ -165,5 +165,5 @@ static int bellboard_local_init(const struct device *dev)
return 0; return 0;
} }
DEVICE_DT_INST_DEFINE(0, bellboard_local_init, NULL, NULL, NULL, POST_KERNEL, DEVICE_DT_INST_DEFINE(0, bellboard_rx_init, NULL, NULL, NULL, POST_KERNEL,
CONFIG_MBOX_INIT_PRIORITY, &bellboard_local_driver_api); CONFIG_MBOX_INIT_PRIORITY, &bellboard_rx_driver_api);

View file

@ -3,20 +3,20 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#define DT_DRV_COMPAT nordic_nrf_bellboard_remote #define DT_DRV_COMPAT nordic_nrf_bellboard_tx
#include <zephyr/devicetree.h> #include <zephyr/devicetree.h>
#include <zephyr/drivers/mbox.h> #include <zephyr/drivers/mbox.h>
#include <haly/nrfy_bellboard.h> #include <haly/nrfy_bellboard.h>
struct mbox_bellboard_remote_conf { struct mbox_bellboard_tx_conf {
NRF_BELLBOARD_Type *bellboard; NRF_BELLBOARD_Type *bellboard;
}; };
static int bellboard_remote_send(const struct device *dev, uint32_t id, const struct mbox_msg *msg) static int bellboard_tx_send(const struct device *dev, uint32_t id, const struct mbox_msg *msg)
{ {
const struct mbox_bellboard_remote_conf *config = dev->config; const struct mbox_bellboard_tx_conf *config = dev->config;
if (id >= BELLBOARD_TASKS_TRIGGER_MaxCount) { if (id >= BELLBOARD_TASKS_TRIGGER_MaxCount) {
return -EINVAL; return -EINVAL;
@ -31,32 +31,32 @@ static int bellboard_remote_send(const struct device *dev, uint32_t id, const st
return 0; return 0;
} }
static int bellboard_remote_mtu_get(const struct device *dev) static int bellboard_tx_mtu_get(const struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return 0; return 0;
} }
static uint32_t bellboard_remote_max_channels_get(const struct device *dev) static uint32_t bellboard_tx_max_channels_get(const struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return BELLBOARD_TASKS_TRIGGER_MaxCount; return BELLBOARD_TASKS_TRIGGER_MaxCount;
} }
static const struct mbox_driver_api bellboard_remote_driver_api = { static const struct mbox_driver_api bellboard_tx_driver_api = {
.send = bellboard_remote_send, .send = bellboard_tx_send,
.mtu_get = bellboard_remote_mtu_get, .mtu_get = bellboard_tx_mtu_get,
.max_channels_get = bellboard_remote_max_channels_get, .max_channels_get = bellboard_tx_max_channels_get,
}; };
#define BELLBOARD_REMOTE_DEFINE(inst) \ #define BELLBOARD_REMOTE_DEFINE(inst) \
static const struct mbox_bellboard_remote_conf conf##inst = { \ static const struct mbox_bellboard_tx_conf conf##inst = { \
.bellboard = (NRF_BELLBOARD_Type *)DT_INST_REG_ADDR(inst), \ .bellboard = (NRF_BELLBOARD_Type *)DT_INST_REG_ADDR(inst), \
}; \ }; \
\ \
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \
CONFIG_MBOX_INIT_PRIORITY, &bellboard_remote_driver_api); CONFIG_MBOX_INIT_PRIORITY, &bellboard_tx_driver_api);
DT_INST_FOREACH_STATUS_OKAY(BELLBOARD_REMOTE_DEFINE) DT_INST_FOREACH_STATUS_OKAY(BELLBOARD_REMOTE_DEFINE)

View file

@ -1,122 +0,0 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nordic_nrf_vevif_local
#include <zephyr/devicetree.h>
#include <zephyr/drivers/mbox.h>
#include <hal/nrf_vpr.h>
#include <hal/nrf_vpr_csr.h>
#include <hal/nrf_vpr_csr_vevif.h>
#define VEVIF_TASKS_NUM DT_INST_PROP(0, nordic_tasks)
#define VEVIF_TASKS_MASK DT_INST_PROP(0, nordic_tasks_mask)
BUILD_ASSERT(VEVIF_TASKS_NUM <= VPR_TASKS_TRIGGER_MaxCount, "Number of tasks exceeds maximum");
BUILD_ASSERT(VEVIF_TASKS_NUM == DT_NUM_IRQS(DT_DRV_INST(0)), "# IRQs != # tasks");
/* callbacks */
struct mbox_vevif_local_cbs {
mbox_callback_t cb[VEVIF_TASKS_NUM];
void *user_data[VEVIF_TASKS_NUM];
uint32_t enabled_mask;
};
static struct mbox_vevif_local_cbs cbs;
/* IRQ list */
#define VEVIF_IRQN(idx, _) DT_INST_IRQ_BY_IDX(0, idx, irq)
static const uint8_t vevif_irqs[VEVIF_TASKS_NUM] = {
LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), VEVIF_IRQN, (,))
};
static void vevif_local_isr(const void *parameter)
{
uint8_t id = *(uint8_t *)parameter;
nrf_vpr_csr_vevif_tasks_clear(BIT(id));
if (cbs.cb[id] != NULL) {
cbs.cb[id](DEVICE_DT_INST_GET(0), id, cbs.user_data[id], NULL);
}
}
static inline bool vevif_local_is_task_valid(uint32_t id)
{
return (id < VEVIF_TASKS_NUM) && ((VEVIF_TASKS_MASK & BIT(id)) != 0U);
}
static uint32_t vevif_local_max_channels_get(const struct device *dev)
{
ARG_UNUSED(dev);
return VEVIF_TASKS_NUM;
}
static int vevif_local_register_callback(const struct device *dev, uint32_t id, mbox_callback_t cb,
void *user_data)
{
ARG_UNUSED(dev);
if (!vevif_local_is_task_valid(id)) {
return -EINVAL;
}
cbs.cb[id] = cb;
cbs.user_data[id] = user_data;
return 0;
}
static int vevif_local_set_enabled(const struct device *dev, uint32_t id, bool enable)
{
ARG_UNUSED(dev);
if (!vevif_local_is_task_valid(id)) {
return -EINVAL;
}
if (enable) {
if ((cbs.enabled_mask & BIT(id)) != 0U) {
return -EALREADY;
}
cbs.enabled_mask |= BIT(id);
irq_enable(vevif_irqs[id]);
} else {
if ((cbs.enabled_mask & BIT(id)) == 0U) {
return -EALREADY;
}
cbs.enabled_mask &= ~BIT(id);
irq_disable(vevif_irqs[id]);
}
return 0;
}
static const struct mbox_driver_api vevif_local_driver_api = {
.max_channels_get = vevif_local_max_channels_get,
.register_callback = vevif_local_register_callback,
.set_enabled = vevif_local_set_enabled,
};
#define VEVIF_IRQ_CONNECT(idx, _) \
IRQ_CONNECT(DT_INST_IRQ_BY_IDX(0, idx, irq), DT_INST_IRQ_BY_IDX(0, idx, priority), \
vevif_local_isr, &vevif_irqs[idx], 0)
static int vevif_local_init(const struct device *dev)
{
nrf_vpr_csr_vevif_tasks_clear(NRF_VPR_TASK_TRIGGER_ALL_MASK);
LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), VEVIF_IRQ_CONNECT, (;));
return 0;
}
DEVICE_DT_INST_DEFINE(0, vevif_local_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_MBOX_INIT_PRIORITY,
&vevif_local_driver_api);

View file

@ -0,0 +1,133 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nordic_nrf_vevif_task_rx
#include <zephyr/devicetree.h>
#include <zephyr/drivers/mbox.h>
#include <hal/nrf_vpr.h>
#include <hal/nrf_vpr_csr.h>
#include <hal/nrf_vpr_csr_vevif.h>
#if defined(CONFIG_SOC_NRF54L15_ENGA_CPUFLPR)
#define TASKS_IDX_MIN 11U
#define TASKS_IDX_MAX 17U
#else
#define TASKS_IDX_MIN NRF_VPR_TASKS_TRIGGER_MIN
#define TASKS_IDX_MAX NRF_VPR_TASKS_TRIGGER_MAX
#endif
#define VEVIF_TASKS_NUM DT_INST_PROP(0, nordic_tasks)
#define VEVIF_TASKS_MASK DT_INST_PROP(0, nordic_tasks_mask)
BUILD_ASSERT(VEVIF_TASKS_NUM <= VPR_TASKS_TRIGGER_MaxCount, "Number of tasks exceeds maximum");
BUILD_ASSERT(VEVIF_TASKS_NUM == DT_NUM_IRQS(DT_DRV_INST(0)), "# IRQs != # tasks");
/* callbacks */
struct mbox_vevif_task_rx_cbs {
mbox_callback_t cb[TASKS_IDX_MAX - TASKS_IDX_MIN + 1U];
void *user_data[TASKS_IDX_MAX - TASKS_IDX_MIN + 1U];
uint32_t enabled_mask;
};
static struct mbox_vevif_task_rx_cbs cbs;
/* IRQ list */
#define VEVIF_IRQN(idx, _) DT_INST_IRQ_BY_IDX(0, idx, irq)
static const uint8_t vevif_irqs[VEVIF_TASKS_NUM] = {
LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), VEVIF_IRQN, (,))
};
static void vevif_task_rx_isr(const void *parameter)
{
uint8_t channel = *(uint8_t *)parameter;
uint8_t idx = channel - TASKS_IDX_MIN;
nrf_vpr_csr_vevif_tasks_clear(BIT(channel));
if (cbs.cb[idx] != NULL) {
cbs.cb[idx](DEVICE_DT_INST_GET(0), channel, cbs.user_data[idx], NULL);
}
}
static inline bool vevif_task_rx_is_task_valid(uint32_t id)
{
return ((id <= TASKS_IDX_MAX) && ((VEVIF_TASKS_MASK & BIT(id)) != 0U));
}
static uint32_t vevif_task_rx_max_channels_get(const struct device *dev)
{
ARG_UNUSED(dev);
return VEVIF_TASKS_NUM;
}
static int vevif_task_rx_register_callback(const struct device *dev, uint32_t id,
mbox_callback_t cb, void *user_data)
{
ARG_UNUSED(dev);
uint8_t idx = id - TASKS_IDX_MIN;
if (!vevif_task_rx_is_task_valid(id)) {
return -EINVAL;
}
cbs.cb[idx] = cb;
cbs.user_data[idx] = user_data;
return 0;
}
static int vevif_task_rx_set_enabled(const struct device *dev, uint32_t id, bool enable)
{
ARG_UNUSED(dev);
uint8_t idx = id - TASKS_IDX_MIN;
if (!vevif_task_rx_is_task_valid(id)) {
return -EINVAL;
}
if (enable) {
if ((cbs.enabled_mask & BIT(id)) != 0U) {
return -EALREADY;
}
cbs.enabled_mask |= BIT(id);
irq_enable(vevif_irqs[idx]);
} else {
if ((cbs.enabled_mask & BIT(id)) == 0U) {
return -EALREADY;
}
cbs.enabled_mask &= ~BIT(id);
irq_disable(vevif_irqs[idx]);
}
return 0;
}
static const struct mbox_driver_api vevif_task_rx_driver_api = {
.max_channels_get = vevif_task_rx_max_channels_get,
.register_callback = vevif_task_rx_register_callback,
.set_enabled = vevif_task_rx_set_enabled,
};
#define VEVIF_IRQ_CONNECT(idx, _) \
IRQ_CONNECT(DT_INST_IRQ_BY_IDX(0, idx, irq), DT_INST_IRQ_BY_IDX(0, idx, priority), \
vevif_task_rx_isr, &vevif_irqs[idx], 0)
static int vevif_task_rx_init(const struct device *dev)
{
nrf_vpr_csr_vevif_tasks_clear(NRF_VPR_TASK_TRIGGER_ALL_MASK);
LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), VEVIF_IRQ_CONNECT, (;));
return 0;
}
DEVICE_DT_INST_DEFINE(0, vevif_task_rx_init, NULL, NULL, NULL, POST_KERNEL,
CONFIG_MBOX_INIT_PRIORITY, &vevif_task_rx_driver_api);

View file

@ -3,31 +3,37 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#define DT_DRV_COMPAT nordic_nrf_vevif_remote #define DT_DRV_COMPAT nordic_nrf_vevif_task_tx
#include <zephyr/devicetree.h> #include <zephyr/devicetree.h>
#include <zephyr/drivers/mbox.h> #include <zephyr/drivers/mbox.h>
#include <haly/nrfy_vpr.h> #include <haly/nrfy_vpr.h>
struct mbox_vevif_remote_conf { #if defined(CONFIG_SOC_NRF54L15_ENGA_CPUAPP)
#define TASKS_IDX_MAX 17U
#else
#define TASKS_IDX_MAX NRF_VPR_TASKS_TRIGGER_MAX
#endif
struct mbox_vevif_task_tx_conf {
NRF_VPR_Type *vpr; NRF_VPR_Type *vpr;
uint32_t tasks_mask; uint32_t tasks_mask;
uint8_t tasks; uint8_t tasks;
}; };
static inline bool vevif_remote_is_task_valid(const struct device *dev, uint32_t id) static inline bool vevif_task_tx_is_valid(const struct device *dev, uint32_t id)
{ {
const struct mbox_vevif_remote_conf *config = dev->config; const struct mbox_vevif_task_tx_conf *config = dev->config;
return (id < config->tasks) && ((config->tasks_mask & BIT(id)) != 0U); return ((id <= TASKS_IDX_MAX) && ((config->tasks_mask & BIT(id)) != 0U));
} }
static int vevif_remote_send(const struct device *dev, uint32_t id, const struct mbox_msg *msg) static int vevif_task_tx_send(const struct device *dev, uint32_t id, const struct mbox_msg *msg)
{ {
const struct mbox_vevif_remote_conf *config = dev->config; const struct mbox_vevif_task_tx_conf *config = dev->config;
if (!vevif_remote_is_task_valid(dev, id)) { if (!vevif_task_tx_is_valid(dev, id)) {
return -EINVAL; return -EINVAL;
} }
@ -40,37 +46,37 @@ static int vevif_remote_send(const struct device *dev, uint32_t id, const struct
return 0; return 0;
} }
static int vevif_remote_mtu_get(const struct device *dev) static int vevif_task_tx_mtu_get(const struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return 0; return 0;
} }
static uint32_t vevif_remote_max_channels_get(const struct device *dev) static uint32_t vevif_task_tx_max_channels_get(const struct device *dev)
{ {
const struct mbox_vevif_remote_conf *config = dev->config; const struct mbox_vevif_task_tx_conf *config = dev->config;
return config->tasks; return config->tasks;
} }
static const struct mbox_driver_api vevif_remote_driver_api = { static const struct mbox_driver_api vevif_task_tx_driver_api = {
.send = vevif_remote_send, .send = vevif_task_tx_send,
.mtu_get = vevif_remote_mtu_get, .mtu_get = vevif_task_tx_mtu_get,
.max_channels_get = vevif_remote_max_channels_get, .max_channels_get = vevif_task_tx_max_channels_get,
}; };
#define VEVIF_REMOTE_DEFINE(inst) \ #define VEVIF_TASK_TX_DEFINE(inst) \
BUILD_ASSERT(DT_INST_PROP(inst, nordic_tasks) <= VPR_TASKS_TRIGGER_MaxCount, \ BUILD_ASSERT(DT_INST_PROP(inst, nordic_tasks) <= VPR_TASKS_TRIGGER_MaxCount, \
"Number of tasks exceeds maximum"); \ "Number of tasks exceeds maximum"); \
\ \
static const struct mbox_vevif_remote_conf conf##inst = { \ static const struct mbox_vevif_task_tx_conf conf##inst = { \
.vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \
.tasks = DT_INST_PROP(inst, nordic_tasks), \ .tasks = DT_INST_PROP(inst, nordic_tasks), \
.tasks_mask = DT_INST_PROP(inst, nordic_tasks_mask), \ .tasks_mask = DT_INST_PROP(inst, nordic_tasks_mask), \
}; \ }; \
\ \
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \
CONFIG_MBOX_INIT_PRIORITY, &vevif_remote_driver_api); CONFIG_MBOX_INIT_PRIORITY, &vevif_task_tx_driver_api);
DT_INST_FOREACH_STATUS_OKAY(VEVIF_REMOTE_DEFINE) DT_INST_FOREACH_STATUS_OKAY(VEVIF_TASK_TX_DEFINE)

View file

@ -6,13 +6,13 @@ description: |
BELLBOARD provides support for inter-domain software signaling. It implements BELLBOARD provides support for inter-domain software signaling. It implements
a set of tasks and events intended for signaling within an interprocessor a set of tasks and events intended for signaling within an interprocessor
communication (IPC) framework. When used in local mode, the BELLBOARD communication (IPC) framework. When used in the rx mode, the BELLBOARD
instance is used to receive events triggered by other remote cores. instance is used to receive events triggered by other remote cores.
Example definition: Example definition:
bellboard: mailbox@deadbeef { bellboard: mailbox@deadbeef {
compatible = "nordic,nrf-bellboard-local"; compatible = "nordic,nrf-bellboard-rx";
reg = <0xdeadbeef 0x1000>; reg = <0xdeadbeef 0x1000>;
interrupts = <98 NRF_DEFAULT_IRQ_PRIORITY>, interrupts = <98 NRF_DEFAULT_IRQ_PRIORITY>,
<99 NRF_DEFAULT_IRQ_PRIORITY>; <99 NRF_DEFAULT_IRQ_PRIORITY>;
@ -21,7 +21,7 @@ description: |
#mbox-cells = <1>; #mbox-cells = <1>;
}; };
compatible: "nordic,nrf-bellboard-local" compatible: "nordic,nrf-bellboard-rx"
include: "nordic,nrf-bellboard-common.yaml" include: "nordic,nrf-bellboard-common.yaml"

View file

@ -6,17 +6,17 @@ description: |
BELLBOARD provides support for inter-domain software signaling. It implements BELLBOARD provides support for inter-domain software signaling. It implements
a set of tasks and events intended for signaling within an interprocessor a set of tasks and events intended for signaling within an interprocessor
communication (IPC) framework. When used in remote mode, the BELLBOARD communication (IPC) framework. When used in the tx mode, the BELLBOARD
instance is used to trigger events to another core. instance is used to trigger events to another core.
Example definition: Example definition:
bellboard: mailbox@deadbeef { bellboard: mailbox@deadbeef {
compatible = "nordic,nrf-bellboard-remote"; compatible = "nordic,nrf-bellboard-tx";
reg = <0xdeadbeef 0x1000>; reg = <0xdeadbeef 0x1000>;
#mbox-cells = <1>; #mbox-cells = <1>;
}; };
compatible: "nordic,nrf-bellboard-remote" compatible: "nordic,nrf-bellboard-tx"
include: "nordic,nrf-bellboard-common.yaml" include: "nordic,nrf-bellboard-common.yaml"

View file

@ -1,18 +0,0 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
include: mailbox-controller.yaml
properties:
nordic,tasks:
type: int
required: true
description: Number of tasks supported by the VEVIF instance.
nordic,tasks-mask:
type: int
required: true
description: Mask of tasks supported by the VEVIF instance.
mbox-cells:
- channel

View file

@ -1,32 +0,0 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: |
Nordic VEVIF (VPR Event Interface) - Local
VEVIF is an event interface for VPR, allowing connection to the domain's DPPI
system. VEVIF can also generate IRQs to other CPUs.
Example definition:
cpuppr: cpu@d {
...
cpuppr_vevif_local: mailbox {
compatible = "nordic,nrf-vevif-local";
interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>,
<1 NRF_DEFAULT_IRQ_PRIORITY>,
...
<N NRF_DEFAULT_IRQ_PRIORITY>;
#mbox-cells = <1>;
nordic,tasks = <16>;
nordic,tasks-mask: <0xfffffff0>;
};
};
compatible: "nordic,nrf-vevif-local"
include: [base.yaml, "nordic,nrf-vevif-common.yaml"]
properties:
interrupts:
required: true

View file

@ -1,29 +0,0 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: |
Nordic VEVIF (VPR Event Interface) - Remote
VEVIF is an event interface for VPR, allowing connection to the domain's DPPI
system. VEVIF can also generate IRQs to other CPUs.
Example definition:
cpuppr_vpr: vpr@deadbeef{
...
cpuppr_vevif_remote: mailbox@0 {
compatible = "nordic,nrf-vevif-remote";
reg = <0x0 0x1000>;
#mbox-cells = <1>;
nordic,tasks = <16>;
nordic,tasks-mask: <0xfffffff0>;
};
};
compatible: "nordic,nrf-vevif-remote"
include: [base.yaml, "nordic,nrf-vevif-common.yaml"]
properties:
reg:
required: true

View file

@ -0,0 +1,49 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: |
Nordic VEVIF (VPR Event Interface) - TASK RX MODE
VEVIF is an event interface for VPR, allowing connection to the domain's DPPI
system. VEVIF can also generate IRQs to other CPUs.
VEVIF provides support for inter-domain software signaling. It implements a set of tasks
intended for signaling within an interprocessor communication (IPC) framework.
When used in task rx mode, the VEVIF tasks are used to receive events triggered by other core.
Example definition:
cpuppr: cpu@d {
...
cpuppr_vevif_task_rx: mailbox {
compatible = "nordic,nrf-vevif-task-rx";
interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>,
<1 NRF_DEFAULT_IRQ_PRIORITY>,
...
<N NRF_DEFAULT_IRQ_PRIORITY>;
#mbox-cells = <1>;
nordic,tasks = <16>;
nordic,tasks-mask = <0xfffffff0>;
};
};
compatible: "nordic,nrf-vevif-task-rx"
include: [base.yaml, mailbox-controller.yaml]
properties:
nordic,tasks:
type: int
required: true
description: Number of tasks supported by the VEVIF instance.
nordic,tasks-mask:
type: int
required: true
description: Mask of tasks supported by the VEVIF instance.
interrupts:
required: true
mbox-cells:
- channel

View file

@ -0,0 +1,46 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: |
Nordic VEVIF (VPR Event Interface) - TASK TX MODE
VEVIF is an event interface for VPR, allowing connection to the domain's DPPI
system. VEVIF can also generate IRQs to other CPUs.
VEVIF provides support for inter-domain software signaling. It implements a set of tasks
intended for signaling within an interprocessor communication (IPC) framework.
When used in task tx mode, the VEVIF tasks are used to trigger IRQs on VPR core.
Example definition:
cpuppr_vpr: vpr@deadbeef{
...
cpuppr_vevif_task_tx: mailbox@0 {
compatible = "nordic,nrf-vevif-task-tx";
reg = <0x0 0x1000>;
#mbox-cells = <1>;
nordic,tasks = <16>;
nordic,tasks-mask = <0xfffffff0>;
};
};
compatible: "nordic,nrf-vevif-task-tx"
include: [base.yaml, mailbox-controller.yaml]
properties:
nordic,tasks:
type: int
required: true
description: Number of tasks supported by the VEVIF instance.
nordic,tasks-mask:
type: int
required: true
description: Mask of tasks supported by the VEVIF instance.
reg:
required: true
mbox-cells:
- channel