Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@
/subsys/fs/fuse_fs_access.c @vanwinkeljan
/subsys/fs/littlefs_fs.c @pabigot
/subsys/fs/nvs/ @Laczen
/subsys/ipc/ @ioannisg
/subsys/logging/ @nordic-krch
/subsys/logging/log_backend_net.c @nordic-krch @jukkar
/subsys/lorawan/ @Mani-Sadhasivam
Expand Down
38 changes: 37 additions & 1 deletion boards/arm/nrf5340dk_nrf5340/Kconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
# nRF5340 (P)DK board configuration

# Copyright (c) 2019 - 2020 Nordic Semiconductor ASA
# Copyright (c) 2019 - 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config IPM_NRFX
default IPM

config RPMSG_SERVICE_DUAL_IPM_SUPPORT
default RPMSG_SERVICE

if RPMSG_SERVICE_DUAL_IPM_SUPPORT

config IPM_MSG_CH_0_ENABLE
default y

config IPM_MSG_CH_1_ENABLE
default y

config RPMSG_SERVICE_IPM_TX_NAME
default "IPM_0" if RPMSG_SERVICE_MODE_MASTER
default "IPM_1" if RPMSG_SERVICE_MODE_REMOTE

config RPMSG_SERVICE_IPM_RX_NAME
default "IPM_1" if RPMSG_SERVICE_MODE_MASTER
default "IPM_0" if RPMSG_SERVICE_MODE_REMOTE

config IPM_MSG_CH_0_TX
default RPMSG_SERVICE_MODE_MASTER

config IPM_MSG_CH_0_RX
default RPMSG_SERVICE_MODE_REMOTE

config IPM_MSG_CH_1_TX
default RPMSG_SERVICE_MODE_REMOTE

config IPM_MSG_CH_1_RX
default RPMSG_SERVICE_MODE_MASTER

endif # RPMSG_SERVICE_DUAL_IPM_SUPPORT

if BOARD_NRF5340PDK_NRF5340_CPUAPP || BOARD_NRF5340PDK_NRF5340_CPUAPPNS || BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPPNS

config BOARD_ENABLE_DCDC_APP
Expand Down
17 changes: 1 addition & 16 deletions boards/arm/nrf5340dk_nrf5340/nrf5340_cpunet_reset.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Nordic Semiconductor ASA.
* Copyright (c) 2019-2021 Nordic Semiconductor ASA.
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -12,13 +12,6 @@

LOG_MODULE_REGISTER(nrf5340pdk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL);

/* Shared memory definitions */
#if DT_HAS_CHOSEN(zephyr_ipc_shm)
#define SHM_NODE DT_CHOSEN(zephyr_ipc_shm)
#define SHM_BASE_ADDRESS DT_REG_ADDR(SHM_NODE)
#define SHM_SIZE DT_REG_SIZE(SHM_NODE)
#endif

#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)

/* This should come from DTS, possibly an overlay. */
Expand Down Expand Up @@ -83,14 +76,6 @@ static int remoteproc_mgr_boot(const struct device *dev)
* this case do the remainder of actions to properly configure and
* boot the Network MCU.
*/
#if defined(SHM_BASE_ADDRESS) && (SHM_BASE_ADDRESS != 0)

/* Initialize inter-processor shared memory block to zero. It is
* assumed that the application image has access to the shared
* memory at this point (see #24147).
*/
memset((void *) SHM_BASE_ADDRESS, 0, SHM_SIZE);
#endif

/* Release the Network MCU, 'Release force off signal' */
NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release;
Expand Down
18 changes: 4 additions & 14 deletions drivers/bluetooth/hci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,16 @@ config BT_RPMSG_NRF53
bool "nRF53 configuration of RPMsg"
default y if SOC_NRF5340_CPUAPP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you decide to remove rpmsg_nrf53.c, then please remove BT_RPMSG_NRF53 Kconfig for consistency.

This part:
default y if SOC_NRF5340_CPUAPP
can be moved to the board configuration

depends on BT_RPMSG
select IPM
select IPM_NRFX
select IPM_MSG_CH_1_ENABLE
select IPM_MSG_CH_0_ENABLE
select IPM_MSG_CH_0_TX
select IPM_MSG_CH_1_RX
select OPENAMP
select RPMSG_SERVICE
help
Enable RPMsg configuration for nRF53. Two channels of the IPM driver
are used in the HCI driver: channel 0 for TX and channel 1 for RX.

if BT_RPMSG_NRF53

config BT_RPMSG_NRF53_RX_STACK_SIZE
int "RPMsg stack size for RX thread"
default 1024

config BT_RPMSG_NRF53_RX_PRIO
int "RPMsg RX thread priority"
default 8
choice RPMSG_SERVICE_MODE
default RPMSG_SERVICE_MODE_MASTER
endchoice

endif # BT_RPMSG_NRF53

Expand Down
23 changes: 20 additions & 3 deletions drivers/bluetooth/hci/rpmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

int bt_rpmsg_platform_init(void);
int bt_rpmsg_platform_send(struct net_buf *buf);
int bt_rpmsg_platform_endpoint_is_bound(void);

static bool is_hci_event_discardable(const uint8_t *evt_data)
{
Expand Down Expand Up @@ -234,7 +235,10 @@ static int bt_rpmsg_open(void)
{
BT_DBG("");

return bt_rpmsg_platform_init();
while (!bt_rpmsg_platform_endpoint_is_bound()) {
k_sleep(K_MSEC(1));
}
return 0;
}

static const struct bt_hci_driver drv = {
Expand All @@ -251,7 +255,20 @@ static int bt_rpmsg_init(const struct device *unused)
{
ARG_UNUSED(unused);

return bt_hci_driver_register(&drv);
int err;

err = bt_rpmsg_platform_init();
if (err < 0) {
BT_ERR("Failed to initialize BT RPMSG (err %d)", err);
return err;
}

err = bt_hci_driver_register(&drv);
if (err < 0) {
BT_ERR("Failed to register BT HIC driver (err %d)", err);
}

return err;
}

SYS_INIT(bt_rpmsg_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
SYS_INIT(bt_rpmsg_init, POST_KERNEL, CONFIG_RPMSG_SERVICE_EP_REG_PRIORITY);
Loading