硬件看门狗

watchdog

Posted by LXG on February 7, 2025

A133 watchdog

a133_watchdog

AP-RESET 引脚接在电源管理PMIC上

MCU-SCK, MCU-SDA 与 主控通过I2C引脚通信,实现看门狗的功能

驱动

longan/kernel/linux-4.9/drivers/misc/wtd/watchdog.c

board.dts


                twi3: twi@0x05002c00{
                        clock-frequency = <200000>;
                        pinctrl-0 = <&twi3_pins_a>;
                        pinctrl-1 = <&twi3_pins_b>;
                        status = "okay";
                        wtd@39 {
                                compatible = "allwinner,wtd";
                                reg = <0x39>;
                                status = "okay";
                        };
                };

驱动节点


ceres-c3:/sys/devices/platform/soc/twi3/i2c-3/3-0039 # ls -al

lrwxrwxrwx 1 root root    0 2025-02-07 10:58 driver -> ../../../../../../bus/i2c/drivers/wtd
-r--r--r-- 1 root root 4096 2025-02-07 10:58 modalias
-r--r--r-- 1 root root 4096 2025-02-07 10:58 name
lrwxrwxrwx 1 root root    0 2025-02-07 10:58 of_node -> ../../../../../../firmware/devicetree/base/soc@03000000/twi@0x05002c00/wtd@39
drwxr-xr-x 2 root root    0 1970-01-01 08:00 power
lrwxrwxrwx 1 root root    0 2025-02-07 10:58 subsystem -> ../../../../../../bus/i2c
-rw-r--r-- 1 root root 4096 1970-01-01 08:00 uevent
-rw-r--r-- 1 root root 4096 2025-02-07 10:58 wtd_enable

测试

echo 0 > /sys/devices/platform/soc/twi3/i2c-3/3-0039/wtd_enable