riscv32: rename to riscv
With the upcoming riscv64 support, it is best to use "riscv" as the subdirectory name and common symbols as riscv32 and riscv64 support code is almost identical. Then later decide whether 32-bit or 64-bit compilation is wanted. Redirects for the web documentation are also included. Then zephyrbot complained about this: " New files added that are not covered in CODEOWNERS: dts/riscv/microsemi-miv.dtsi dts/riscv/riscv32-fe310.dtsi Please add one or more entries in the CODEOWNERS file to cover those files " So I assigned them to those who created them. Feel free to readjust as necessary. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
parent
48b4ad4b33
commit
1f4b5ddd0f
159 changed files with 125 additions and 118 deletions
63
soc/riscv/openisa_rv32m1/wdog.S
Normal file
63
soc/riscv/openisa_rv32m1/wdog.S
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Foundries.io Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <linker/sections.h>
|
||||
#include <toolchain.h>
|
||||
#include <soc.h>
|
||||
|
||||
/* Exports */
|
||||
GTEXT(_WdogInit)
|
||||
|
||||
/* WDOG instance base address. */
|
||||
#ifdef CONFIG_SOC_OPENISA_RV32M1_RI5CY
|
||||
#define WDOG_BASE 0x4002A000 /* WDOG0 */
|
||||
#else
|
||||
#define WDOG_BASE 0x41026000 /* WDOG1 */
|
||||
#endif
|
||||
|
||||
/* Register offsets. */
|
||||
#define WDOG_CS_OFFSET 0x00
|
||||
#define WDOG_CNT_OFFSET 0x04
|
||||
#define WDOG_TOVAL_OFFSET 0x08
|
||||
|
||||
/* Watchdog unlock key. */
|
||||
#define WDOG_CNT_UNLOCK 0xD928C520
|
||||
|
||||
/* TOVAL must be set when disabling watchdog after reset. */
|
||||
#define WDOG_TOVAL_SET 0xFFFF
|
||||
|
||||
/* Disable the WDOG_CS[EN] bit. */
|
||||
#define WDOG_CS_EN_DISABLED ~0x80
|
||||
/* Set WDOG_CS[UPDATE] bit. */
|
||||
#define WDOG_CS_UPDATE_ENABLED 0x20
|
||||
|
||||
/*
|
||||
* Unlock and disable the watchdog, which is enabled by default.
|
||||
*/
|
||||
SECTION_FUNC(TEXT, _WdogInit)
|
||||
/* Disable interrupts if they're on. This is timing-sensitive code. */
|
||||
csrrc t0, mstatus, SOC_MSTATUS_IEN
|
||||
|
||||
/* Get base address. */
|
||||
li t1, WDOG_BASE
|
||||
|
||||
/* Unlock the watchdog. */
|
||||
li t2, WDOG_CNT_UNLOCK
|
||||
sw t2, WDOG_CNT_OFFSET(t1)
|
||||
|
||||
/* Disable the watchdog. Allow updates later. */
|
||||
lw t2, WDOG_CS_OFFSET(t1)
|
||||
andi t2, t2, WDOG_CS_EN_DISABLED
|
||||
ori t2, t2, WDOG_CS_UPDATE_ENABLED
|
||||
sw t2, WDOG_CS_OFFSET(t1)
|
||||
|
||||
/* This must also be done per reference manual. */
|
||||
li t2, WDOG_TOVAL_SET
|
||||
sw t2, WDOG_TOVAL_OFFSET(t1)
|
||||
|
||||
/* Re-enable interrupts if they were disabled. */
|
||||
csrrs x0, mstatus, t0
|
||||
ret
|
Loading…
Add table
Add a link
Reference in a new issue