summaryrefslogtreecommitdiff
path: root/arch/arm/mach-aspeed/ast_wdt.c
blob: 1a858b1020fc2330a2a2b34ee33fe9aa32787884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * (C) Copyright 2016 Google, Inc
 *
 * SPDX-License-Identifier:     GPL-2.0+
 */

#include <common.h>
#include <asm/io.h>
#include <asm/arch/wdt.h>
#include <linux/err.h>

u32 ast_reset_mode_from_flags(ulong flags)
{
	return flags & WDT_CTRL_RESET_MASK;
}

u32 ast_reset_mask_from_flags(ulong flags)
{
	return flags >> 2;
}

ulong ast_flags_from_reset_mode_mask(u32 reset_mode, u32 reset_mask)
{
	ulong ret = reset_mode & WDT_CTRL_RESET_MASK;

	if (ret == WDT_CTRL_RESET_SOC)
		ret |= (reset_mask << 2);

	return ret;
}