arch/arm64: add support of systemreset
This commit is contained in:
parent
11cc232de5
commit
753f46dffe
@ -14,6 +14,7 @@ config ARCH_CHIP_A64
|
||||
bool "Allwinner A64"
|
||||
select ARCH_CORTEX_A53
|
||||
select ARCH_HAVE_ADDRENV
|
||||
select ARCH_HAVE_RESET
|
||||
select ARCH_NEED_ADDRENV_MAPPING
|
||||
---help---
|
||||
Allwinner A64 SoC
|
||||
|
@ -84,7 +84,7 @@ void arm64_chip_boot(void)
|
||||
|
||||
arm64_mmu_init(true);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#if defined(CONFIG_SMP) || defined(CONFIG_ARCH_HAVE_RESET)
|
||||
arm64_psci_init("smc");
|
||||
|
||||
#endif
|
||||
|
@ -48,7 +48,7 @@ CMN_CSRCS += arm64_createstack.c arm64_releasestack.c arm64_stackframe.c arm64_u
|
||||
CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_vfork.c
|
||||
CMN_CSRCS += arm64_releasepending.c arm64_switchcontext.c
|
||||
CMN_CSRCS += arm64_assert.c arm64_schedulesigaction.c arm64_backtrace.c
|
||||
CMN_CSRCS += arm64_sigdeliver.c
|
||||
CMN_CSRCS += arm64_sigdeliver.c arm64_systemreset.c
|
||||
|
||||
# Common C source files ( hardware BSP )
|
||||
CMN_CSRCS += arm64_mmu.c arm64_arch_timer.c arm64_cache.c
|
||||
|
@ -164,6 +164,20 @@ int pcsi_cpu_off(void)
|
||||
return psci_to_dev_err(ret);
|
||||
}
|
||||
|
||||
int pcsi_cpu_reset(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (psci_data.conduit == SMCCC_CONDUIT_NONE)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = psci_data.invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
|
||||
|
||||
return psci_to_dev_err(ret);
|
||||
}
|
||||
|
||||
int pcsi_cpu_on(unsigned long cpuid, uintptr_t entry_point)
|
||||
{
|
||||
int ret;
|
||||
|
@ -99,6 +99,7 @@ struct psci_interface
|
||||
|
||||
uint32_t psci_version(void);
|
||||
int pcsi_cpu_off(void);
|
||||
int pcsi_cpu_reset(void);
|
||||
int pcsi_cpu_on(unsigned long cpuid, uintptr_t entry_point);
|
||||
|
||||
#endif /* __ARCH_ARM64_SRC_COMMON_ARM64_CPU_PSCI_H */
|
||||
|
63
arch/arm64/src/common/arm64_systemreset.c
Normal file
63
arch/arm64/src/common/arm64_systemreset.c
Normal file
@ -0,0 +1,63 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/common/arm64_systemreset.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 <stdint.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "arm64_internal.h"
|
||||
#include "arm64_cpu_psci.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_systemreset
|
||||
*
|
||||
* Description:
|
||||
* Internal, arm64 reset logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_systemreset(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Set up for the system reset */
|
||||
|
||||
ret = pcsi_cpu_reset();
|
||||
if (ret)
|
||||
{
|
||||
sinfo("Failed to reset CPU, error code: %d\n", ret);
|
||||
}
|
||||
|
||||
/* Wait for the reset */
|
||||
|
||||
for (; ; );
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user