Merge tag 'efi-2020-07-rc6' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
[oweals/u-boot.git] / arch / nds32 / cpu / n1213 / ag101 / watchdog.S
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2011 Andes Technology Corporation
4  * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
5  */
6
7 #include <asm/arch-ag101/ag101.h>
8 #include <linux/linkage.h>
9
10 .text
11
12 #ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG
13 ENTRY(turnoff_watchdog)
14
15 #define WD_CR           0xC
16 #define WD_ENABLE       0x1
17
18         ! Turn off the watchdog, according to Faraday FTWDT010 spec
19         li      $p0, (CONFIG_FTWDT010_BASE+WD_CR)       ! Get the addr of WD CR
20         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
31 ENDPROC(turnoff_watchdog)
32 #endif