Example #1
0
static int bfin_wdt_set_timeout(unsigned long t)
{
	u32 cnt, max_t, sclk;
	unsigned long flags;

	sclk = get_sclk();
	max_t = -1 / sclk;
	cnt = t * sclk;
	stamp("maxtimeout=%us newtimeout=%lus (cnt=%#x)", max_t, t, cnt);

	if (t > max_t) {
		printk(KERN_WARNING PFX "timeout value is too large\n");
		return -EINVAL;
	}

	spin_lock_irqsave(&bfin_wdt_spinlock, flags);
	{
		int run = bfin_wdt_running();
		bfin_wdt_stop();
		bfin_write_WDOG_CNT(cnt);
		if (run)
			bfin_wdt_start();
	}
	spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);

	timeout = t;

	return 0;
}
Example #2
0
static int bfin_wdt_set_timeout(unsigned long t)
{
	u32 cnt;
	unsigned long flags;

	stampit();

	cnt = t * get_sclk();
	if (cnt < get_sclk()) {
		printk(KERN_WARNING PFX "timeout value is too large\n");
		return -EINVAL;
	}

	spin_lock_irqsave(&bfin_wdt_spinlock, flags);
	{
		int run = bfin_wdt_running();
		bfin_wdt_stop();
		bfin_write_WDOG_CNT(cnt);
		if (run)
			bfin_wdt_start();
	}
	spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);

	timeout = t;

	return 0;
}
Example #3
0
void
tb_timer_start (long period_tsc)
{
    if (period_tsc < 0)
        period_tsc = 0;

    bfin_write_WDOG_CNT (period_tsc / (tb_cclk / tb_sclk));
    bfin_write_WDOG_CTL (0x0004);
}
void hw_watchdog_init(void)
{
	bfin_write_WDOG_CNT(5 * get_sclk());	/* 5 second timeout */
	hw_watchdog_reset();
	bfin_write_WDOG_CTL(0x0);
}