Watchdog triggers kernel start on system shutdown

Hello,

on the Colibri imx7d we are using the external watchdog rn5t618. The watchdog itself works properly: echo 1 > /dev/watchdog pings it; not pinging afterwards causes reboot; echo V > /dev/watchdog pauses the watchdog

When I run “shutdown -h now” and I did not start the watchdog at all (never sending anything to /dev/watchdog) the system shuts down cleanly.

However, when I had started the watchdog and then paused it, after sending “shutdown -h now” I see suddenly activity on the I2C lines to the watchdog and I see UBoot starting up again, booting the kernel and then the system stops.

Is there a way to prevent this unwanted boot-up shortly before the system stops?

Many thanks,
Otmar

Hi @Otmar@hexagon,

Thanks for using the Toradex Community.

Can you please state which version of the image you are using? As well as the Hardware version of your module?

Best Regards
Kevin

Hello Alex,

I’m using this Linux version:
Linux (4.14.170-3.0.4+gbaa6c24) on Colibri imx7d (/etc/issue:TDX X11 2.6-snapshot \n \l)

Regarding the hardware version, I’m not sure where to get it from. UBoot gives this at startup:

U-Boot 2019.07-3.0.4+g26d926e (May 28 2021 - 10:30:03 +0000)

CPU: Freescale i.MX7D rev1.3 1000 MHz (running at 792 MHz)
CPU: Extended Commercial temperature grade (-20C to 105C) at 30C
Reset cause: POR
DRAM: 1 GiB
PMIC: RN5T567 LSIVER=0x01 OTPVER=0x0d
MMC: FSL_SDHC: 1, FSL_SDHC: 0

Best regards,
Otmar

Hi @Otmar@hexagon,

Thanks for specifying.

I was able to reproduce the behaviour on my side and I noticed that this behaviour vanishes if you use BSP 5.2. Would upgrading to a newer version be a viable option for you?

If not there would be the option of trying to use the new watchdog driver in your image. This should remove the behaviour as well.

Best Regards
Kevin

Hello Kevin,
thank you very much for investigating this.

At the moment I would prefer not to change to the new BSP - I assume that means upgrading to Yocto Dunfell and Linux kernel 5.4. I’m afraid this would cause quite a migration effort. I’d rather try fixing the problem by replacing the driver file first.

You suggest that just taking the updated rn5t618_wdt.c will solve the problem? Or do I need to update some kernel sources too, like the higher-level watchdog_dev.c ?

Where should I obtain the source from? The kernel.org:
watchdog « drivers - kernel/git/stable/linux.git - Linux kernel stable tree
Or is there a modified version on a Toradex repository?

Many thanks,
Otmar

Hi @Otmar@hexagon,

yes indeed. That would mean Yocto dunfell and Linux Kernel 5.4. I can understand the hesitation and trying to fix it is surely a viable option.

It’s hard to tell what changes have to be made, to get it to work. I would suggest looking at the “diff” between the two versions of the drivers. The source you can get from our repo here.

Nevertheless, I would strongly recommend thinking about upgrading to the new version in a long term way. Version 4 is not anymore supported by Toradex and therefore we recommend upgrading to 5.4. If you need help in doing this, feel free to let us know.

Did this help you? Let me know about your progress.

Best Regards
Kevin

Hello Kevin,

I tried just replacing just the watchdog driver rn5t618_wdt.c, but the behaviour did not change. The code looks mostly similar, except for a few changes that seem more cosmetic. I will try changing higher-layer files next, if it is possible to port them with acceptable effort to the older kernel version.

Eventually, out plan is to migrate to a newer version, especially to get Yocto’s benefits up updated sources of the whole Linux system. So, if I get stuck patching the watchdog driver hierarchy, I assume we will have to take this step sooner than later.

Yes, your investigation and your replies have been very helpful, telling me that there is a version without this unwanted behaviour. Now its just a matter of finding and eliminating the differences.

Again, thank you very much for your support!
Otmar

Hello @Otmar@hexagon,

Thanks for the update.

We are glad to help.

I will leave this post open. So if you have further questions or are stuck somewhere you can continue to ask here.

Best Regards
Kevin