boards: riscv: opentitan_earlgrey: Add the OpenTitan AON Timer
Adds the AON Timer device in the OpenTitan Earlgrey device tree.
Adds overlay files to enable the watchdog and set the alias to
`watchdog0`.
Adds the AON timer (watchdog part) to the supported features section
of the OpenTitan documentation.
Signed-off-by: Tyler Ng <tkng@rivosinc.com>
diff --git a/boards/riscv/opentitan_earlgrey/doc/index.rst b/boards/riscv/opentitan_earlgrey/doc/index.rst
index e082286..f3edf95 100644
--- a/boards/riscv/opentitan_earlgrey/doc/index.rst
+++ b/boards/riscv/opentitan_earlgrey/doc/index.rst
@@ -43,6 +43,8 @@
+-----------+------------+-------------------------------------+
| SPI | on-chip | SPI host |
+-----------+------------+-------------------------------------+
+| WDT | on-chip | Always-On Timer (Watchdog) |
++-----------+------------+-------------------------------------+
Other hardware features are not yet supported on Zephyr porting.
@@ -89,8 +91,8 @@
.. target-notes::
-.. _OpenTitan Earl Grey Chip Datasheet: https://docs.opentitan.org/hw/top_earlgrey/doc/
+.. _OpenTitan Earl Grey Chip Datasheet: https://opentitan.org/book/hw/top_earlgrey/doc/specification.html
.. _OpenTitan GitHub: https://github.com/lowRISC/opentitan
-.. _OpenTitan Verilator Setup: https://docs.opentitan.org/doc/getting_started/setup_verilator/
+.. _OpenTitan Verilator Setup: https://opentitan.org/guides/getting_started/setup_verilator.html
diff --git a/boards/riscv/opentitan_earlgrey/opentitan_earlgrey.yaml b/boards/riscv/opentitan_earlgrey/opentitan_earlgrey.yaml
index 67cc99f..0f01dc5 100644
--- a/boards/riscv/opentitan_earlgrey/opentitan_earlgrey.yaml
+++ b/boards/riscv/opentitan_earlgrey/opentitan_earlgrey.yaml
@@ -9,3 +9,5 @@
ignore_tags:
- net
- bluetooth
+supported:
+ - watchdog
diff --git a/dts/riscv/lowrisc/opentitan_earlgrey.dtsi b/dts/riscv/lowrisc/opentitan_earlgrey.dtsi
index cc49716..6a3159d 100644
--- a/dts/riscv/lowrisc/opentitan_earlgrey.dtsi
+++ b/dts/riscv/lowrisc/opentitan_earlgrey.dtsi
@@ -53,18 +53,29 @@
status = "disabled";
};
+ aontimer: aontimer@40470000 {
+ compatible = "lowrisc,opentitan-aontimer";
+ reg = <0x40470000 0x1000>;
+ interrupts = <156 1>;
+ interrupt-names = "wdog_bark";
+ interrupt-parent = <&plic>;
+ clock-frequency = <200000>;
+ status = "disabled";
+ };
+
plic: interrupt-controller@48000000 {
compatible = "sifive,plic-1.0.0";
#address-cells = <0>;
#interrupt-cells = <2>;
interrupt-controller;
interrupts-extended = <&hlic 11>;
- reg = <0x48000000 0x00002000
- 0x48002000 0x001fe000
- 0x48000000 0x03e00000>;
+ reg = <0x48000000 0x00001000
+ 0x48002000 0x00001000
+ 0x48200000 0x00000008>;
reg-names = "prio", "irq_en", "reg";
riscv,max-priority = <7>;
riscv,ndev = <184>;
+ status = "okay";
};
uart0: serial@40000000{
diff --git a/samples/drivers/watchdog/boards/opentitan_earlgrey.overlay b/samples/drivers/watchdog/boards/opentitan_earlgrey.overlay
new file mode 100644
index 0000000..4d1b46f
--- /dev/null
+++ b/samples/drivers/watchdog/boards/opentitan_earlgrey.overlay
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2023 Rivos Inc.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/ {
+ aliases {
+ watchdog0 = &aontimer;
+ };
+};
+
+&aontimer {
+ status = "okay";
+};
diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/opentitan_earlgrey.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/opentitan_earlgrey.overlay
new file mode 100644
index 0000000..4d1b46f
--- /dev/null
+++ b/tests/drivers/watchdog/wdt_basic_api/boards/opentitan_earlgrey.overlay
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2023 Rivos Inc.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/ {
+ aliases {
+ watchdog0 = &aontimer;
+ };
+};
+
+&aontimer {
+ status = "okay";
+};