blob: 1a858b1020fc2330a2a2b34ee33fe9aa32787884 [file] [log] [blame]
maxims@google.com4697abe2017-01-18 13:44:55 -08001/*
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.com1eb0a462017-04-17 12:00:22 -070012u32 ast_reset_mode_from_flags(ulong flags)
13{
14 return flags & WDT_CTRL_RESET_MASK;
15}
16
17u32 ast_reset_mask_from_flags(ulong flags)
18{
19 return flags >> 2;
20}
21
22ulong 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}