ast_wdt.c 517 B

1234567891011121314151617181920212223242526272829
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2016 Google, Inc
  4. */
  5. #include <common.h>
  6. #include <asm/io.h>
  7. #include <asm/arch/wdt.h>
  8. #include <linux/err.h>
  9. u32 ast_reset_mode_from_flags(ulong flags)
  10. {
  11. return flags & WDT_CTRL_RESET_MASK;
  12. }
  13. u32 ast_reset_mask_from_flags(ulong flags)
  14. {
  15. return flags >> 2;
  16. }
  17. ulong ast_flags_from_reset_mode_mask(u32 reset_mode, u32 reset_mask)
  18. {
  19. ulong ret = reset_mode & WDT_CTRL_RESET_MASK;
  20. if (ret == WDT_CTRL_RESET_SOC)
  21. ret |= (reset_mask << 2);
  22. return ret;
  23. }