blob: 8e7399d0df7277070be8bc2c4ae3e34a8da2ea54 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Macpaul Lin83dbca72011-10-11 22:33:18 +00002/*
3 * Copyright (C) 2011 Andes Technology Corporation
4 * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
Macpaul Lin83dbca72011-10-11 22:33:18 +00005 */
6
7#include <asm/arch-ag101/ag101.h>
Macpaul Lina4732712011-11-30 16:01:28 +08008#include <linux/linkage.h>
Macpaul Lin83dbca72011-10-11 22:33:18 +00009
10.text
11
12#ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG
Macpaul Lina4732712011-11-30 16:01:28 +080013ENTRY(turnoff_watchdog)
Macpaul Lin83dbca72011-10-11 22:33:18 +000014
15#define WD_CR 0xC
16#define WD_ENABLE 0x1
17
18 ! Turn off the watchdog, according to Faraday FTWDT010 spec
Wolfgang Denk62fb2b42021-09-27 17:42:39 +020019 li $p0, (CONFIG_FTWDT010_BASE+WD_CR) ! Get the addr of WD CR
Macpaul Lin83dbca72011-10-11 22:33:18 +000020 lwi $p1, [$p0] ! Get the config of WD
21 andi $p1, $p1, 0x1f ! Wipe out useless bits
22 li $r0, ~WD_ENABLE
23 and $p1, $p1, $r0 ! Set WD disable
24 sw $p1, [$p0] ! Write back to WD CR
25
26 ! Disable Interrupts by clear GIE in $PSW reg
27 setgie.d
28
29 ret
30
Macpaul Lina4732712011-11-30 16:01:28 +080031ENDPROC(turnoff_watchdog)
Macpaul Lin83dbca72011-10-11 22:33:18 +000032#endif