Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
maxims@google.com | f57bd00 | 2017-01-18 13:44:55 -0800 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2016 Google, Inc |
maxims@google.com | f57bd00 | 2017-01-18 13:44:55 -0800 | [diff] [blame] | 4 | */ |
| 5 | |
maxims@google.com | f57bd00 | 2017-01-18 13:44:55 -0800 | [diff] [blame] | 6 | #include <asm/io.h> |
| 7 | #include <asm/arch/wdt.h> |
| 8 | #include <linux/err.h> |
| 9 | |
maxims@google.com | df35df2 | 2017-04-17 12:00:22 -0700 | [diff] [blame] | 10 | u32 ast_reset_mode_from_flags(ulong flags) |
| 11 | { |
| 12 | return flags & WDT_CTRL_RESET_MASK; |
| 13 | } |
| 14 | |
| 15 | u32 ast_reset_mask_from_flags(ulong flags) |
| 16 | { |
| 17 | return flags >> 2; |
| 18 | } |
| 19 | |
| 20 | ulong ast_flags_from_reset_mode_mask(u32 reset_mode, u32 reset_mask) |
| 21 | { |
| 22 | ulong ret = reset_mode & WDT_CTRL_RESET_MASK; |
| 23 | |
| 24 | if (ret == WDT_CTRL_RESET_SOC) |
| 25 | ret |= (reset_mask << 2); |
| 26 | |
| 27 | return ret; |
| 28 | } |