blob: c420940d1cb917633a6f89c67664eceb36d0836e [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
maxims@google.comf57bd002017-01-18 13:44:55 -08002/*
3 * (C) Copyright 2016 Google, Inc
maxims@google.comf57bd002017-01-18 13:44:55 -08004 */
5
maxims@google.comf57bd002017-01-18 13:44:55 -08006#include <asm/io.h>
7#include <asm/arch/wdt.h>
8#include <linux/err.h>
9
maxims@google.comdf35df22017-04-17 12:00:22 -070010u32 ast_reset_mode_from_flags(ulong flags)
11{
12 return flags & WDT_CTRL_RESET_MASK;
13}
14
15u32 ast_reset_mask_from_flags(ulong flags)
16{
17 return flags >> 2;
18}
19
20ulong 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}