1 /* 2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef IMX_WDOG_H 8 #define IMX_WDOG_H 9 10 #include <stdint.h> 11 12 #include <arch.h> 13 14 struct wdog_regs { 15 uint16_t wcr; 16 uint16_t wsr; 17 uint16_t wrsr; 18 uint16_t wicr; 19 uint16_t wmcr; 20 }; 21 22 /* WCR bits */ 23 #define WCR_WDZST BIT(0) 24 #define WCR_WDBG BIT(1) 25 #define WCR_WDE BIT(2) 26 #define WCR_WDT BIT(3) 27 #define WCR_SRS BIT(4) 28 #define WCR_WDA BIT(5) 29 #define WCR_SRE BIT(6) 30 #define WCR_WDW BIT(7) 31 #define WCR_WT(x) ((x) << 8) 32 33 /* WSR bits */ 34 #define WSR_FIRST 0x5555 35 #define WSR_SECOND 0xAAAA 36 37 /* WRSR bits */ 38 #define WRSR_SFTW BIT(0) 39 #define WRSR_TOUT BIT(1) 40 #define WRSR_POR BIT(4) 41 42 /* WICR bits */ wicr_calc_wict(int sec,int half_sec)43static inline int wicr_calc_wict(int sec, int half_sec) 44 { 45 int wict_bits; 46 47 /* Represents WICR bits 7 - 0 */ 48 wict_bits = ((sec << 1) | (half_sec ? 1 : 0)); 49 50 return wict_bits; 51 } 52 53 #define WICR_WTIS BIT(14) 54 #define WICR_WIE BIT(15) 55 56 /* WMCR bits */ 57 #define WMCR_PDE BIT(0) 58 59 /* External facing API */ 60 void imx_wdog_init(void); 61 62 #endif /* IMX_WDOG_H */ 63