rockchip: odroid-m1s/rk3566 watchdog support
Subsystems (3)
v2 cover rockchip: odroid-m1s/rk3566 watchdog support
This series makes the Synopsys DesignWare watchdog usable on rk3566/rk3568 and enables it on the Hardkernel ODROID-M1S.
On current next the dw-wdt driver already probes (d62801d09441), but a timeout or "wdt expire" still hangs the SoC: CRU_GLB_RST_CON routes the watchdog to the second global reset by default, which causes a hung SoC.
Patch 1 routes the watchdog to the first global reset instead, same as the PX30 implementation. Patch 2 does the same for the TSADC, so a thermal shutdown also resets the whole SoC. Patch 3 enables the watchdog (wdt command only, no autostart to be non-breaking) on the ODROID-M1S.
Verified on the ODROID-M1S (RK3566): a watchdog timeout cleanly reboots the board.
Changes in v2:
- patch 1: access CRU_GLB_RST_CON through the rk3568_cru struct, matching PX30's arch_cpu_init() (review comment by Quentin)
- patch 2 (new): also route the TSADC to a first global reset (review comment by Quentin)
- patch 3 (was 2/2): unchanged
On the TSADC (patch 2): while checking how the ODROID-M1S comes up, I noticed the rkbin DDR init (probably, at least I don't know what else could set it at that stage) already sets the TSADC bit in CRU_GLB_RST_CON before U-Boot runs. So, on this board the patch is effectively a no-op. It still seems right to configure it explicitly in U-Boot rather than depend on the firmware blob, and it matches what PX30 does.
Jonas: on v1 you raised two points on patch 1 - guarding the write on XPL_BUILD, and clearing SOC_CON1 so the watchdog reset behaves like the TF-A/PSCI reset. I replied on the thread [2]: I kept the write unconditional to match PX30 (and because U-Boot proper can be entered without our SPL having run, e.g. using an rkbin miniloader), and I posed the question if the watchdog actually *should* drop BOOT_MODE_REG for a clean recovery rather than preserve it.
I've left both as they were in v2, for now. Happy to do a v3, however, if you disagree on these points.
[2] https://lists.denx.de/pipermail/u-boot/2026-June/622663.html
Andreas Zdziarstek (3):
rockchip: rk3568: make the WDT trigger a first global reset
rockchip: rk3568: make the TSADC trigger a first global reset
rockchip: odroid-m1s: enable watchdog support
arch/arm/mach-rockchip/rk3568/rk3568.c | 14 ++++++++++++++ configs/odroid-m1s-rk3566_defconfig | 5 +++++ 2 files changed, 19 insertions(+)
base-commit: 835a18f80f25731dc818bf9b771bfa111ea3dbeb
Signature · 1 line
2.53.0
PATCH v2 1/3 rockchip: rk3568: make the WDT trigger a first global reset
Default is a second global reset which causes a system hang on a timeout in U-Boot.
Access the register through the rk3568_cru struct to match how PX30 does it in arch_cpu_init().
Verified on the Hardkernel ODROID-M1S (RK3566): a watchdog timeout now cleanly reboots the board.
--- arch/arm/mach-rockchip/rk3568/rk3568.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-rockchip/rk3568/rk3568.c +10 -0
@@ -9,6 +9,7 @@#include <misc.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> +#include <asm/arch-rockchip/cru_rk3568.h> #include <asm/arch-rockchip/grf_rk3568.h> #include <asm/arch-rockchip/hardware.h> #include <dt-bindings/clock/rk3568-cru.h>
@@ -37,6 +38,9 @@#define CPU_GRF_BASE 0xfdc30000#define GRF_CORE_PVTPLL_CON0 (0x10) +#define CRU_BASE 0xfdd20000 +#define WDT_GLB_SRST_CTRL BIT(1) +/* PMU_GRF_GPIO0D_IOMUX_L */ enum {GPIO0D1_SHIFT =4 ,
@@ -116,6 +120,8 @@ void board_debug_uart_init(void)int arch_cpu_init (void ) { +static struct rk3568_cru *const cru = (void *)CRU_BASE ; +#ifdef CONFIG_XPL_BUILD /* * When perform idle operation, corresponding clock can
@@ -146,6 +152,10 @@ int arch_cpu_init(void)writel ((PMU_PD_VO_DWN_ENA <<16 ),PMU_BASE_ADDR +PMU_PWR_GATE_SFTCON );#endif + +/* Make WDT trigger a first global reset */ +setbits_le32 (&cru->glb_rst_con,WDT_GLB_SRST_CTRL ); +return 0 ; }
Signature · 1 line
2.53.0
Re: [PATCH v2 1/3] rockchip: rk3568: make the WDT trigger a first global reset
Hi Andreas,
Quoted 46 lines · Andreas Zdziarstek
Default is a second global reset which causes a system hang on a timeout in U-Boot.
Access the register through the
rk3568_crustruct to match how PX30 does it inarch_cpu_init().Verified on the Hardkernel ODROID-M1S (RK3566): a watchdog timeout now cleanly reboots the board.
Signed-off-by Andreas Zdziarstek <[email protected]>--- arch/arm/mach-rockchip/rk3568/rk3568.c | 10 ++++++++++ 1 file changed, 10 insertions(+)arch/arm/mach-rockchip/rk3568/rk3568.c +6
-0@@ -9,6 +9,7 @@#include <misc.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> +#include <asm/arch-rockchip/cru_rk3568.h> #include <asm/arch-rockchip/grf_rk3568.h> #include <asm/arch-rockchip/hardware.h> #include <dt-bindings/clock/rk3568-cru.h> @@ -37,6 +38,9 @@#define CPU_GRF_BASE 0xfdc30000#define GRF_CORE_PVTPLL_CON0 (0x10) +#define CRU_BASE 0xfdd20000 +#define WDT_GLB_SRST_CTRL BIT(1) +/* PMU_GRF_GPIO0D_IOMUX_L */ enum {GPIO0D1_SHIFT =4 ,@@ -116,6 +120,8 @@ void board_debug_uart_init(void)int arch_cpu_init (void ) { +static struct rk3568_cru *const cru = (void *)CRU_BASE ; +#ifdef CONFIG_XPL_BUILD /* * When perform idle operation, corresponding clock can
arch/arm/mach-rockchip/rk3568/rk3568.c int arch_cpu_init(void) · line 157
Quoted 6 lines
arch/arm/mach-rockchip/rk3568/rk3568.c +3
-0@@ -146,6 +152,10 @@ int arch_cpu_init(void)writel ((PMU_PD_VO_DWN_ENA <<16 ),PMU_BASE_ADDR +PMU_PWR_GATE_SFTCON );#endif + +/* Make WDT trigger a first global reset */ +setbits_le32 (&cru->glb_rst_con,WDT_GLB_SRST_CTRL );
As mentioned in v1, please keep this inside XPL_BUILD.
SPL+U-Boot proper combined should be seen as a single firmware, we do not consider vendor SPL + mainline U-Boot proper a supported combo.
If you also want to configure this in U-Boot proper, maybe probe of WDT or CRU driver is a better fit?
arch_cpu_init() is mainly for one-off configuration that is needed very early or otherwise does not really fit anywhere in the lazy loading of driver model.
Regards,
Jonas
Quoted 4 lines
arch/arm/mach-rockchip/rk3568/rk3568.c +1
-0+return 0 ; }
PATCH v2 2/3 rockchip: rk3568: make the TSADC trigger a first global reset
In reply to Andreas ZdziarstekSame rationale as the watchdog: the default second global reset leaves the SoC hung. Set the TSADC to the first global reset as well, so a thermal shutdown reliably resets the whole SoC.
--- arch/arm/mach-rockchip/rk3568/rk3568.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mach-rockchip/rk3568/rk3568.c +4 -0
@@ -40,6 +40,7 @@#define CRU_BASE 0xfdd20000#define WDT_GLB_SRST_CTRL BIT(1) +#define TSADC_GLB_SRST_CTRL BIT(0)/* PMU_GRF_GPIO0D_IOMUX_L */ enum {
@@ -156,6 +157,9 @@ int arch_cpu_init(void)/* Make WDT trigger a first global reset */ setbits_le32 (&cru->glb_rst_con,WDT_GLB_SRST_CTRL ); +/* Make TSADC trigger a first global reset */ +setbits_le32 (&cru->glb_rst_con,TSADC_GLB_SRST_CTRL ); +return 0 ; }
Signature · 1 line
2.53.0
Re: [PATCH v2 2/3] rockchip: rk3568: make the TSADC trigger a first global reset
Hi Andreas,
Quoted 22 lines · Andreas Zdziarstek
Same rationale as the watchdog: the default second global reset leaves the SoC hung. Set the TSADC to the first global reset as well, so a thermal shutdown reliably resets the whole SoC.
Signed-off-by Andreas Zdziarstek <[email protected]>--- arch/arm/mach-rockchip/rk3568/rk3568.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/mach-rockchip/rk3568/rk3568.c +1
-0@@ -40,6 +40,7 @@#define CRU_BASE 0xfdd20000#define WDT_GLB_SRST_CTRL BIT(1) +#define TSADC_GLB_SRST_CTRL BIT(0)/* PMU_GRF_GPIO0D_IOMUX_L */ enum {
arch/arm/mach-rockchip/rk3568/rk3568.c int arch_cpu_init(void) · line 161
Quoted 5 lines
arch/arm/mach-rockchip/rk3568/rk3568.c +2
-0@@ -156,6 +157,9 @@ int arch_cpu_init(void)/* Make WDT trigger a first global reset */ setbits_le32 (&cru->glb_rst_con,WDT_GLB_SRST_CTRL ); +/* Make TSADC trigger a first global reset */ +setbits_le32 (&cru->glb_rst_con,TSADC_GLB_SRST_CTRL );
There is likely no need to read and write this reg twice, please combine.
Regards,
Jonas
Quoted 4 lines
arch/arm/mach-rockchip/rk3568/rk3568.c +1
-0+return 0 ; }
PATCH v2 3/3 rockchip: odroid-m1s: enable watchdog support
In reply to Andreas ZdziarstekThe rk3566 ODROID-M1S has a DesignWare watchdog. Enable CONFIG_WDT, CONFIG_DESIGNWARE_WATCHDOG and CONFIG_CMD_WDT so it can be driven via the wdt command.
CONFIG_WATCHDOG and CONFIG_WATCHDOG_AUTOSTART are left explicitly unset to not cause any breaking changes on existing systems.
--- configs/odroid-m1s-rk3566_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
configs/odroid-m1s-rk3566_defconfig +5 -0
@@ -30,6 +30,7 @@ CONFIG_CMD_PCI=y CONFIG_CMD_USB=y CONFIG_CMD_ROCKUSB=y CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_WDT=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_INI=y CONFIG_CMD_PMIC=y
@@ -87,5 +88,9 @@ CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_FUNCTION_ROCKUSB=y +# CONFIG_WATCHDOG is not set +# CONFIG_WATCHDOG_AUTOSTART is not set +CONFIG_DESIGNWARE_WATCHDOG=y +CONFIG_WDT=y CONFIG_FS_CRAMFS=y CONFIG_ERRNO_STR=y
Signature · 1 line
2.53.0