1 /* 2 * Copyright (c) 2023 Pawel Osypiuk <pawelosyp@gmail.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <soc.h> 8 #include <zephyr/device.h> 9 #include <zephyr/devicetree.h> 10 #include <nrf53_cpunet_mgmt.h> 11 #include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/debug.h> 12 13 #include <hal/nrf_spu.h> 14 15 #define LOG_LEVEL CONFIG_BT_HCI_DRIVER_LOG_LEVEL 16 #include <zephyr/logging/log.h> 17 LOG_MODULE_REGISTER(bt_hci_nrf53_support); 18 bt_hci_transport_teardown(const struct device * dev)19int bt_hci_transport_teardown(const struct device *dev) 20 { 21 ARG_UNUSED(dev); 22 /* Put the Network MCU in Forced-OFF mode. */ 23 nrf53_cpunet_enable(false); 24 LOG_DBG("Network MCU placed in Forced-OFF mode"); 25 26 return 0; 27 } 28 bt_hci_transport_setup(const struct device * dev)29int bt_hci_transport_setup(const struct device *dev) 30 { 31 ARG_UNUSED(dev); 32 33 /* Route Bluetooth Controller Debug Pins */ 34 DEBUG_SETUP(); 35 36 #if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) 37 /* Retain nRF5340 Network MCU in Secure domain (bus 38 * accesses by Network MCU will have Secure attribute set). 39 */ 40 nrf_spu_extdomain_set((NRF_SPU_Type *)DT_REG_ADDR(DT_NODELABEL(spu)), 0, true, false); 41 #endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ 42 43 /* Release the Network MCU, 'Release force off signal' */ 44 nrf53_cpunet_enable(true); 45 46 return 0; 47 } 48