Cadence WDT Driver

Introduction

This page gives an overview of the WDT driver which is available as part of the Zynq and ZynqMP Linux distribution and in the mainline.
Paths, files, links and documentation on this page are given relative to the Linux kernel source tree.

HW IP Features

  • Configurable timeout interval in seconds.
  • Reset on timeout can be selected.

Known Issues and Limitations


Kernel Configuration


The following config options should be enabled in order to build the wdt driver:
CONFIG_CADENCE_WATCHDOG
CONFIG_XILINX_WATCHDOG



Device tree and Build Configurations

For more details, please refer "Documentation/devicetree/bindings/watchdog/cadence-wdt.txt"

Zynq7000

  1. Zynq7000 platform device-tree can be found in https://github.com/Xilinx/device-tree-xlnx/blob/xlnx_rel_v2021.2/device_tree/data/kernel_dtsi/2021.2/zynq/zynq-7000.dtsi#L455-L462

    zynq-7000.dtsi
    watchdog0: watchdog@f8005000 {
            clocks = <&clkc45>;
            compatible = "cdns,wdt-r1p2";
            interrupt-parent = <&&intc>;
            interrupts = <0 9 1>;
            reg = <0xf8005000 0x1000>;
            timeout-sec = <10>;
    };
  2. Modify the device tree in <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi as below and rebuild your project. 

    system-user.dtsi
    &watchdog0 {
        status = "okay";
    };


  3. If user want the watchdog to trigger a software reset/reboot upon time out then add "reset-on-timeout" in device tree node.

    system-user.dtsi
    &watchdog0 {
        status = "okay";
        reset-on-timeout;
    };

Zynq UltraScale+ MPSoC/RFSoC

  1. ZynqMP platform device-tree can be found in https://github.com/Xilinx/device-tree-xlnx/blob/xlnx_rel_v2021.2/device_tree/data/kernel_dtsi/2021.2/zynqmp/zynqmp.dtsi#L1043-L1051

    zynqmp.dtsi
    # timeout-sec value is set to 10s in 2018.2 and below release and 60s in 2018.3 and later release.
    watchdog0: watchdog@fd4d0000 {
            compatible = "cdns,wdt-r1p2";
            status = disabled;
            interrupt-parent = <&gic>;
            interrupts = <0 113 1>;
            reg = <0x0 0xfd4d0000 0x1000>;
            timeout-sec = <60>;
    };
  2. Modify the device tree source in <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi as below and rebuild your project. 

    system-user.dtsi
    &watchdog0 {
        status = "okay";
    };


  3. If user want the watchdog to trigger a software reset/reboot upon time out then add "reset-on-timeout" in device tree node. Software reset is handled in PMU firmware for Zynq UltraScale+ MPSoC/RFSoC so you need add PMU firmware elf packaged as part of BOOT.bin

    system-user.dtsi
    &watchdog0 {
        status = "okay";
        reset-on-timeout;
        timeout-sec = <10>;
    };
  4.  For 2017.1 or later PetaLinux ENABLE_EM needs to be enabled from PMUFW, For more details refer PetaLinux Yocto Tips and PMU Firmware#PMUFWBuildFlags

    # For 2017.4 and below PetaLinux/Yocto release only
    $ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/pmu/pmu-firmware_%.bbappend
     
    #For v2018.1 to v2020.2 PetaLinux/Yocto releases only
    $ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/pmu-firmware/pmu-firmware_%.bbappend
    
    # For v2021.1 PetaLinux/Yocto releases only
    $ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/emebdeddedsw/pmu-firmware_%.bbappend
    
    # For v2021.2 and later PetaLinux/Yocto releases only
    $ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/embeddedsw/pmu-firmware_%.bbappend
    pmu-firmware_%.bbappend
    # pmu-firmware_%.bbappend content
    YAML_COMPILER_FLAGS_append = " -DENABLE_EM -DENABLE_SCHEDULER"

Test Procedure


ZynqMP

In case of Zynq UltraScale+ MPSoC/RFSoC,  WDT 1 must be enabled in vivado design.

  1. Start the watchdog timer and see if it runs out without enabling reset.

    # echo s > /dev/watchdog0
  2. If reset-on-timeout and timeout-sec device-tree node property is enabled in watchdog node, then PMUFW will reset the system and expected output as shown below.

    ZCU102 board
    PetaLinux 2018.2 xilinx-zcu102-2018_2 /dev/ttyPS0
    
    xilinx-zcu102-2018_2 login: root
    Password:
    root@xilinx-zcu102-2018_2:~#
    root@xilinx-zcu102-2018_2:~# dmesg | grep wdt
    [    1.669543] cdns-wdt fd4d0000.watchdog: Xilinx Watchdog Timer at ffffff800913d000 with timeout 10s
    root@xilinx-zcu102-2018_2:~#
    root@xilinx-zcu102-2018_2:~# echo s > /dev/watchdog0
    [   66.480417] watchdog: watchdog0: watchdog did not stop!
    root@xilinx-zcu102-2018_2:~# Xilinx Zynq MP First Stage Boot Loader
    Release 2018.2   Oct 31 2018  -  15:24:39
    NOTICE:  ATF running on XCZU9EG/silicon v4/RTL5.1 at 0xfffea000
    NOTICE:  BL31: Secure code at 0x0
    NOTICE:  BL31: Non secure code at 0x10080000
    NOTICE:  BL31: v1.4(release):xilinx-v2018.1-4-g93a69a5a
    NOTICE:  BL31: Built : 21:21:00, Oct 31 2018
    PMUFW:  v1.0
  3. If reset-on-timeout device-tree node property is not enabled in watchdog node, then PMUFW will not reset the system and expected output as shown below.

    cdns-wdt fd4d0000.watchdog: Watchdog timed out.

Mainline Status

  • This driver is currently in sync with the mainline kernel except for the following:

watchdog: cadence: Use devm_clk_get_enabled() helper

Change Log

    • None
  • 2020.2
    • None
  • 2020.1
    • None
  • 2019.2
    • Summary
      • watchdog: cadence: Changed dev_err to dev_warn
      • watchdog: cadence: Avoid printing pointer value
    • Commits
      • 70685663  watchdog: cadence: Changed dev_err to dev_warn
      • e7ea8156  watchdog: cadence: Avoid printing pointer value
  • 2019.1
    • None
  • 2018.3
    • None
  • 2018.2
    • None
  • 2018.1
    • None
  • 2017.4
    • None
  • 2017.3
    • Summary
      • watchdog: cadence_wdt: Fix issue with timeout-sec dt property
      • watchdog: cadence_wdt: make of_device_ids const.
      • watchdog: cadence_wdt: Enable access to module parameters
      • watchdog: cadence_wdt: Show information when driver is probed
    • Commits
      • 33ca085 watchdog: cadence_wdt: Fix issue with timeout-sec dt property
      • e51604b watchdog: cadence_wdt: make of_device_ids const.
      • 98dde08 watchdog: cadence_wdt: Enable access to module parameters
      • cf698e7 watchdog: cadence_wdt: Show information when driver is probed
  • 2017.2
    • None
  • 2017.1
    • Summary
      • watchdog: cadence_wdt: Fix the suspend resume.
      • watchdog: constify watchdog_ops structures.

    • Commits
      • eadc4fe watchdog: cadence_wdt: Fix the suspend resume.
      • 85f15cf watchdog: constify watchdog_ops structures.

  • 2016.4
    • None
  • 2016.3
    • None

Related Links

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy