arch/nrf53: boot the net core

This commit is contained in:
raiden00pl 2023-03-03 17:41:38 +01:00 committed by Masayuki Ishikawa
parent 150b3622a8
commit ad4af9b9c9
5 changed files with 175 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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 <nuttx/config.h>
#include <stdbool.h>
#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
}

View File

@ -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 <nuttx/config.h>
/****************************************************************************
* 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 */

View File

@ -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');