The watchdog timer, set to specific time intervals, handles gross system misbehavior. The watchdog timer can be enabled or disabled depending on the operating condition. Once the watchdog timer is activated, it must be serviced by software on a periodic basis. If servicing does not take place in time, the watchdog times out and issues a system reset.

The ConnectCore MP25 has:

  • Three watchdogs available on the STM32MP25 system-on-chip

Features

The features of the STM32MP25 watchdog include:

  • Device tree-configurable timeout, in seconds

  • Option to disable the watchdog timer count during low power modes

  • Inability to stop watchdog once started

OP-TEE configuration

To prevent the non-secure world from making unwanted accesses to the watchdog timer that might cause a system reset, the watchdog iwdg1 is enabled and managed by the secure world (OP-TEE) by default.

ConnectCore MP25 Development Kit device tree (OP-TEE)
&etzpc {
	st,decprot = <
		[...]
		DECPROT(STM32MP1_ETZPC_IWDG1_ID, DECPROT_S_RW, DECPROT_UNLOCK)
		[...]
	>;
};

&iwdg1 {
	timeout-sec = <32>;
	status = "okay";
};

Kernel configuration

The non-secure world can access the secure watchdog through the kernel configuration option ARM Secure Monitor Call based watchdog support (CONFIG_ARM_SMC_WATCHDOG).

The configuration option STM Independent Watchdog (CONFIG_STM32_WATCHDOG) enables the driver for direct access to the SoC watchdogs from the non-secure world.

These options are enabled as built-in on the ConnectCore MP25 Development Kit kernel configuration file.

Kernel driver

File Description

drivers/watchdog/arm_smc_wdt.c

ARM Secure Monitor Call driver

drivers/watchdog/stm32_iwdg.c

STM32MP watchdog driver

Device tree bindings and customization

The ARM Secure Monitor Call device tree binding for the secure watchdog is located at Documentation/devicetree/bindings/watchdog/arm-smc-wdt.yaml.

The watchdog device tree binding is documented at Documentation/devicetree/bindings/watchdog/st,stm32-iwdg.yaml.

The ConnectCore MP25 configures the ARM SMC access to the secure watchdog:

ConnectCore MP25 device tree include
/* Secure watchdog running in OP-TEE */
&arm_wdt {
	timeout-sec = <32>;
	status = "okay";
};

Using the watchdog

The watchdog is accessible via the file descriptor /dev/watchdog0.

For information about the watchdog API, see the Linux kernel documentation at Documentation/watchdog/watchdog-api.rst.

Sample application

An example application called apix-watchdog-example is included in the dey-examples-digiapix recipe (part of dey-examples package) of the meta-digi layer. This application uses the Digi APIx library to enable a watchdog device on the ConnectCore MP25.

Go to GitHub to see the application instructions and source code.

See Watchdog API for more information about the watchdog APIx.