Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: fix watchdog timer for sh7780/sh7785

Signed-off-by: Valentin Sitdikov <valentin.sitdikov@siemens.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

authored by

Valentin R Sitsikov and committed by
Paul Mundt
f72f7876 376abbb4

+71 -1
+58 -1
arch/sh/include/asm/watchdog.h
··· 2 2 * include/asm-sh/watchdog.h 3 3 * 4 4 * Copyright (C) 2002, 2003 Paul Mundt 5 + * Copyright (C) 2009 Siemens AG 6 + * Copyright (C) 2009 Valentin Sitdikov 5 7 * 6 8 * This program is free software; you can redistribute it and/or modify it 7 9 * under the terms of the GNU General Public License as published by the ··· 63 61 #define WTCSR_CKS_2048 0x06 64 62 #define WTCSR_CKS_4096 0x07 65 63 64 + #if defined(CONFIG_CPU_SUBTYPE_SH7785) || defined(CONFIG_CPU_SUBTYPE_SH7780) 65 + /** 66 + * sh_wdt_read_cnt - Read from Counter 67 + * Reads back the WTCNT value. 68 + */ 69 + static inline __u32 sh_wdt_read_cnt(void) 70 + { 71 + return ctrl_inl(WTCNT_R); 72 + } 73 + 74 + /** 75 + * sh_wdt_write_cnt - Write to Counter 76 + * @val: Value to write 77 + * 78 + * Writes the given value @val to the lower byte of the timer counter. 79 + * The upper byte is set manually on each write. 80 + */ 81 + static inline void sh_wdt_write_cnt(__u32 val) 82 + { 83 + ctrl_outl((WTCNT_HIGH << 24) | (__u32)val, WTCNT); 84 + } 85 + 86 + /** 87 + * sh_wdt_write_bst - Write to Counter 88 + * @val: Value to write 89 + * 90 + * Writes the given value @val to the lower byte of the timer counter. 91 + * The upper byte is set manually on each write. 92 + */ 93 + static inline void sh_wdt_write_bst(__u32 val) 94 + { 95 + ctrl_outl((WTBST_HIGH << 24) | (__u32)val, WTBST); 96 + } 97 + /** 98 + * sh_wdt_read_csr - Read from Control/Status Register 99 + * 100 + * Reads back the WTCSR value. 101 + */ 102 + static inline __u32 sh_wdt_read_csr(void) 103 + { 104 + return ctrl_inl(WTCSR_R); 105 + } 106 + 107 + /** 108 + * sh_wdt_write_csr - Write to Control/Status Register 109 + * @val: Value to write 110 + * 111 + * Writes the given value @val to the lower byte of the control/status 112 + * register. The upper byte is set manually on each write. 113 + */ 114 + static inline void sh_wdt_write_csr(__u32 val) 115 + { 116 + ctrl_outl((WTCSR_HIGH << 24) | (__u32)val, WTCSR); 117 + } 118 + #else 66 119 /** 67 120 * sh_wdt_read_cnt - Read from Counter 68 121 * Reads back the WTCNT value. ··· 160 103 { 161 104 ctrl_outw((WTCSR_HIGH << 8) | (__u16)val, WTCSR); 162 105 } 163 - 106 + #endif /* CONFIG_CPU_SUBTYPE_SH7785 || CONFIG_CPU_SUBTYPE_SH7780 */ 164 107 #endif /* __KERNEL__ */ 165 108 #endif /* __ASM_SH_WATCHDOG_H */
+13
arch/sh/include/cpu-sh4/cpu/watchdog.h
··· 2 2 * include/asm-sh/cpu-sh4/watchdog.h 3 3 * 4 4 * Copyright (C) 2002, 2003 Paul Mundt 5 + * Copyright (C) 2009 Siemens AG 6 + * Copyright (C) 2009 Sitdikov Valentin 5 7 * 6 8 * This file is subject to the terms and conditions of the GNU General Public 7 9 * License. See the file "COPYING" in the main directory of this archive ··· 12 10 #ifndef __ASM_CPU_SH4_WATCHDOG_H 13 11 #define __ASM_CPU_SH4_WATCHDOG_H 14 12 13 + #if defined(CONFIG_CPU_SUBTYPE_SH7785) || defined(CONFIG_CPU_SUBTYPE_SH7780) 14 + /* Prefix definition */ 15 + #define WTBST_HIGH 0x55 16 + /* Register definitions */ 17 + #define WTCNT_R 0xffcc0010 /*WDTCNT*/ 18 + #define WTCSR 0xffcc0004 /*WDTCSR*/ 19 + #define WTCNT 0xffcc0000 /*WDTST*/ 20 + #define WTST WTCNT 21 + #define WTBST 0xffcc0008 /*WDTBST*/ 22 + #else 15 23 /* Register definitions */ 16 24 #define WTCNT 0xffc00008 17 25 #define WTCSR 0xffc0000c 26 + #endif 18 27 19 28 /* Bit definitions */ 20 29 #define WTCSR_TME 0x80