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