]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/arm/mach-aspeed/ast_wdt.c
aspeed: Refactor AST2500 RAM Driver and Sysreset Driver
[people/ms/u-boot.git] / arch / arm / mach-aspeed / ast_wdt.c
CommitLineData
4697abea 1/*
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
1eb0a464 12u32 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}