wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * INCA-IP Watchdog timer management code. |
| 3 | * |
| 4 | * Copyright (c) 2003 Wolfgang Denk <wd@denx.de> |
| 5 | * |
| 6 | * See file CREDITS for list of people who contributed to this |
| 7 | * project. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License as |
| 11 | * published by the Free Software Foundation; either version 2 of |
| 12 | * the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 22 | * MA 02111-1307 USA |
| 23 | */ |
| 24 | |
| 25 | |
| 26 | #include <config.h> |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 27 | #include <asm/regdef.h> |
| 28 | |
| 29 | |
| 30 | #define WD_BASE 0xb8000000 |
| 31 | #define WD_CON0(value) 0x0020(value) |
| 32 | #define WD_CON1(value) 0x0024(value) |
| 33 | #define WD_DISABLE 0x00000008 |
| 34 | #define WD_ENABLE 0x00000000 |
| 35 | #define WD_WRITE_PW 0xFFFC00F8 |
| 36 | #define WD_WRITE_ENDINIT 0xFFFC00F3 |
| 37 | #define WD_WRITE_INIT 0xFFFC00F2 |
| 38 | |
| 39 | |
| 40 | .globl disable_incaip_wdt |
| 41 | disable_incaip_wdt: |
| 42 | li t0, WD_BASE |
| 43 | |
| 44 | /* Calculate password. |
| 45 | */ |
| 46 | lw t2, WD_CON1(t0) |
| 47 | and t2, 0xC |
| 48 | |
| 49 | lw t3, WD_CON0(t0) |
| 50 | and t3, 0xFFFFFF01 |
| 51 | |
| 52 | or t3, t2 |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 53 | or t3, 0xF0 |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 54 | |
| 55 | sw t3, WD_CON0(t0) /* write password */ |
| 56 | |
| 57 | /* Clear ENDINIT. |
| 58 | */ |
| 59 | li t1, WD_WRITE_INIT |
| 60 | sw t1, WD_CON0(t0) |
| 61 | |
| 62 | |
| 63 | li t1, WD_DISABLE |
| 64 | sw t1, WD_CON1(t0) /* disable watchdog */ |
| 65 | li t1, WD_WRITE_PW |
| 66 | sw t1, WD_CON0(t0) /* write password */ |
| 67 | li t1, WD_WRITE_ENDINIT |
| 68 | sw t1, WD_CON0(t0) /* end command */ |
| 69 | |
Shinya Kuribayashi | 43c5092 | 2008-04-17 23:35:13 +0900 | [diff] [blame] | 70 | jr ra |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 71 | nop |