Macpaul Lin | 83dbca7 | 2011-10-11 22:33:18 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 Andes Technology Corporation |
| 3 | * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Macpaul Lin | 83dbca7 | 2011-10-11 22:33:18 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <asm/arch-ag101/ag101.h> |
Macpaul Lin | a473271 | 2011-11-30 16:01:28 +0800 | [diff] [blame] | 9 | #include <linux/linkage.h> |
Macpaul Lin | 83dbca7 | 2011-10-11 22:33:18 +0000 | [diff] [blame] | 10 | |
| 11 | .text |
| 12 | |
| 13 | #ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG |
Macpaul Lin | a473271 | 2011-11-30 16:01:28 +0800 | [diff] [blame] | 14 | ENTRY(turnoff_watchdog) |
Macpaul Lin | 83dbca7 | 2011-10-11 22:33:18 +0000 | [diff] [blame] | 15 | |
| 16 | #define WD_CR 0xC |
| 17 | #define WD_ENABLE 0x1 |
| 18 | |
| 19 | ! Turn off the watchdog, according to Faraday FTWDT010 spec |
| 20 | li $p0, (CONFIG_FTWDT010_BASE+WD_CR) ! Get the addr of WD CR |
| 21 | lwi $p1, [$p0] ! Get the config of WD |
| 22 | andi $p1, $p1, 0x1f ! Wipe out useless bits |
| 23 | li $r0, ~WD_ENABLE |
| 24 | and $p1, $p1, $r0 ! Set WD disable |
| 25 | sw $p1, [$p0] ! Write back to WD CR |
| 26 | |
| 27 | ! Disable Interrupts by clear GIE in $PSW reg |
| 28 | setgie.d |
| 29 | |
| 30 | ret |
| 31 | |
Macpaul Lin | a473271 | 2011-11-30 16:01:28 +0800 | [diff] [blame] | 32 | ENDPROC(turnoff_watchdog) |
Macpaul Lin | 83dbca7 | 2011-10-11 22:33:18 +0000 | [diff] [blame] | 33 | #endif |