[PATCH] powerpc: Add support for the MPC83xx watchdog

Marcelo Tosatti marcelo.tosatti at cyclades.com
Tue Jan 17 09:41:15 EST 2006


> +static unsigned long wdt_is_open;
> +static spinlock_t wdt_spinlock;
> +
> +static void mpc83xx_wdt_keepalive(void)
> +{
> +	/* Ping the WDT */
> +	spin_lock(&wdt_spinlock);
> +	out_be16(&wd_base->swsrr, 0x556c);
> +	out_be16(&wd_base->swsrr, 0xaa39);
> +	spin_unlock(&wdt_spinlock);
> +}
> +
> +static ssize_t mpc83xx_wdt_write(struct file * file, const char __user * buf,
> +				 size_t count, loff_t * ppos)
> +{
> +	if(count)
> +		mpc83xx_wdt_keepalive();
> +	return count;
> +}
> +
> +static int mpc83xx_wdt_open(struct inode * inode, struct file * file)
> +{
> +	u32 tmp = SWCRR_SWEN;
> +	if (test_and_set_bit(0, &wdt_is_open))
> +		return -EBUSY;

Hi Kumar,

What do you need the spinlock for if the device can't be opened 
by more than one process?




More information about the Linuxppc-dev mailing list