SPDX: Convert all of our single license tags to Linux Kernel style
[platform/kernel/u-boot.git] / arch / arm / mach-aspeed / ast_wdt.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2016 Google, Inc
4  */
5
6 #include <common.h>
7 #include <asm/io.h>
8 #include <asm/arch/wdt.h>
9 #include <linux/err.h>
10
11 u32 ast_reset_mode_from_flags(ulong flags)
12 {
13         return flags & WDT_CTRL_RESET_MASK;
14 }
15
16 u32 ast_reset_mask_from_flags(ulong flags)
17 {
18         return flags >> 2;
19 }
20
21 ulong 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 }