Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Ilya Yanok | 416a41f | 2009-06-08 04:12:45 +0400 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2002 |
| 4 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 5 | * Marius Groeger <mgroeger@sysgo.de> |
| 6 | * |
| 7 | * (C) Copyright 2002 |
| 8 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 9 | * Alex Zuepke <azu@sysgo.de> |
| 10 | * |
| 11 | * (C) Copyright 2002 |
| 12 | * Gary Jennejohn, DENX Software Engineering, <gj@denx.de> |
| 13 | * |
| 14 | * (C) Copyright 2009 |
| 15 | * Ilya Yanok, Emcraft Systems Ltd, <yanok@emcraft.com> |
Ilya Yanok | 416a41f | 2009-06-08 04:12:45 +0400 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #include <common.h> |
Simon Glass | afb0215 | 2019-12-28 10:45:01 -0700 | [diff] [blame] | 19 | #include <cpu_func.h> |
Ilya Yanok | 416a41f | 2009-06-08 04:12:45 +0400 | [diff] [blame] | 20 | #include <asm/io.h> |
| 21 | #include <asm/arch/imx-regs.h> |
| 22 | |
| 23 | /* |
| 24 | * Reset the cpu by setting up the watchdog timer and let it time out |
| 25 | */ |
Harald Seiler | 6f14d5f | 2020-12-15 16:47:52 +0100 | [diff] [blame^] | 26 | void reset_cpu(void) |
Ilya Yanok | 416a41f | 2009-06-08 04:12:45 +0400 | [diff] [blame] | 27 | { |
| 28 | struct wdog_regs *regs = (struct wdog_regs *)IMX_WDT_BASE; |
| 29 | /* Disable watchdog and set Time-Out field to 0 */ |
Leonid Iziumtsev | 3056e50 | 2016-03-20 14:10:55 +0100 | [diff] [blame] | 30 | writew(0x0000, ®s->wcr); |
Ilya Yanok | 416a41f | 2009-06-08 04:12:45 +0400 | [diff] [blame] | 31 | |
| 32 | /* Write Service Sequence */ |
Leonid Iziumtsev | 3056e50 | 2016-03-20 14:10:55 +0100 | [diff] [blame] | 33 | writew(0x5555, ®s->wsr); |
| 34 | writew(0xAAAA, ®s->wsr); |
Ilya Yanok | 416a41f | 2009-06-08 04:12:45 +0400 | [diff] [blame] | 35 | |
| 36 | /* Enable watchdog */ |
Leonid Iziumtsev | 3056e50 | 2016-03-20 14:10:55 +0100 | [diff] [blame] | 37 | writew(WCR_WDE, ®s->wcr); |
Ilya Yanok | 416a41f | 2009-06-08 04:12:45 +0400 | [diff] [blame] | 38 | |
| 39 | while (1); |
| 40 | /*NOTREACHED*/ |
| 41 | } |