2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2017-01-18 21:44:55 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2016 Google, Inc
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/arch/wdt.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
|
2017-04-17 19:00:22 +00:00
|
|
|
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;
|
|
|
|
}
|