Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 045b6fd | 2018-07-24 11:27:52 +0100 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | 045b6fd | 2018-07-24 11:27:52 +0100 | [diff] [blame] | 7 | #ifndef SP805_H |
| 8 | #define SP805_H |
| 9 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 10 | #include <lib/utils_def.h> |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 11 | |
| 12 | /* SP805 register offset */ |
Antonio Nino Diaz | 045b6fd | 2018-07-24 11:27:52 +0100 | [diff] [blame] | 13 | #define SP805_WDOG_LOAD_OFF UL(0x000) |
| 14 | #define SP805_WDOG_CTR_OFF UL(0x008) |
| 15 | #define SP805_WDOG_LOCK_OFF UL(0xc00) |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 16 | |
| 17 | /* Magic word to unlock the wd registers */ |
Antonio Nino Diaz | 045b6fd | 2018-07-24 11:27:52 +0100 | [diff] [blame] | 18 | #define WDOG_UNLOCK_KEY U(0x1ACCE551) |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 19 | |
| 20 | /* Register field definitions */ |
Antonio Nino Diaz | 045b6fd | 2018-07-24 11:27:52 +0100 | [diff] [blame] | 21 | #define SP805_CTR_RESEN (U(1) << 1) |
| 22 | #define SP805_CTR_INTEN (U(1) << 0) |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 23 | |
Julius Werner | 53456fc | 2019-07-09 13:49:11 -0700 | [diff] [blame] | 24 | #ifndef __ASSEMBLER__ |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 25 | |
| 26 | #include <stdint.h> |
| 27 | |
| 28 | /* Public high level API */ |
| 29 | |
Antonio Nino Diaz | 045b6fd | 2018-07-24 11:27:52 +0100 | [diff] [blame] | 30 | void sp805_start(uintptr_t base, unsigned int ticks); |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 31 | void sp805_stop(uintptr_t base); |
Antonio Nino Diaz | 045b6fd | 2018-07-24 11:27:52 +0100 | [diff] [blame] | 32 | void sp805_refresh(uintptr_t base, unsigned int ticks); |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 33 | |
Julius Werner | 53456fc | 2019-07-09 13:49:11 -0700 | [diff] [blame] | 34 | #endif /* __ASSEMBLER__ */ |
Juan Castillo | 5f64eff | 2014-07-08 17:20:41 +0100 | [diff] [blame] | 35 | |
Antonio Nino Diaz | 045b6fd | 2018-07-24 11:27:52 +0100 | [diff] [blame] | 36 | #endif /* SP805_H */ |