soc: riscv: litex: add reboot
this makes it possible to reboot a litex SoC. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
parent
d7e5451799
commit
1d88d7d139
6 changed files with 51 additions and 0 deletions
|
@ -23,6 +23,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&ctrl0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
&uart0 {
|
&uart0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
|
|
12
dts/bindings/riscv/litex,soc-controller.yaml
Normal file
12
dts/bindings/riscv/litex,soc-controller.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Copyright 2024 Vogl Electronic GmbH
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
description: LiteX SoC Controller driver
|
||||||
|
|
||||||
|
compatible: "litex,soc-controller"
|
||||||
|
|
||||||
|
include: base.yaml
|
||||||
|
|
||||||
|
properties:
|
||||||
|
reg:
|
||||||
|
required: true
|
|
@ -34,6 +34,15 @@
|
||||||
#size-cells = <1>;
|
#size-cells = <1>;
|
||||||
compatible = "litex,vexriscv";
|
compatible = "litex,vexriscv";
|
||||||
ranges;
|
ranges;
|
||||||
|
ctrl0: soc_controller@e0000000 {
|
||||||
|
compatible = "litex,soc-controller";
|
||||||
|
reg = <0xe0000000 0x4
|
||||||
|
0xe0000004 0x4
|
||||||
|
0xe0000008 0x4>;
|
||||||
|
reg-names = "reset",
|
||||||
|
"scratch",
|
||||||
|
"bus_errors";
|
||||||
|
};
|
||||||
intc0: interrupt-controller@bc0 {
|
intc0: interrupt-controller@bc0 {
|
||||||
compatible = "litex,vexriscv-intc0";
|
compatible = "litex,vexriscv-intc0";
|
||||||
#address-cells = <0>;
|
#address-cells = <0>;
|
||||||
|
|
|
@ -9,6 +9,8 @@ zephyr_sources(
|
||||||
${ZEPHYR_BASE}/soc/common/riscv-privileged/vector.S
|
${ZEPHYR_BASE}/soc/common/riscv-privileged/vector.S
|
||||||
)
|
)
|
||||||
|
|
||||||
|
zephyr_sources_ifdef(CONFIG_REBOOT reboot.c)
|
||||||
|
|
||||||
zephyr_include_directories(.)
|
zephyr_include_directories(.)
|
||||||
|
|
||||||
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "")
|
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "")
|
||||||
|
|
|
@ -9,4 +9,8 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
|
||||||
config NUM_IRQS
|
config NUM_IRQS
|
||||||
default 12
|
default 12
|
||||||
|
|
||||||
|
config REBOOT
|
||||||
|
depends on DT_HAS_LITEX_SOC_CONTROLLER_ENABLED
|
||||||
|
default y
|
||||||
|
|
||||||
endif # SOC_LITEX_VEXRISCV
|
endif # SOC_LITEX_VEXRISCV
|
||||||
|
|
20
soc/litex/litex_vexriscv/reboot.c
Normal file
20
soc/litex/litex_vexriscv/reboot.c
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Vogl Electronic GmbH
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
#define DT_DRV_COMPAT litex_soc_controller
|
||||||
|
|
||||||
|
#include <zephyr/kernel.h>
|
||||||
|
#include <zephyr/devicetree.h>
|
||||||
|
#include <zephyr/sys/reboot.h>
|
||||||
|
#include <soc.h>
|
||||||
|
|
||||||
|
#define LITEX_CTRL_RESET DT_INST_REG_ADDR_BY_NAME(0, reset)
|
||||||
|
|
||||||
|
void sys_arch_reboot(int type)
|
||||||
|
{
|
||||||
|
ARG_UNUSED(type);
|
||||||
|
/* SoC Reset on BIT(0)*/
|
||||||
|
litex_write8(BIT(0), LITEX_CTRL_RESET);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue