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