diff options
Diffstat (limited to 'arch/sh/include/asm/watchdog.h')
| -rw-r--r-- | arch/sh/include/asm/watchdog.h | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/arch/sh/include/asm/watchdog.h b/arch/sh/include/asm/watchdog.h index 2fe7cee9e43a..19dfff5c8511 100644 --- a/arch/sh/include/asm/watchdog.h +++ b/arch/sh/include/asm/watchdog.h | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | * include/asm-sh/watchdog.h | 2 | * include/asm-sh/watchdog.h |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2002, 2003 Paul Mundt | 4 | * Copyright (C) 2002, 2003 Paul Mundt |
| 5 | * Copyright (C) 2009 Siemens AG | ||
| 6 | * Copyright (C) 2009 Valentin Sitdikov | ||
| 5 | * | 7 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |
| @@ -61,6 +63,61 @@ | |||
| 61 | #define WTCSR_CKS_2048 0x06 | 63 | #define WTCSR_CKS_2048 0x06 |
| 62 | #define WTCSR_CKS_4096 0x07 | 64 | #define WTCSR_CKS_4096 0x07 |
| 63 | 65 | ||
| 66 | #if defined(CONFIG_CPU_SUBTYPE_SH7785) || defined(CONFIG_CPU_SUBTYPE_SH7780) | ||
| 67 | /** | ||
| 68 | * sh_wdt_read_cnt - Read from Counter | ||
| 69 | * Reads back the WTCNT value. | ||
| 70 | */ | ||
| 71 | static inline __u32 sh_wdt_read_cnt(void) | ||
| 72 | { | ||
| 73 | return ctrl_inl(WTCNT_R); | ||
| 74 | } | ||
| 75 | |||
| 76 | /** | ||
| 77 | * sh_wdt_write_cnt - Write to Counter | ||
| 78 | * @val: Value to write | ||
| 79 | * | ||
| 80 | * Writes the given value @val to the lower byte of the timer counter. | ||
| 81 | * The upper byte is set manually on each write. | ||
| 82 | */ | ||
| 83 | static inline void sh_wdt_write_cnt(__u32 val) | ||
| 84 | { | ||
| 85 | ctrl_outl((WTCNT_HIGH << 24) | (__u32)val, WTCNT); | ||
| 86 | } | ||
| 87 | |||
| 88 | /** | ||
| 89 | * sh_wdt_write_bst - Write to Counter | ||
| 90 | * @val: Value to write | ||
| 91 | * | ||
| 92 | * Writes the given value @val to the lower byte of the timer counter. | ||
| 93 | * The upper byte is set manually on each write. | ||
| 94 | */ | ||
| 95 | static inline void sh_wdt_write_bst(__u32 val) | ||
| 96 | { | ||
| 97 | ctrl_outl((WTBST_HIGH << 24) | (__u32)val, WTBST); | ||
| 98 | } | ||
| 99 | /** | ||
| 100 | * sh_wdt_read_csr - Read from Control/Status Register | ||
| 101 | * | ||
| 102 | * Reads back the WTCSR value. | ||
| 103 | */ | ||
| 104 | static inline __u32 sh_wdt_read_csr(void) | ||
| 105 | { | ||
| 106 | return ctrl_inl(WTCSR_R); | ||
| 107 | } | ||
| 108 | |||
| 109 | /** | ||
| 110 | * sh_wdt_write_csr - Write to Control/Status Register | ||
| 111 | * @val: Value to write | ||
| 112 | * | ||
| 113 | * Writes the given value @val to the lower byte of the control/status | ||
| 114 | * register. The upper byte is set manually on each write. | ||
| 115 | */ | ||
| 116 | static inline void sh_wdt_write_csr(__u32 val) | ||
| 117 | { | ||
| 118 | ctrl_outl((WTCSR_HIGH << 24) | (__u32)val, WTCSR); | ||
| 119 | } | ||
| 120 | #else | ||
| 64 | /** | 121 | /** |
| 65 | * sh_wdt_read_cnt - Read from Counter | 122 | * sh_wdt_read_cnt - Read from Counter |
| 66 | * Reads back the WTCNT value. | 123 | * Reads back the WTCNT value. |
| @@ -103,6 +160,6 @@ static inline void sh_wdt_write_csr(__u8 val) | |||
| 103 | { | 160 | { |
| 104 | ctrl_outw((WTCSR_HIGH << 8) | (__u16)val, WTCSR); | 161 | ctrl_outw((WTCSR_HIGH << 8) | (__u16)val, WTCSR); |
| 105 | } | 162 | } |
| 106 | 163 | #endif /* CONFIG_CPU_SUBTYPE_SH7785 || CONFIG_CPU_SUBTYPE_SH7780 */ | |
| 107 | #endif /* __KERNEL__ */ | 164 | #endif /* __KERNEL__ */ |
| 108 | #endif /* __ASM_SH_WATCHDOG_H */ | 165 | #endif /* __ASM_SH_WATCHDOG_H */ |
