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