Path: blob/master/arch/sh/include/cpu-sh2/cpu/watchdog.h
26495 views
/* SPDX-License-Identifier: GPL-2.01*2* include/asm-sh/cpu-sh2/watchdog.h3*4* Copyright (C) 2002, 2003 Paul Mundt5*/6#ifndef __ASM_CPU_SH2_WATCHDOG_H7#define __ASM_CPU_SH2_WATCHDOG_H89/*10* More SH-2 brilliance .. its not good enough that we can't read11* and write the same sizes to WTCNT, now we have to read and write12* with different sizes at different addresses for WTCNT _and_ RSTCSR.13*14* At least on the bright side no one has managed to screw over WTCSR15* in this fashion .. yet.16*/17/* Register definitions */18#define WTCNT 0xfffffe8019#define WTCSR 0xfffffe8020#define RSTCSR 0xfffffe822122#define WTCNT_R (WTCNT + 1)23#define RSTCSR_R (RSTCSR + 1)2425/* Bit definitions */26#define WTCSR_IOVF 0x8027#define WTCSR_WT 0x4028#define WTCSR_TME 0x2029#define WTCSR_RSTS 0x003031#define RSTCSR_RSTS 0x203233/**34* sh_wdt_read_rstcsr - Read from Reset Control/Status Register35*36* Reads back the RSTCSR value.37*/38static inline __u8 sh_wdt_read_rstcsr(void)39{40/*41* Same read/write brain-damage as for WTCNT here..42*/43return __raw_readb(RSTCSR_R);44}4546/**47* sh_wdt_write_csr - Write to Reset Control/Status Register48*49* @val: Value to write50*51* Writes the given value @val to the lower byte of the control/status52* register. The upper byte is set manually on each write.53*/54static inline void sh_wdt_write_rstcsr(__u8 val)55{56/*57* Note: Due to the brain-damaged nature of this register,58* we can't presently touch the WOVF bit, since the upper byte59* has to be swapped for this. So just leave it alone..60*/61__raw_writeb((WTCNT_HIGH << 8) | (__u16)val, RSTCSR);62}6364#endif /* __ASM_CPU_SH2_WATCHDOG_H */65666768