diff --git a/arch/arm/src/nrf53/Kconfig b/arch/arm/src/nrf53/Kconfig index 172a36fc17..1bdc33849b 100644 --- a/arch/arm/src/nrf53/Kconfig +++ b/arch/arm/src/nrf53/Kconfig @@ -41,6 +41,26 @@ config ARCH_CHIP_NRF5340_CPUNET endchoice # NRF5340 Core Selection +if NRF53_APPCORE + +config NRF53_NET_BOOT + bool "NRF53 Net core configuration" + default y + +if NRF53_NET_BOOT + +config NRF53_NET_POWER_ON_BOOT + bool "NRF53 Power Net core on App core boot" + default y + +config NRF53_NET_GPIO_ALLOW_ALL + bool "NRF53 allow all GPIO for Net core" + default y + +endif # NRF53_NET_BOOT + +endif # NRF53_APPCORE + # Peripheral Selection config NRF53_UART diff --git a/arch/arm/src/nrf53/Make.defs b/arch/arm/src/nrf53/Make.defs index f01f7ce30c..ae08ce82cb 100644 --- a/arch/arm/src/nrf53/Make.defs +++ b/arch/arm/src/nrf53/Make.defs @@ -30,4 +30,8 @@ endif ifeq ($(CONFIG_NRF53_UART),y) CHIP_CSRCS += nrf53_serial.c +endif + +ifeq ($(CONFIG_NRF53_APPCORE),y) +CHIP_CSRCS += nrf53_cpunet.c endif \ No newline at end of file diff --git a/arch/arm/src/nrf53/nrf53_cpunet.c b/arch/arm/src/nrf53/nrf53_cpunet.c new file mode 100644 index 0000000000..da8d46d8f3 --- /dev/null +++ b/arch/arm/src/nrf53/nrf53_cpunet.c @@ -0,0 +1,83 @@ +/**************************************************************************** + * arch/arm/src/nrf53/nrf53_cpunet.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include "arm_internal.h" +#include "hardware/nrf53_reset.h" +#include "nrf53_cpunet.h" +#ifdef CONFIG_NRF53_NET_GPIO_ALLOW_ALL +# include "nrf53_gpio.h" +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nrf53_cpunet_power + ****************************************************************************/ + +void nrf53_cpunet_power(bool enable) +{ + if (enable) + { + /* Reset force off bit */ + + putreg32(RESET_NETWORK_FORCEOFF_RELEASE, NRF53_RESET_NETWORK_FORCEOFF); + } + else + { + putreg32(RESET_NETWORK_FORCEOFF_HOLD, NRF53_RESET_NETWORK_FORCEOFF); + } +} + +/**************************************************************************** + * Name: nrf53_cpunet_boot + ****************************************************************************/ + +void nrf53_cpunet_boot(void) +{ +#ifdef CONFIG_NRF53_NET_GPIO_ALLOW_ALL + /* Allow all GPIO for the Net core for now */ + + nrf53_gpio_cpunet_allow_all(); +#else + /* Or use custom board configuration */ + + nrf53_board_gpio_cpunet_allow(); +#endif + +#ifdef CONFIG_NRF53_NET_POWER_ON_BOOT + /* Turn on the Net core */ + + nrf53_cpunet_power(true); +#endif +} diff --git a/arch/arm/src/nrf53/nrf53_cpunet.h b/arch/arm/src/nrf53/nrf53_cpunet.h new file mode 100644 index 0000000000..462ac14e70 --- /dev/null +++ b/arch/arm/src/nrf53/nrf53_cpunet.h @@ -0,0 +1,58 @@ +/**************************************************************************** + * arch/arm/src/nrf53/nrf53_cpunet.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_NRF53_NRF53_CPUNET_H +#define __ARCH_ARM_SRC_NRF53_NRF53_CPUNET_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef CONFIG_NRF53_NET_GPIO_ALLOW_ALL +/**************************************************************************** + * Name: nrf53_board_gpio_cpunet_allow + * + * Description: + * Board logic may implement own set of GPIOs available for the Net core. + * + ****************************************************************************/ + +void nrf53_board_gpio_cpunet_allow(void); +#endif + +/**************************************************************************** + * Name: nrf53_cpunet_power + ****************************************************************************/ + +void nrf53_cpunet_power(bool enable); + +/**************************************************************************** + * Name: nrf53_cpunet_boot + ****************************************************************************/ + +void nrf53_cpunet_boot(void); + +#endif /* __ARCH_ARM_SRC_NRF53_NRF53_CPUNET_H */ diff --git a/arch/arm/src/nrf53/nrf53_start.c b/arch/arm/src/nrf53/nrf53_start.c index 0289907612..dfc5f42375 100644 --- a/arch/arm/src/nrf53/nrf53_start.c +++ b/arch/arm/src/nrf53/nrf53_start.c @@ -39,6 +39,7 @@ #include "hardware/nrf53_utils.h" #include "nrf53_lowputc.h" #include "nrf53_start.h" +#include "nrf53_cpunet.h" #include "nrf53_gpio.h" #include "nrf53_serial.h" @@ -98,6 +99,12 @@ void __start(void) __asm__ __volatile__ ("\tcpsid i\n"); +#ifdef CONFIG_NRF53_NET_BOOT + /* Boot CPU NET before console init */ + + nrf53_cpunet_boot(); +#endif + /* Configure the clocking and the console uart so that we can get debug * output as soon as possible. NOTE: That this logic must not assume that * .bss or .data have beeninitialized. @@ -133,15 +140,11 @@ void __start(void) showprogress('C'); -#if defined(CONFIG_ARCH_CHIP_NRF53832) - /* Initialize the errdata work-around */ - - nrf53832_errdata_init(); -#endif - - /* Initialize the FPU (if configured) */ +#ifdef CONFIG_ARCH_HAVE_FPU + /* Initialize the FPU (if available) */ arm_fpuconfig(); +#endif showprogress('D');