xref: /linux/drivers/watchdog/omap_wdt.h (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
1*d0173278SGuenter Roeck /* SPDX-License-Identifier: GPL-2.0+ */
2b7e04f8cSWim Van Sebroeck /*
3b7e04f8cSWim Van Sebroeck  *  linux/drivers/char/watchdog/omap_wdt.h
4b7e04f8cSWim Van Sebroeck  *
5b7e04f8cSWim Van Sebroeck  *  BRIEF MODULE DESCRIPTION
6b7e04f8cSWim Van Sebroeck  *      OMAP Watchdog timer register definitions
7b7e04f8cSWim Van Sebroeck  *
8b7e04f8cSWim Van Sebroeck  *  Copyright (C) 2004 Texas Instruments.
9b7e04f8cSWim Van Sebroeck  */
10b7e04f8cSWim Van Sebroeck 
11b7e04f8cSWim Van Sebroeck #ifndef _OMAP_WATCHDOG_H
12b7e04f8cSWim Van Sebroeck #define _OMAP_WATCHDOG_H
13b7e04f8cSWim Van Sebroeck 
142817142fSFelipe Balbi #define OMAP_WATCHDOG_REV		(0x00)
152817142fSFelipe Balbi #define OMAP_WATCHDOG_SYS_CONFIG	(0x10)
162817142fSFelipe Balbi #define OMAP_WATCHDOG_STATUS		(0x14)
172817142fSFelipe Balbi #define OMAP_WATCHDOG_CNTRL		(0x24)
182817142fSFelipe Balbi #define OMAP_WATCHDOG_CRR		(0x28)
192817142fSFelipe Balbi #define OMAP_WATCHDOG_LDR		(0x2c)
202817142fSFelipe Balbi #define OMAP_WATCHDOG_TGR		(0x30)
212817142fSFelipe Balbi #define OMAP_WATCHDOG_WPS		(0x34)
222817142fSFelipe Balbi #define OMAP_WATCHDOG_SPR		(0x48)
23b7e04f8cSWim Van Sebroeck 
24b7e04f8cSWim Van Sebroeck /* Using the prescaler, the OMAP watchdog could go for many
25b7e04f8cSWim Van Sebroeck  * months before firing.  These limits work without scaling,
26b7e04f8cSWim Van Sebroeck  * with the 60 second default assumed by most tools and docs.
27b7e04f8cSWim Van Sebroeck  */
28b7e04f8cSWim Van Sebroeck #define TIMER_MARGIN_MAX	(24 * 60 * 60)	/* 1 day */
29b7e04f8cSWim Van Sebroeck #define TIMER_MARGIN_DEFAULT	60	/* 60 secs */
30b7e04f8cSWim Van Sebroeck #define TIMER_MARGIN_MIN	1
31b7e04f8cSWim Van Sebroeck 
32b7e04f8cSWim Van Sebroeck #define PTV			0	/* prescale */
33b7e04f8cSWim Van Sebroeck #define GET_WLDR_VAL(secs)	(0xffffffff - ((secs) * (32768/(1<<PTV))) + 1)
34452fafedSLars Poeschel #define GET_WCCR_SECS(val)	((0xffffffff - (val) + 1) / (32768/(1<<PTV)))
35b7e04f8cSWim Van Sebroeck 
36b7e04f8cSWim Van Sebroeck #endif				/* _OMAP_WATCHDOG_H */
37