risc-v/mpfs: enable up_systemreset()

This commit is contained in:
Janne Rosberg 2021-05-28 14:32:23 +03:00 committed by Xiang Xiao
parent ec11643394
commit f7cbed0256
4 changed files with 59 additions and 2 deletions

View File

@ -64,6 +64,7 @@ config ARCH_CHIP_MPFS
bool "MicroChip Polarfire (MPFS)"
select ARCH_RV64GC
select ARCH_HAVE_MPU
select ARCH_HAVE_RESET
---help---
MicroChip Polarfire processor (RISC-V 64bit core with GCVX extensions).

View File

@ -52,7 +52,7 @@ CHIP_CSRCS = mpfs_allocateheap.c mpfs_clockconfig.c
CHIP_CSRCS += mpfs_idle.c mpfs_irq.c mpfs_irq_dispatch.c
CHIP_CSRCS += mpfs_lowputc.c mpfs_serial.c
CHIP_CSRCS += mpfs_start.c mpfs_timerisr.c
CHIP_CSRCS += mpfs_gpio.c
CHIP_CSRCS += mpfs_gpio.c mpfs_systemreset.c
ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += riscv_task_start.c riscv_pthread_start.c

View File

@ -28,7 +28,7 @@
#include "hardware/mpfs_clint.h"
#include "hardware/mpfs_memorymap.h"
#include "hardware/mpfs_plic.h"
#include "hardware/mpfs_sysctl.h"
#include "hardware/mpfs_sysreg.h"
#include "hardware/mpfs_uart.h"
/****************************************************************************

View File

@ -0,0 +1,56 @@
/****************************************************************************
* arch/risc-v/src/mpfs/mpfs_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 <nuttx/arch.h>
#include <nuttx/board.h>
#include <riscv_arch.h>
#include "hardware/mpfs_memorymap.h"
#include "hardware/mpfs_sysreg.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_systemreset
*
* Description:
* Internal reset logic.
*
****************************************************************************/
void up_systemreset(void)
{
putreg32(0xdead, MPFS_SYSREG_BASE + MPFS_SYSREG_MSS_RESET_CR_OFFSET);
/* Wait for the reset */
for (; ; );
}