public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [bug] can't start watchdog on RK3288
@ 2025-10-14 12:45 Marius Dinu
  2025-10-14 18:12 ` Peter Robinson
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Dinu @ 2025-10-14 12:45 UTC (permalink / raw)
  To: u-boot; +Cc: Simon Glass, Philipp Tomsich, Kever Yang

Hi.

I have a bug to report. I tried starting the watchdog on Asus TinkerBoard S
(Rockchip RK3288), but it's not working. I investigated a little bit. Here's
what I found so far:

=> wdt dev watchdog@ff800000
drivers/core/ofnode.c:417-ofnode_read_u32_index() ofnode_read_u32_index: timeout-sec: (not found)
drivers/core/ofnode.c:417-ofnode_read_u32_index() ofnode_read_u32_index: hw_margin_ms: (not found)
drivers/core/ofnode.c:525-    ofnode_read_bool() ofnode_read_bool: u-boot,noautostart: false
drivers/core/ofnode.c:525-    ofnode_read_bool() ofnode_read_bool: u-boot,autostart: false
drivers/core/ofnode.c:540-    ofnode_read_prop() ofnode_read_prop: assigned-clock-rates: <not found>
drivers/core/uclass.c:546-uclass_get_device_by_ofnode() Looking for clock-controller@ff760000
drivers/core/uclass.c:397-uclass_find_device_by_ofnode() Looking for clock-controller@ff760000
drivers/core/uclass.c:406-uclass_find_device_by_ofnode()       - checking oscillator
drivers/core/uclass.c:406-uclass_find_device_by_ofnode()       - checking clock-controller@ff760000
drivers/core/uclass.c:416-uclass_find_device_by_ofnode()    - result for clock-controller@ff760000: clock-controller@ff760000 (ret=0)
drivers/core/uclass.c:549-uclass_get_device_by_ofnode()    - result for clock-controller@ff760000: clock-controller@ff760000 (ret=0)
Can't get the watchdog timer: watchdog@ff800000

It seems that the error is generated in designware_wdt_probe(), after
clk_enable(). Function clk_enable() runs on branch CLK_CCF=false. It returns
error from ops->enable. Struct ops is defined by driver: rockchip_rk3288_cru,
in drivers/clk/rockchip/clk_rk3288.c, but it doesn't have a .enable or
.disable component, so there is no ops->enable.

The solution to this one would probably be a stub for .enable. AFAIK, it's
always enabled.

I also tried to enable CLK_CCF (drivers from Linux tree), selecting the
watchdog works, but if I try to start it, the board immediately resets.
I have no ideea how to troubleshoot this one.

Thanks.
Marius


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug] can't start watchdog on RK3288
  2025-10-14 12:45 [bug] can't start watchdog on RK3288 Marius Dinu
@ 2025-10-14 18:12 ` Peter Robinson
  2025-10-14 19:41   ` Marius Dinu
  2025-10-16 10:26   ` Marius Dinu
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Robinson @ 2025-10-14 18:12 UTC (permalink / raw)
  To: Marius Dinu; +Cc: u-boot, Simon Glass, Philipp Tomsich, Kever Yang

Hi,

> I have a bug to report. I tried starting the watchdog on Asus TinkerBoard S
> (Rockchip RK3288), but it's not working. I investigated a little bit. Here's
> what I found so far:

What version of U-Boot is this? Does the watchdog work in Linux?

> => wdt dev watchdog@ff800000
> drivers/core/ofnode.c:417-ofnode_read_u32_index() ofnode_read_u32_index: timeout-sec: (not found)
> drivers/core/ofnode.c:417-ofnode_read_u32_index() ofnode_read_u32_index: hw_margin_ms: (not found)
> drivers/core/ofnode.c:525-    ofnode_read_bool() ofnode_read_bool: u-boot,noautostart: false
> drivers/core/ofnode.c:525-    ofnode_read_bool() ofnode_read_bool: u-boot,autostart: false
> drivers/core/ofnode.c:540-    ofnode_read_prop() ofnode_read_prop: assigned-clock-rates: <not found>
> drivers/core/uclass.c:546-uclass_get_device_by_ofnode() Looking for clock-controller@ff760000
> drivers/core/uclass.c:397-uclass_find_device_by_ofnode() Looking for clock-controller@ff760000
> drivers/core/uclass.c:406-uclass_find_device_by_ofnode()       - checking oscillator
> drivers/core/uclass.c:406-uclass_find_device_by_ofnode()       - checking clock-controller@ff760000
> drivers/core/uclass.c:416-uclass_find_device_by_ofnode()    - result for clock-controller@ff760000: clock-controller@ff760000 (ret=0)
> drivers/core/uclass.c:549-uclass_get_device_by_ofnode()    - result for clock-controller@ff760000: clock-controller@ff760000 (ret=0)
> Can't get the watchdog timer: watchdog@ff800000
>
> It seems that the error is generated in designware_wdt_probe(), after
> clk_enable(). Function clk_enable() runs on branch CLK_CCF=false. It returns
> error from ops->enable. Struct ops is defined by driver: rockchip_rk3288_cru,
> in drivers/clk/rockchip/clk_rk3288.c, but it doesn't have a .enable or
> .disable component, so there is no ops->enable.
>
> The solution to this one would probably be a stub for .enable. AFAIK, it's
> always enabled.
>
> I also tried to enable CLK_CCF (drivers from Linux tree), selecting the
> watchdog works, but if I try to start it, the board immediately resets.
> I have no ideea how to troubleshoot this one.
>
> Thanks.
> Marius
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug] can't start watchdog on RK3288
  2025-10-14 18:12 ` Peter Robinson
@ 2025-10-14 19:41   ` Marius Dinu
  2025-10-16 10:26   ` Marius Dinu
  1 sibling, 0 replies; 4+ messages in thread
From: Marius Dinu @ 2025-10-14 19:41 UTC (permalink / raw)
  To: Peter Robinson; +Cc: Marius Dinu, u-boot

On Tue, 2025-10-14 19.12.23 ++0100, Peter Robinson wrote:
> Hi,
> 
> > I have a bug to report. I tried starting the watchdog on Asus TinkerBoard S
> > (Rockchip RK3288), but it's not working. I investigated a little bit. Here's
> > what I found so far:
> 
> What version of U-Boot is this? Does the watchdog work in Linux?

Github master from 2025-07-29.
In Linux I can start busybox watchdog and there are no errros. I can see
class/watchdog/watchdog0/timeleft counting down and being reset, so it appears
to be working, but I never tried to let it reset the system.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug] can't start watchdog on RK3288
  2025-10-14 18:12 ` Peter Robinson
  2025-10-14 19:41   ` Marius Dinu
@ 2025-10-16 10:26   ` Marius Dinu
  1 sibling, 0 replies; 4+ messages in thread
From: Marius Dinu @ 2025-10-16 10:26 UTC (permalink / raw)
  To: Peter Robinson; +Cc: Marius Dinu, u-boot

On Tue, 2025-10-14 19.12.23 ++0100, Peter Robinson wrote:
> Hi,
> 
> > I have a bug to report. I tried starting the watchdog on Asus TinkerBoard S
> > (Rockchip RK3288), but it's not working. I investigated a little bit. Here's
> > what I found so far:
> 
> What version of U-Boot is this? Does the watchdog work in Linux?
> 
> > => wdt dev watchdog@ff800000
> > drivers/core/ofnode.c:417-ofnode_read_u32_index() ofnode_read_u32_index: timeout-sec: (not found)
> > drivers/core/ofnode.c:417-ofnode_read_u32_index() ofnode_read_u32_index: hw_margin_ms: (not found)
> > drivers/core/ofnode.c:525-    ofnode_read_bool() ofnode_read_bool: u-boot,noautostart: false
> > drivers/core/ofnode.c:525-    ofnode_read_bool() ofnode_read_bool: u-boot,autostart: false
> > drivers/core/ofnode.c:540-    ofnode_read_prop() ofnode_read_prop: assigned-clock-rates: <not found>
> > drivers/core/uclass.c:546-uclass_get_device_by_ofnode() Looking for clock-controller@ff760000
> > drivers/core/uclass.c:397-uclass_find_device_by_ofnode() Looking for clock-controller@ff760000
> > drivers/core/uclass.c:406-uclass_find_device_by_ofnode()       - checking oscillator
> > drivers/core/uclass.c:406-uclass_find_device_by_ofnode()       - checking clock-controller@ff760000
> > drivers/core/uclass.c:416-uclass_find_device_by_ofnode()    - result for clock-controller@ff760000: clock-controller@ff760000 (ret=0)
> > drivers/core/uclass.c:549-uclass_get_device_by_ofnode()    - result for clock-controller@ff760000: clock-controller@ff760000 (ret=0)
> > Can't get the watchdog timer: watchdog@ff800000
> >
> > It seems that the error is generated in designware_wdt_probe(), after
> > clk_enable(). Function clk_enable() runs on branch CLK_CCF=false. It returns
> > error from ops->enable. Struct ops is defined by driver: rockchip_rk3288_cru,
> > in drivers/clk/rockchip/clk_rk3288.c, but it doesn't have a .enable or
> > .disable component, so there is no ops->enable.
> >
> > The solution to this one would probably be a stub for .enable. AFAIK, it's
> > always enabled.
> >
> > I also tried to enable CLK_CCF (drivers from Linux tree), selecting the
> > watchdog works, but if I try to start it, the board immediately resets.
> > I have no ideea how to troubleshoot this one.
> >
> > Thanks.
> > Marius
> >

I updated to latest u-boot (yesterday's github) and I patched clk_rk3288.c:

diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c
index a4ff1c41abb..9cc883662ff 100644
--- a/drivers/clk/rockchip/clk_rk3288.c
+++ b/drivers/clk/rockchip/clk_rk3288.c
@@ -745,6 +745,10 @@ static ulong rockchip_saradc_set_clk(struct rockchip_cru *cru, uint hz)
 	return rockchip_saradc_get_clk(cru);
 }

+static int rk3288_clk_enable(struct clk *clk){
+	return 0;
+}
+
 static ulong rk3288_clk_get_rate(struct clk *clk)
 {
 	struct rk3288_clk_priv *priv = dev_get_priv(clk->dev);
@@ -947,6 +951,7 @@ static int __maybe_unused rk3288_clk_set_parent(struct clk *clk, struct clk *par
 }

 static struct clk_ops rk3288_clk_ops = {
+	.enable		= rk3288_clk_enable,
 	.get_rate	= rk3288_clk_get_rate,
 	.set_rate	= rk3288_clk_set_rate,
 #if CONFIG_IS_ENABLED(OF_REAL)

...and it works, but not exactly as it should.

wdt dev works
wdt start works, but the timeouts are all wrong
wdt reset works
wdt stop doesn't work

Timeouts:
wdt start 10000 => 1m27s until reset
wdt start 1000  => 1m27s
wdt start 200   => ~40s
wdt start 100   => ~10s
I measured timeouts while watching output via serial->microcom->ssh,
so they're not really precise.

Marius


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-16 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-14 12:45 [bug] can't start watchdog on RK3288 Marius Dinu
2025-10-14 18:12 ` Peter Robinson
2025-10-14 19:41   ` Marius Dinu
2025-10-16 10:26   ` Marius Dinu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox