14697abeaSmaxims@google.com /* 24697abeaSmaxims@google.com * (C) Copyright 2016 Google, Inc 34697abeaSmaxims@google.com * 44697abeaSmaxims@google.com * SPDX-License-Identifier: GPL-2.0+ 54697abeaSmaxims@google.com */ 64697abeaSmaxims@google.com 74697abeaSmaxims@google.com #include <common.h> 84697abeaSmaxims@google.com #include <asm/io.h> 94697abeaSmaxims@google.com #include <asm/arch/wdt.h> 104697abeaSmaxims@google.com #include <linux/err.h> 114697abeaSmaxims@google.com ast_reset_mode_from_flags(ulong flags)12*1eb0a464Smaxims@google.comu32 ast_reset_mode_from_flags(ulong flags) 13*1eb0a464Smaxims@google.com { 14*1eb0a464Smaxims@google.com return flags & WDT_CTRL_RESET_MASK; 15*1eb0a464Smaxims@google.com } 16*1eb0a464Smaxims@google.com ast_reset_mask_from_flags(ulong flags)17*1eb0a464Smaxims@google.comu32 ast_reset_mask_from_flags(ulong flags) 18*1eb0a464Smaxims@google.com { 19*1eb0a464Smaxims@google.com return flags >> 2; 20*1eb0a464Smaxims@google.com } 21*1eb0a464Smaxims@google.com ast_flags_from_reset_mode_mask(u32 reset_mode,u32 reset_mask)22*1eb0a464Smaxims@google.comulong ast_flags_from_reset_mode_mask(u32 reset_mode, u32 reset_mask) 23*1eb0a464Smaxims@google.com { 24*1eb0a464Smaxims@google.com ulong ret = reset_mode & WDT_CTRL_RESET_MASK; 25*1eb0a464Smaxims@google.com 26*1eb0a464Smaxims@google.com if (ret == WDT_CTRL_RESET_SOC) 27*1eb0a464Smaxims@google.com ret |= (reset_mask << 2); 28*1eb0a464Smaxims@google.com 29*1eb0a464Smaxims@google.com return ret; 30*1eb0a464Smaxims@google.com } 31