u-boot/arch/arm/mach-aspeed/ast_wdt.c
maxims@google.com 99f8ad7321 aspeed: Refactor AST2500 RAM Driver and Sysreset Driver
This change switches all existing users of ast2500 Watchdog to Driver
Model based Watchdog driver.

To perform system reset Sysreset Driver uses first Watchdog device found
via uclass_first_device call. Since the system is going to be reset
anyway it does not make much difference which watchdog is used.

Instead of using Watchdog to reset itself, SDRAM driver now uses Reset
driver to do that.

These were the only users of the old Watchdog API, so that API is
removed.

This all is done in one change to avoid having to maintain dual API for
watchdog in between.

Signed-off-by: Maxim Sloyko <maxims@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-08 11:57:32 -04:00

30 lines
524 B
C

/*
* (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;
}