1、Makefile 添加一句 COBJS-$(CONFIG_HW_WATCHDOG) += watchdog.o
2、编写watchdog.c
/*
* watchdog.c - driver for Blackfin on-chip watchdog
*
* Copyright (c) 2007-2008 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#include <common.h>
#include <asm/arch/at91sam9260.h>
#include <asm/arch/at91_pmc.h>
#include <asm/arch/gpio.h>
#include <asm/arch/io.h>
#include <watchdog.h>
#ifdef CONFIG_HW_WATCHDOG
void hw_watchdog_reset(void)
{
int i;
at91_set_gpio_value(AT91_PIN_PB31, 1);
for(i=0;i<100;i++);
at91_set_gpio_value(AT91_PIN_PB31, 0);
}
void hw_watchdog_init(void)/
{
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOA);
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOB);
at91_set_gpio_output(AT91_PIN_PA4, 1);
at91_set_gpio_output(AT91_PIN_PB31, 1);
at91_set_gpio_value(AT91_PIN_PA4, 0);
hw_watchdog_reset();
}
#endif
3、u-boot-1.3.4/include/configs/t91sam9260ek.h 对应的配置文件加上 #define CONFIG_HW_WATCHDOG
4、static void create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd, int chip) 可能要加喂狗函数
nand_read_raw (mtd, buf, from, readlen, ooblen);
#ifdef CONFIG_HW_WATCHDOG
#include <watchdog.h>
WATCHDOG_RESET ();
#endif