1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * (C) Copyright 2014
4  * Chen-Yu Tsai <wens@csie.org>
5  *
6  * Watchdog register definitions
7  */
8 
9 #ifndef _SUNXI_WATCHDOG_H_
10 #define _SUNXI_WATCHDOG_H_
11 
12 #define WDT_CTRL_RESTART	(0x1 << 0)
13 #define WDT_CTRL_KEY		(0x0a57 << 1)
14 
15 #define WDT_SRST_REG		0x08
16 
17 #if defined(CONFIG_MACH_SUN4I) || \
18     defined(CONFIG_MACH_SUN5I) || \
19     defined(CONFIG_MACH_SUN7I) || \
20     defined(CONFIG_MACH_SUN8I_R40)
21 
22 #define WDT_MODE_EN		(0x1 << 0)
23 #define WDT_MODE_RESET_EN	(0x1 << 1)
24 
25 struct sunxi_wdog {
26 	u32 ctl;		/* 0x00 */
27 	u32 mode;		/* 0x04 */
28 	u32 res[2];
29 };
30 
31 #else
32 
33 #define WDT_CFG_RESET		(0x1)
34 #define WDT_MODE_EN		(0x1)
35 
36 struct sunxi_wdog {
37 	u32 irq_en;		/* 0x00 */
38 	u32 irq_sta;		/* 0x04 */
39 	u32 res1[2];
40 	u32 ctl;		/* 0x10 */
41 	u32 cfg;		/* 0x14 */
42 	u32 mode;		/* 0x18 */
43 	u32 res2;
44 };
45 
46 #endif
47 
48 #endif /* _SUNXI_WATCHDOG_H_ */
49