Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Processor reset using WDT for TI TMS320DM644x SoC. |
| 3 | * |
| 4 | * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net> |
| 5 | * |
| 6 | * ----------------------------------------------------- |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | .globl reset_cpu |
| 25 | reset_cpu: |
| 26 | ldr r0, WDT_TGCR |
| 27 | mov r1, $0x08 |
| 28 | str r1, [r0] |
| 29 | ldr r1, [r0] |
| 30 | orr r1, r1, $0x03 |
| 31 | str r1, [r0] |
| 32 | mov r1, $0 |
| 33 | ldr r0, WDT_TIM12 |
| 34 | str r1, [r0] |
| 35 | ldr r0, WDT_TIM34 |
| 36 | str r1, [r0] |
| 37 | ldr r0, WDT_PRD12 |
| 38 | str r1, [r0] |
| 39 | ldr r0, WDT_PRD34 |
| 40 | str r1, [r0] |
| 41 | ldr r0, WDT_TCR |
| 42 | ldr r1, [r0] |
| 43 | orr r1, r1, $0x40 |
| 44 | str r1, [r0] |
| 45 | ldr r0, WDT_WDTCR |
| 46 | ldr r1, [r0] |
| 47 | orr r1, r1, $0x4000 |
| 48 | str r1, [r0] |
| 49 | ldr r1, WDTCR_VAL1 |
| 50 | str r1, [r0] |
| 51 | ldr r1, WDTCR_VAL2 |
| 52 | str r1, [r0] |
Thomas Lange | 26650af | 2009-05-03 20:07:33 +0200 | [diff] [blame] | 53 | /* Write an invalid value to the WDKEY field to trigger |
| 54 | * an immediate watchdog reset */ |
| 55 | mov r1, $0x4000 |
| 56 | str r1, [r0] |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 57 | nop |
| 58 | nop |
| 59 | nop |
| 60 | nop |
| 61 | reset_cpu_loop: |
| 62 | b reset_cpu_loop |
| 63 | |
| 64 | WDT_TGCR: |
| 65 | .word 0x01c21c24 |
| 66 | WDT_TIM12: |
| 67 | .word 0x01c21c10 |
| 68 | WDT_TIM34: |
| 69 | .word 0x01c21c14 |
| 70 | WDT_PRD12: |
| 71 | .word 0x01c21c18 |
| 72 | WDT_PRD34: |
| 73 | .word 0x01c21c1c |
| 74 | WDT_TCR: |
| 75 | .word 0x01c21c20 |
| 76 | WDT_WDTCR: |
| 77 | .word 0x01c21c28 |
| 78 | WDTCR_VAL1: |
| 79 | .word 0xa5c64000 |
| 80 | WDTCR_VAL2: |
| 81 | .word 0xda7e4000 |