xref: /rk3399_rockchip-uboot/arch/arm/mach-exynos/include/mach/watchdog.h (revision 783983f323730540f861413dfbea6802c88afcf8)
1*77b55e8cSThomas Abraham /*
2*77b55e8cSThomas Abraham  * Copyright (C) 2011 Samsung Electronics
3*77b55e8cSThomas Abraham  * Heungjun Kim <riverful.kim@samsung.com>
4*77b55e8cSThomas Abraham  *
5*77b55e8cSThomas Abraham  * SPDX-License-Identifier:	GPL-2.0+
6*77b55e8cSThomas Abraham  */
7*77b55e8cSThomas Abraham 
8*77b55e8cSThomas Abraham #ifndef __ASM_ARM_ARCH_WATCHDOG_H_
9*77b55e8cSThomas Abraham #define __ASM_ARM_ARCH_WATCHDOG_H_
10*77b55e8cSThomas Abraham 
11*77b55e8cSThomas Abraham #define WTCON_RESET_OFFSET	0
12*77b55e8cSThomas Abraham #define WTCON_INTEN_OFFSET	2
13*77b55e8cSThomas Abraham #define WTCON_CLKSEL_OFFSET	3
14*77b55e8cSThomas Abraham #define WTCON_EN_OFFSET		5
15*77b55e8cSThomas Abraham #define WTCON_PRE_OFFSET	8
16*77b55e8cSThomas Abraham 
17*77b55e8cSThomas Abraham #define WTCON_CLK_16		0x0
18*77b55e8cSThomas Abraham #define WTCON_CLK_32		0x1
19*77b55e8cSThomas Abraham #define WTCON_CLK_64		0x2
20*77b55e8cSThomas Abraham #define WTCON_CLK_128		0x3
21*77b55e8cSThomas Abraham 
22*77b55e8cSThomas Abraham #define WTCON_CLK(x)		((x & 0x3) << WTCON_CLKSEL_OFFSET)
23*77b55e8cSThomas Abraham #define WTCON_PRESCALER(x)	((x) << WTCON_PRE_OFFSET)
24*77b55e8cSThomas Abraham #define WTCON_EN		(0x1 << WTCON_EN_OFFSET)
25*77b55e8cSThomas Abraham #define WTCON_RESET		(0x1 << WTCON_RESET_OFFSET)
26*77b55e8cSThomas Abraham #define WTCON_INT		(0x1 << WTCON_INTEN_OFFSET)
27*77b55e8cSThomas Abraham 
28*77b55e8cSThomas Abraham #ifndef __ASSEMBLY__
29*77b55e8cSThomas Abraham struct s5p_watchdog {
30*77b55e8cSThomas Abraham 	unsigned int wtcon;
31*77b55e8cSThomas Abraham 	unsigned int wtdat;
32*77b55e8cSThomas Abraham 	unsigned int wtcnt;
33*77b55e8cSThomas Abraham 	unsigned int wtclrint;
34*77b55e8cSThomas Abraham };
35*77b55e8cSThomas Abraham 
36*77b55e8cSThomas Abraham /* functions */
37*77b55e8cSThomas Abraham void wdt_stop(void);
38*77b55e8cSThomas Abraham void wdt_start(unsigned int timeout);
39*77b55e8cSThomas Abraham #endif	/* __ASSEMBLY__ */
40*77b55e8cSThomas Abraham 
41*77b55e8cSThomas Abraham #endif
42