imx_wdog.h 1.1 KB

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