Skip to contentSkip to conversation

rockchip: odroid-m1s/rk3566 watchdog support

PATCH Superseded Andreas Zdziarstek 3 participants 11 messages Jun 19 – Jun 23

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover rockchip: odroid-m1s/rk3566 watchdog support

I experimented with the Synopsys DesignWare watchdog on an Odroid-M1S (RK3566). On current master, the watchdog is present in device-tree. After activating the relevant options in .config, U-Boot tried probing it but failed, aborting at a failing clk_enable(). Current next branch already has a patch for that in the driver (d62801d09441) and with that wdt query and servicing works.

However, a timeout or wdt expire causes a hung SoC. There are two possible "global resets" the watchdog may trigger, set in the CRU registers, as per the TRM. Default is the "second" reset.

Unfortunately, the TRM is rather tight-lipped about what each one really does. Per experimentation: Setting it to the "first" global reset fixes the hang and makes the watchdog work as expected in U-Boot. This is the first patch. As the PX30 does the same thing in its arch_cpu_init(), I believe this to be the way to go but I am curious to hear if anybody has more technical insight on this.

Second patch adds watchdog support (per wdt command) to the Odroid-M1S defconfig, which was my original goal. I didn't enable AUTOSTART and cyclic servicing to not break any existing systems. However, I tested both and they too work as expected with the reset fix.

Andreas Zdziarstek (2):
rockchip: rk3568: make the WDT trigger a first global reset
rockchip: odroid-m1s: enable watchdog support

 arch/arm/mach-rockchip/rk3568/rk3568.c | 8 ++++++++
 configs/odroid-m1s-rk3566_defconfig    | 5 +++++
 2 files changed, 13 insertions(+)

base-commit: 298d44464dc63a4f3f5489150acd7958f359f9bd

Signature · 1 line
2.53.0
#1 lore raw

PATCH 1/2 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.

Verified on the Hardkernel ODROID-M1S (RK3566): a watchdog timeout now cleanly reboots the board.

---
 arch/arm/mach-rockchip/rk3568/rk3568.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/mach-rockchip/rk3568/rk3568.c +8 -0
index 2b1eafee37c..77610a6a6ec 100644
@@ -37,6 +37,10 @@
 #define CPU_GRF_BASE		0xfdc30000
 #define GRF_CORE_PVTPLL_CON0	(0x10)
 
+#define CRU_BASE		0xfdd20000
+#define CRU_GLB_RST_CON		(CRU_BASE + 0x0dc)
+#define WDT_GLB_SRST_CTRL	BIT(1)
+
 /* PMU_GRF_GPIO0D_IOMUX_L */
 enum {
 	GPIO0D1_SHIFT		= 4,
@@ -146,6 +150,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((void __iomem *)CRU_GLB_RST_CON, WDT_GLB_SRST_CTRL);
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH 1/2] rockchip: rk3568: make the WDT trigger a first global reset

Hi Andreas,

Quoted 29 lines · Andreas Zdziarstek

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Default is a second global reset which causes a system hang on a timeout in U-Boot.

Verified on the Hardkernel ODROID-M1S (RK3566): a watchdog timeout now cleanly reboots the board.

---
  arch/arm/mach-rockchip/rk3568/rk3568.c | 8 ++++++++
  1 file changed, 8 insertions(+)
arch/arm/mach-rockchip/rk3568/rk3568.c +4 -0
index 2b1eafee37c..77610a6a6ec 100644
@@ -37,6 +37,10 @@
  #define CPU_GRF_BASE           0xfdc30000
  #define GRF_CORE_PVTPLL_CON0   (0x10)
 
+#define CRU_BASE               0xfdd20000
+#define CRU_GLB_RST_CON                (CRU_BASE + 0x0dc)
+#define WDT_GLB_SRST_CTRL      BIT(1)
+
  /* PMU_GRF_GPIO0D_IOMUX_L */
  enum {
         GPIO0D1_SHIFT           = 4,

arch/arm/mach-rockchip/rk3568/rk3568.c int arch_cpu_init(void) · line 156

Quoted 7 lines
arch/arm/mach-rockchip/rk3568/rk3568.c +4 -0
@@ -146,6 +150,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((void __iomem *)CRU_GLB_RST_CON, WDT_GLB_SRST_CTRL);
+

You should be able to use:

#define CRU_BASE 0xfdd20000

int arch_cpu_init(void)

{
    static struct rk3568_cru * const cru = (void *)CRU_BASE;
[...]
    setbits_le32(&cru->glb_rst_con, WDT_GLB_SRST_CTRL);
}

and it would match how we did it for PX30. It's not a big deal if we keep's in this patch though.

I think we should probably enable the second global reset for TSADC as well, like we did on PX30. While we don't have a driver for it in U-Boot, we do in the Linux kernel and we don't configure the global reset level there I think? So a thermal shutdown would properly also reset the whole SoC (or as much as allowed by Rockchip :) ).

What do you think?

Cheers,
Quentin

#3 lore raw

Re: [PATCH 1/2] rockchip: rk3568: make the WDT trigger a first global reset

Hi Quentin,

Am Di., 23. Juni 2026 um 11:25 Uhr schrieb Quentin Schulz <[email protected]>:

Quoted 9 lines

Hi Andreas,

On 6/20/26 12:08 AM, Andreas Zdziarstek wrote:

You should be able to use:

#define CRU_BASE 0xfdd20000

Quoted 8 lines

int arch_cpu_init(void)

{
     static struct rk3568_cru * const cru = (void *)CRU_BASE;
[...]
     setbits_le32(&cru->glb_rst_con, WDT_GLB_SRST_CTRL);
}

and it would match how we did it for PX30.

Ok, makes sense. ty

Quoted 8 lines

I think we should probably enable the second global reset for TSADC as well, like we did on PX30. While we don't have a driver for it in U-Boot, we do in the Linux kernel and we don't configure the global reset level there I think? So a thermal shutdown would properly also reset the whole SoC (or as much as allowed by Rockchip :) ).

What do you think?

I'll have a look at the Kernel. Could be a good thing to add in general. I am a little unsure though if it belongs more into the Kernel if U-boot does not use it?

For now, I'll make a v2 series using the struct schema. I will also add a commit for the TSADC reset. Then we can decide if we keep it in or defer.

Cheers,
Andreas

#4 lore raw

Re: [PATCH 1/2] rockchip: rk3568: make the WDT trigger a first global reset

In reply to Andreas Zdziarstek

Hi Andreas,

Quoted 27 lines · Andreas Zdziarstek

Default is a second global reset which causes a system hang on a timeout in U-Boot.

Verified on the Hardkernel ODROID-M1S (RK3566): a watchdog timeout now cleanly reboots the board.

---
 arch/arm/mach-rockchip/rk3568/rk3568.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/mach-rockchip/rk3568/rk3568.c +4 -0
index 2b1eafee37c..77610a6a6ec 100644
@@ -37,6 +37,10 @@
 #define CPU_GRF_BASE		0xfdc30000
 #define GRF_CORE_PVTPLL_CON0	(0x10)
 
+#define CRU_BASE		0xfdd20000
+#define CRU_GLB_RST_CON		(CRU_BASE + 0x0dc)
+#define WDT_GLB_SRST_CTRL	BIT(1)
+
 /* PMU_GRF_GPIO0D_IOMUX_L */
 enum {
 	GPIO0D1_SHIFT		= 4,

arch/arm/mach-rockchip/rk3568/rk3568.c int arch_cpu_init(void) · line 155

Quoted 6 lines
arch/arm/mach-rockchip/rk3568/rk3568.c +3 -0
@@ -146,6 +150,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((void __iomem *)CRU_GLB_RST_CON, WDT_GLB_SRST_CTRL);

It should likely be enough to configure this in XPL_BUILD?

We should possibly also clear SOC_CON1 to handle reset in similar way as TF-A / PSCI reset. RK356x boards use PSCI reset in U-Boot proper primarily to work around issues found when working on [1], using first global reset seemed to wipe too much information we may want to retain.

[1] https://lore.kernel.org/u-boot/[email protected]/

Regards,
Jonas

Quoted 4 lines
arch/arm/mach-rockchip/rk3568/rk3568.c +1 -0
+
 	return 0;
 }
 
#5 lore raw

Re: [PATCH 1/2] rockchip: rk3568: make the WDT trigger a first global reset

Hi Jonas

Am Di., 23. Juni 2026 um 12:53 Uhr schrieb Jonas Karlman <[email protected]>:

Quoted 1 line

It should likely be enough to configure this in XPL_BUILD?

Generally yes. I'd like to point out though, that PX30 currently sets it unconditionally
as well. I thought there may be valid reason to do so in cases where we don't actually
use the mainline SPL but an rkbin miniloader blob or something. There was a mention
of that in rockchip.rst.

In that case, moving it into XPL_BUILD might break, depending on whatever the mini-
loader does.

Quoted 7 lines

We should possibly also clear SOC_CON1 to handle reset in similar way as TF-A / PSCI reset. RK356x boards use PSCI reset in U-Boot proper primarily to work around issues found when working on [1], using first global reset seemed to wipe too much information we may want to retain.

[1] https://lore.kernel.org/u-boot/[email protected]/

If we want to clear SOC_CON1, we must do it at init as well, as there is (I think)
no good way to clear it during a WDT reset as it's hardware-autonomous. So this would make the BOOT_MODE_REG survive every global reset regardless of cause. Is that the intention?

I could see a wrinkle with a watchdog specifically: What if the cause of the WDT reboot is related to BOOT_MODE_REG? E.g. we built a U-Boot that somehow locks up during USB boot, then trips the watchdog. The philosophical question
now: Should the watchdog go back to maskrom again or resume the standard boot behavior? I guess my expectation would be the latter but not totally sure.

Best,
Andreas

#6 lore raw

PATCH 2/2 rockchip: odroid-m1s: enable watchdog support

In reply to Andreas Zdziarstek

The 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
index d59882a2a59..943c0509e9e 100644
@@ -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
Reviewed-by on v1 2/2
#7 lore raw

Re: [PATCH 2/2] rockchip: odroid-m1s: enable watchdog support

Hi Andreas,

Quoted 9 lines · Andreas Zdziarstek

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

The 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.

Please note that an SoC watchdog may not be enough to be able to properly restart a board. When IO domains are in play (they are for the overwhelming majority of Rockchip SoCs), the SoC with the default IO domain configuration may expect a different voltage than provided by the PMIC, since the PMIC won't (necessarily) be reset along with the SoC. This is an issue on our PX30 Ringneck for example where you cannot use a watchdog reset if you're booting from SD card otherwise the BootROM won't be able to interact with the device after a watchdog reset (due to the power rails being stuck at 1.8V while 3+V is expected by default). Unfortunately, the Rockchip PMIC on our PX30 Ringneck (and on your Odroid M1S) does not have a watchdog so that's not an option.

Cheers,
Quentin

#8 lore raw
In reply to Andreas Zdziarstek

Hi Andreas,

Quoted 9 lines · Andreas Zdziarstek

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

I experimented with the Synopsys DesignWare watchdog on an Odroid-M1S (RK3566). On current master, the watchdog is present in device-tree. After activating the relevant options in .config, U-Boot tried probing it but failed, aborting at a failing clk_enable(). Current next branch already has a patch for that in the driver (d62801d09441) and with that wdt query and servicing works.

Quoted 6 lines

However, a timeout or wdt expire causes a hung SoC. There are two possible "global resets" the watchdog may trigger, set in the CRU registers, as per the TRM. Default is the "second" reset.

Unfortunately, the TRM is rather tight-lipped about what each one really does. Per experimentation: Setting it to the "first" global reset fixes

As per TRM (2.8.4 Global Software Reset):

"""
glb_srstn_1 resets almost all logic except some registers just supporting hardware reset. glb_srstn_2 resets almost all logic except GRFs and GPIOs.
"""

which is similarly worded in PX30 TRM for example.

Quoted 5 lines

the hang and makes the watchdog work as expected in U-Boot. This is the first patch. As the PX30 does the same thing in its arch_cpu_init(), I believe this to be the way to go but I am curious to hear if anybody has more technical insight on this.

I'm not sure there's much more we can know (would debugging this with JTAG help? I've never used it so don't know). But it's been a pain point on various Rockchip SoCs already, I'm quite surprised the default is still global reset 1 and not global reset 2.

Cheers,
Quentin

#9 lore raw

Hi Quentin,

Am Di., 23. Juni 2026 um 11:10 Uhr schrieb Quentin Schulz <[email protected]>:

Quoted 5 lines
Quoted 2 lines

Unfortunately, the TRM is rather tight-lipped about what each one really does. Per experimentation: Setting it to the "first" global reset fixes

As per TRM (2.8.4 Global Software Reset):

Quoted 8 lines

"""
glb_srstn_1 resets almost all logic except some registers just supporting hardware reset.
glb_srstn_2 resets almost all logic except GRFs and GPIOs. """

which is similarly worded in PX30 TRM for example.

Yep, it certainly sounds like srstn_1 is the more "complete" reset but that's mostly just a guess from the wording

Quoted 10 lines
Quoted 5 lines

the hang and makes the watchdog work as expected in U-Boot. This is the first patch. As the PX30 does the same thing in its arch_cpu_init(), I believe this to be the way to go but I am curious to hear if anybody has more technical insight on this.

I'm not sure there's much more we can know (would debugging this with JTAG help? I've never used it so don't know). But it's been a pain point on various Rockchip SoCs already, I'm quite surprised the default is still global reset 1 and not global reset 2.

It seemed to me that the default is just "don't touch the register bit". The hardware initialization value is 0 which triggers srstn_2. The question is if srstn_2 might be the correct choice for some boards? As you say this has been a problem on other SoCs already, I would guess "not likely".

I have a little prior JTAG Debugging experience but no usable hardware in my private posession. (Don't think the Odroid has the relevant pins even broken out). However, I doubt we could do much more with it than confirm if srst_2 locks up the SoC or if it hangs for some other reason.

Cheers,
Andreas

#10 lore raw
Quoted 16 lines · Andreas Zdziarstek

Hi Quentin,

Am Di., 23. Juni 2026 um 11:10 Uhr schrieb Quentin Schulz <[email protected]>:

Quoted 11 lines
Quoted 2 lines

Unfortunately, the TRM is rather tight-lipped about what each one really does. Per experimentation: Setting it to the "first" global reset fixes

As per TRM (2.8.4 Global Software Reset):

"""
glb_srstn_1 resets almost all logic except some registers just supporting hardware reset.
glb_srstn_2 resets almost all logic except GRFs and GPIOs. """

Quoted 17 lines
Quoted 2 lines

which is similarly worded in PX30 TRM for example.

Yep, it certainly sounds like srstn_1 is the more "complete" reset but that's mostly just a guess from the wording

Quoted 10 lines
Quoted 5 lines

the hang and makes the watchdog work as expected in U-Boot. This is the first patch. As the PX30 does the same thing in its arch_cpu_init(), I believe this to be the way to go but I am curious to hear if anybody has more technical insight on this.

I'm not sure there's much more we can know (would debugging this with JTAG help? I've never used it so don't know). But it's been a pain point on various Rockchip SoCs already, I'm quite surprised the default is still global reset 1 and not global reset 2.

For posterity, I meant the opposite :) Why did Rockchip decide on "partial reset is a good default"? (second global reset is the register reset value, and here we set first global reset). But that may be the reason why I cannot boot from SD card after a watchdog reset on PX30 Ringneck from Linux then. I wonder if I revert this back to first global reset if the IO domain (configured in the GRF!) is kept properly configured and can again boot from SD card after an SoC watchdog reset! Will give this a try one day.

Quoted 9 lines

It seemed to me that the default is just "don't touch the register bit". The hardware initialization value is 0 which triggers srstn_2. The question is if srstn_2 might be the correct choice for some boards? As you say this has been a problem on other SoCs already, I would guess "not likely".

Quoted 1 line

I have a little prior JTAG Debugging experience but no usable hardware in

my private posession. (Don't think the Odroid has the relevant pins even broken out). However, I doubt we could do much more with it than confirm if srst_2 locks up the SoC or if it hangs for some other reason.

I guess we could check where the SoC is stuck? I believe Rockchip always expose the JTAG on the same pins as the SD card controller. But again, I've never used or set up JTAG on those boards so wouldn't be able to help here.

Cheers,
Quentin