Path: blob/master/arch/sh/include/cpu-sh2/cpu/watchdog.h
15159 views
/*1* include/asm-sh/cpu-sh2/watchdog.h2*3* Copyright (C) 2002, 2003 Paul Mundt4*5* This file is subject to the terms and conditions of the GNU General Public6* License. See the file "COPYING" in the main directory of this archive7* for more details.8*/9#ifndef __ASM_CPU_SH2_WATCHDOG_H10#define __ASM_CPU_SH2_WATCHDOG_H1112/*13* More SH-2 brilliance .. its not good enough that we can't read14* and write the same sizes to WTCNT, now we have to read and write15* with different sizes at different addresses for WTCNT _and_ RSTCSR.16*17* At least on the bright side no one has managed to screw over WTCSR18* in this fashion .. yet.19*/20/* Register definitions */21#define WTCNT 0xfffffe8022#define WTCSR 0xfffffe8023#define RSTCSR 0xfffffe822425#define WTCNT_R (WTCNT + 1)26#define RSTCSR_R (RSTCSR + 1)2728/* Bit definitions */29#define WTCSR_IOVF 0x8030#define WTCSR_WT 0x4031#define WTCSR_TME 0x2032#define WTCSR_RSTS 0x003334#define RSTCSR_RSTS 0x203536/**37* sh_wdt_read_rstcsr - Read from Reset Control/Status Register38*39* Reads back the RSTCSR value.40*/41static inline __u8 sh_wdt_read_rstcsr(void)42{43/*44* Same read/write brain-damage as for WTCNT here..45*/46return __raw_readb(RSTCSR_R);47}4849/**50* sh_wdt_write_csr - Write to Reset Control/Status Register51*52* @val: Value to write53*54* Writes the given value @val to the lower byte of the control/status55* register. The upper byte is set manually on each write.56*/57static inline void sh_wdt_write_rstcsr(__u8 val)58{59/*60* Note: Due to the brain-damaged nature of this register,61* we can't presently touch the WOVF bit, since the upper byte62* has to be swapped for this. So just leave it alone..63*/64__raw_writeb((WTCNT_HIGH << 8) | (__u16)val, RSTCSR);65}6667#endif /* __ASM_CPU_SH2_WATCHDOG_H */68697071