find cpu datasheet , watchdog relate registers:
0x18060008 watchdong timer control
0x1806000c watchdog timer
we can read and write watchdog register under uboot console:
#mw 0x1806000c 0xffffffff 1
#mw 0x1806000c 0x10000000 1
#mw 0x18060008 0x3 1
#md 0x18060008 1
#md 0x1806000c 1
// init watchdog function
//init watchdog timer
//int watchdon timer
control
// watchdog action bit[1:0]
#define No_action 0
#define General_purpose_interrupt 1
#define Non_maskable_interrupt 2
#define Full_chip_reset 3
#define WATCHDOG_TIMER_CONTROL 0x18060008
#define WATCHDOG_TIMER 0x1806000c
void enable_watchdog(){
ath_reg_wr(WATCHDOG_TIMER,0xffffffff);
ath_reg_wr(WATCHDOG_TIMER_CONTROL, Full_chip_reset);
}
void disable_watchdog(){
ath_reg_wr(WATCHDOG_TIMER_CONTROL, No_action);
}
void feed_watchdog(){
ath_reg_wr(WATCHDOG_TIMER,0xffffffff);
}
after we encapsulated watchdog interface; we can enable watchdog in the uboot bootup stage