Commit 601b98cd authored by Chaitanya Tata's avatar Chaitanya Tata Committed by Anas Nashif
Browse files

boards: nrf7002dk: remove redundant cpunet initialization code



Extending commit 4a1834ce("boards: nrf53: remove redundant cpunet
initialization code") to nRF7002DK for CPUNET reset handling.

Signed-off-by: default avatarChaitanya Tata <Chaitanya.Tata@nordicsemi.no>
parent 730b2f7c
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

if((CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR
    CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) AND
   CONFIG_BOARD_ENABLE_CPUNET)
  zephyr_library()
  zephyr_library_sources(nrf5340_cpunet_reset.c)
endif()
+0 −17
Original line number Diff line number Diff line
@@ -19,26 +19,9 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD
	int
	default 4096 if BT_HCI_IPC

config BOARD_ENABLE_CPUNET
	bool "nRF53 Network MCU"
	select SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 if \
		$(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GPIO_FORWARDER))
	help
	  This option enables releasing the Network 'force off' signal, which
	  as a consequence will power up the Network MCU during system boot.
	  Additionally, the option allocates GPIO pins that will be used by UARTE
	  of the Network MCU.
	  Note: GPIO pin allocation can only be configured by the secure Application
	  MCU firmware, so when this option is used with the non-secure version of
	  the board, the application needs to take into consideration, that the
	  secure firmware image must already have configured GPIO allocation for the
	  Network MCU.
	default y if (BT || NRF_802154_SER_HOST)

config DOMAIN_CPUNET_BOARD
	string
	default "nrf7002dk/nrf5340/cpunet"
	depends on BOARD_ENABLE_CPUNET
	help
	  The board which will be used for CPUNET domain when creating a multi
	  image application where one or more images should be located on
+0 −59
Original line number Diff line number Diff line
/*
 * Copyright (c) 2024 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr/sys/util_macro.h>
#include <zephyr/init.h>
#include <zephyr/logging/log.h>

#include <soc.h>
#include <hal/nrf_reset.h>

LOG_MODULE_REGISTER(nrf7002dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL);

#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP)
#include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/debug.h>
#endif

static void remoteproc_mgr_config(void)
{
#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) && \
	(!defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM))
	/* Route Bluetooth Controller Debug Pins */
	DEBUG_SETUP();
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */

#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
	/* Retain nRF5340 Network MCU in Secure domain (bus
	 * accesses by Network MCU will have Secure attribute set).
	 */
	NRF_SPU->EXTDOMAIN[0].PERM = BIT(4);
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
}

static int remoteproc_mgr_boot(void)
{

	/* Secure domain may configure permissions for the Network MCU. */
	remoteproc_mgr_config();

#if !defined(CONFIG_TRUSTED_EXECUTION_SECURE)
	/*
	 * Building Zephyr with CONFIG_TRUSTED_EXECUTION_SECURE=y implies
	 * building also a Non-Secure image. The Non-Secure image will, in
	 * this case do the remainder of actions to properly configure and
	 * boot the Network MCU.
	 */

	/* Release the Network MCU, 'Release force off signal' */
	nrf_reset_network_force_off(NRF_RESET, false);

	LOG_DBG("Network MCU released.");
#endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */

	return 0;
}

SYS_INIT(remoteproc_mgr_boot, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);