Watchdog device on RK3328 (Rock64)

This is for ARMv8 based devices

Watchdog device on RK3328 (Rock64)

Postby berturion » Fri Sep 14, 2018 5:52 pm

Hello,
I can't find any watchdog device on my Rock64 board. Is there any ? Is this a lack of support from the archlinuxarm mainline kernel ?
Anyone did succeed to configure the watchdog for Rock64 with archlinuxarm ?
Thanks.
:D
Last edited by berturion on Mon Sep 17, 2018 3:23 pm, edited 1 time in total.
berturion
 
Posts: 11
Joined: Mon Jun 18, 2018 10:54 am

Re: Watchdog device on rk3288 (Rock64)

Postby summers » Sat Sep 15, 2018 6:47 am

Must admit I'm confused by the question.

Not over the rk3288 watchdog, you can almost certainly get the answer by reading the data sheet: http://opensource.rock-chips.com/images/4/4e/Rockchip_RK3288_Datasheet_V2.2-20170301.pdf

I'd expect that it does have a watchdog. But what confuses me is what is your use case? How are you trying to use it?

Only time I recall watchdog talked about else where was on the BBB, when loading a kernel over serial via uboot and xmodem, the watchdog would reset the machine, before transfer completed. IIRC its why the BBB sets various gpio pins in uboot - before booting, IIRC this is to disable the watchdog.

But sounds like you want to use it for something specific - can you explain some more?
summers
 
Posts: 463
Joined: Sat Sep 06, 2014 12:56 pm

Re: Watchdog device on rk3288 (Rock64)

Postby berturion » Sun Sep 16, 2018 9:25 am

It is in the case where my system hangs and doesn't respond anymore. It happens sometimes and I would like to trigger a reboot. My previous board was a RPI3 and had a /dev/watchdog device. How can I do to enable the watchdog device if there is any on this board ?
berturion
 
Posts: 11
Joined: Mon Jun 18, 2018 10:54 am

Re: Watchdog device on rk3288 (Rock64)

Postby summers » Sun Sep 16, 2018 11:12 am

So you want to use the watchdog in its usual way. Checking the data sheet the rk3288 has a watchdog. So this means the question is does the linux kernel support the rk3288 watchdog device. I'll do some searching.

It not really an arch issue at this stage, its more does the kernel support it.

OK its in the device tree: https://github.com/torvalds/linux/blob/27c5a778dfe23d1de8d9ebfbc6a54595a79ac709/arch/arm/boot/dts/rk3288.dtsi#L918. Look like its a memory mapped device, that also has an interrupt. So check this node is /proc/device-tree. Then its a question of finding which linux driver talks to the device. if its in the device tree, check what dmesg says on boot - hopefully something is picking up on the device ...

Chapter 14 gives a reasonable descript of the device http://opensource.rock-chips.com/images/8/8f/Rockchip_RK3288_TRM_V1.2_Part1-20170321.pdf - so just a question of is there a kernel driver.

Device tree identifies as: Synopsys Designware Watchdog Timer ...

And this looks like the kernel driver: https://github.com/torvalds/linux/blob/master/drivers/watchdog/dw_wdt.c

As far as I can see - dw_wdt is set up in the standard linux watchdog way, so it loaded - which it should be, the device should work as any other watchdog. So can you check dw_wdt is loaded, e.g grep for it in dmesg. If not loaded, try loading it with modprobe - and see what happens ...

And checking on my odroid-c2 that uses meson_gxbb_wdt; it is loaded (so shows in lsmod) and I have a /dev/watchdog device, but the module was quiet on start up - so nothing in dmesg ...

Any out of interest, is there a reason why your machine hangs? Linux is usually fairly stable - I've seen machines in the past that have been up for years without crashing. So is there something odd with your set up? E.g. erratic power?
summers
 
Posts: 463
Joined: Sat Sep 06, 2014 12:56 pm

Re: Watchdog device on rk3288 (Rock64)

Postby berturion » Mon Sep 17, 2018 7:36 am

Thanks for your detail answer ;)

I rebooted my machine and lsmod shows that the module dw_wdt is loaded:

Code: Select all
# lsmod
Module                  Size  Used by
cfg80211              733184  0
rfkill                 32768  2 cfg80211
8021q                  36864  0
garp                   16384  1 8021q
mrp                    20480  1 8021q
stp                    16384  1 garp
llc                    16384  2 stp,garp
rc_dib0700_rc5         16384  0
dib7000p               45056  2
dvb_usb_dib0700       163840  2
dib7000m               28672  1 dvb_usb_dib0700
dib0090                36864  1 dvb_usb_dib0700
dib0070                20480  3 dvb_usb_dib0700
dib3000mc              24576  1 dvb_usb_dib0700
dibx000_common         16384  4 dib7000p,dib7000m,dib3000mc,dvb_usb_dib0700
dvb_usb                32768  1 dvb_usb_dib0700
dvb_core              139264  2 dib7000p,dvb_usb
rc_core                53248  4 dvb_usb,dvb_usb_dib0700,rc_dib0700_rc5
realtek                16384  1
rtc_rk808              16384  1
dwmac_rk               28672  0
stmmac_platform        20480  1 dwmac_rk
rockchip_thermal       24576  0
stmmac                163840  2 stmmac_platform,dwmac_rk
dw_wdt                 16384  0


Here is the device-tree:

Code: Select all
# ls -al /proc/device-tree/
total 0
drwxr-xr-x 60 root root  0 Sep 15 02:07  .
drwxr-xr-x  3 root root  0 Sep 15 02:07  ..
drwxr-xr-x  2 root root  0 Sep 17 11:27  adc@ff280000
-r--r--r--  1 root root  4 Sep 17 11:27 '#address-cells'
drwxr-xr-x  2 root root  0 Sep 17 11:27  aliases
drwxr-xr-x  3 root root  0 Sep 17 11:27  amba
drwxr-xr-x  2 root root  0 Sep 17 11:27  arm-pmu
drwxr-xr-x  2 root root  0 Sep 17 11:27  chosen
drwxr-xr-x  2 root root  0 Sep 17 11:27  clock-controller@ff440000
-r--r--r--  1 root root 30 Sep 17 11:27  compatible
drwxr-xr-x  7 root root  0 Sep 17 11:27  cpus
drwxr-xr-x  2 root root  0 Sep 17 11:27  dwmmc@ff500000
drwxr-xr-x  2 root root  0 Sep 17 11:27  dwmmc@ff510000
drwxr-xr-x  2 root root  0 Sep 17 11:27  dwmmc@ff520000
drwxr-xr-x  6 root root  0 Sep 17 11:27  efuse@ff260000
drwxr-xr-x  2 root root  0 Sep 17 11:27  ethernet@ff540000
drwxr-xr-x  3 root root  0 Sep 17 11:27  ethernet@ff550000
drwxr-xr-x  2 root root  0 Sep 17 11:27  external-gmac-clock
drwxr-xr-x  2 root root  0 Sep 17 11:27  gpu@ff300000
drwxr-xr-x  2 root root  0 Sep 17 11:27  i2c@ff150000
drwxr-xr-x  3 root root  0 Sep 17 11:27  i2c@ff160000
drwxr-xr-x  2 root root  0 Sep 17 11:27  i2c@ff170000
drwxr-xr-x  2 root root  0 Sep 17 11:27  i2c@ff180000
drwxr-xr-x  2 root root  0 Sep 17 11:27  i2s@ff000000
drwxr-xr-x  2 root root  0 Sep 17 11:27  i2s@ff010000
drwxr-xr-x  2 root root  0 Sep 17 11:27  i2s@ff020000
drwxr-xr-x  2 root root  0 Sep 17 11:27  interrupt-controller@ff811000
-r--r--r--  1 root root  4 Sep 17 11:27  interrupt-parent
drwxr-xr-x  2 root root  0 Sep 17 11:27  iommu@ff330200
drwxr-xr-x  2 root root  0 Sep 17 11:27  iommu@ff340800
drwxr-xr-x  2 root root  0 Sep 17 11:27  iommu@ff350800
drwxr-xr-x  2 root root  0 Sep 17 11:27  iommu@ff360480
drwxr-xr-x  2 root root  0 Sep 17 11:27  iommu@ff373f00
drwxr-xr-x  2 root root  0 Sep 17 11:27  memory
-r--r--r--  1 root root 14 Sep 17 11:27  model
-r--r--r--  1 root root  1 Sep 17 11:27  name
drwxr-xr-x  8 root root  0 Sep 17 11:27  opp_table0
drwxr-xr-x  2 root root  0 Sep 17 11:27  pdm@ff040000
drwxr-xr-x 61 root root  0 Sep 17 11:27  pinctrl
drwxr-xr-x  2 root root  0 Sep 17 11:27  psci
drwxr-xr-x  2 root root  0 Sep 17 11:27  pwm@ff1b0000
drwxr-xr-x  2 root root  0 Sep 17 11:27  pwm@ff1b0010
drwxr-xr-x  2 root root  0 Sep 17 11:27  pwm@ff1b0020
drwxr-xr-x  2 root root  0 Sep 17 11:27  pwm@ff1b0030
drwxr-xr-x  2 root root  0 Sep 17 11:27  sdmmc-regulator
drwxr-xr-x  2 root root  0 Sep 17 11:27  serial@ff110000
drwxr-xr-x  2 root root  0 Sep 17 11:27  serial@ff120000
drwxr-xr-x  2 root root  0 Sep 17 11:27  serial@ff130000
-r--r--r--  1 root root  4 Sep 17 11:27 '#size-cells'
drwxr-xr-x  2 root root  0 Sep 17 11:27  spdif@ff030000
drwxr-xr-x  2 root root  0 Sep 17 11:27  spi@ff190000
drwxr-xr-x  2 root root  0 Sep 17 11:27  __symbols__
drwxr-xr-x  5 root root  0 Sep 17 11:27  syscon@ff100000
drwxr-xr-x  3 root root  0 Sep 17 11:27  syscon@ff450000
drwxr-xr-x  3 root root  0 Sep 17 11:27  thermal-zones
drwxr-xr-x  2 root root  0 Sep 17 11:27  timer
drwxr-xr-x  2 root root  0 Sep 17 11:27  tsadc@ff250000
drwxr-xr-x  2 root root  0 Sep 17 11:27  usb@ff580000
drwxr-xr-x  2 root root  0 Sep 17 11:27  usb@ff5c0000
drwxr-xr-x  2 root root  0 Sep 17 11:27  usb@ff5d0000
drwxr-xr-x  3 root root  0 Sep 17 11:27  usb@ff600000
drwxr-xr-x  2 root root  0 Sep 17 11:27  vcc-host1-5v-regulator
drwxr-xr-x  2 root root  0 Sep 17 11:27  vcc-host-5v-regulator
drwxr-xr-x  2 root root  0 Sep 17 11:27  vcc-sys
drwxr-xr-x  2 root root  0 Sep 17 11:27  watchdog@ff1a0000
drwxr-xr-x  2 root root  0 Sep 17 11:27  xin24m


Regarding this, I understand that the device is watchdog@ff1a0000.

Since last kernel versions, I do not have system hangs anymore. So this watchdog should not be useful but I like to know my machines well. It is more for curiosity now :)

Now that I know that the watchdog is supported by the kernel and loaded, what should I configure as watchdog device in the watchdog.conf file ?

EDIT: I forgot to grep dmesg and there is this error:
Code: Select all
[    8.941841] dw_wdt: probe of ff1a0000.watchdog failed with error -2
berturion
 
Posts: 11
Joined: Mon Jun 18, 2018 10:54 am

Re: Watchdog device on rk3288 (Rock64)

Postby summers » Mon Sep 17, 2018 10:20 am

Whats odd is that the device tree said
Code: Select all
   wdt: watchdog@ff800000
, whilst the kernel when it booted said
Code: Select all
/proc/device-tree/watchdog@ff1a0000
- so it looks like it is going for a different memory mapped location - which is strange.

If you look in the directory
Code: Select all
/proc/device-tree/watchdog@ff1a0000
it may have some interesting info - e.g. "status" should contain "okay" which means its running.

on the "dw_wdt" we should hopefully be able to swicth on more info when its it loaded, IIRC there is a command like "modinfo dw_wdt" that will tell you want you can set ...
summers
 
Posts: 463
Joined: Sat Sep 06, 2014 12:56 pm

Re: Watchdog device on rk3288 (Rock64)

Postby berturion » Mon Sep 17, 2018 10:58 am

Yes it's odd..

Here are the commands results:

Code: Select all
# ls -al /proc/device-tree/watchdog@ff1a0000
total 0
drwxr-xr-x  2 root root  0 Sep 17 11:27 .
drwxr-xr-x 60 root root  0 Sep 15 02:07 ..
-r--r--r--  1 root root 12 Sep 17 14:53 compatible
-r--r--r--  1 root root 12 Sep 17 14:53 interrupts
-r--r--r--  1 root root  9 Sep 17 14:53 name
-r--r--r--  1 root root  4 Sep 17 14:53 phandle
-r--r--r--  1 root root 16 Sep 17 14:53 reg


Code: Select all
# cat /proc/device-tree/watchdog\@ff1a0000/name
watchdog
# cat /proc/device-tree/watchdog\@ff1a0000/compatible
snps,dw-wdt
# cat /proc/device-tree/watchdog\@ff1a0000/interrupts
(
# cat /proc/device-tree/watchdog\@ff1a0000/phandle
h
# cat /proc/device-tree/watchdog\@ff1a0000/reg
�[


Code: Select all
# modinfo dw_wdt
filename:       /lib/modules/4.18.8-1-ARCH/kernel/drivers/watchdog/dw_wdt.ko.gz
license:        GPL
description:    Synopsys DesignWare Watchdog Driver
author:         Jamie Iles
alias:          of:N*T*Csnps,dw-wdtC*
alias:          of:N*T*Csnps,dw-wdt
depends:       
intree:         Y
name:           dw_wdt
vermagic:       4.18.8-1-ARCH SMP mod_unload aarch64
parm:           nowayout:Watchdog cannot be stopped once started (default=0) (bool)
berturion
 
Posts: 11
Joined: Mon Jun 18, 2018 10:54 am

Re: Watchdog device on rk3288 (Rock64)

Postby summers » Mon Sep 17, 2018 2:49 pm

Just a thought - do you mean rk3288 or rk3328 ...

could explain some confusion here ...

https://github.com/torvalds/linux/blob/27c5a778dfe23d1de8d9ebfbc6a54595a79ac709/arch/arm64/boot/dts/rockchip/rk3328.dtsi#L392

An on the pine64 rock64 device tree the watchdog isn't enabled in the device tree ...
summers
 
Posts: 463
Joined: Sat Sep 06, 2014 12:56 pm

Re: Watchdog device on RK3328 (Rock64)

Postby berturion » Mon Sep 17, 2018 3:24 pm

You're right, I am sorry, It is RK3328 of course, as it is the Rock64 board. I edited the title of my first post.
berturion
 
Posts: 11
Joined: Mon Jun 18, 2018 10:54 am

Re: Watchdog device on RK3328 (Rock64)

Postby summers » Mon Sep 17, 2018 5:08 pm

Ok makes it clearer - so it isn't enabled in the default linux device tree, but is described.

Now we don't know why its not enabled, but we could switch it on and see whats happens. Now we can only switch in on before boot, and this means we have to switch on in uboot. So how does your machine boot?

Do you have

Code: Select all
/boot/boot.{scr,txt}


If so can you post the content of
Code: Select all
/boot/boot.txt
I can then give you the changes to switch the watchdog on. Can't say what it will do though ...
summers
 
Posts: 463
Joined: Sat Sep 06, 2014 12:56 pm

Next

Return to ARMv8 Devices

Who is online

Users browsing this forum: No registered users and 0 guests