Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Jens Scharsig | 9bbaae3 | 2010-02-03 22:47:35 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2002 |
| 4 | * Lineo, Inc. <www.lineo.com> |
| 5 | * Bernhard Kuhn <bkuhn@lineo.com> |
| 6 | * |
| 7 | * (C) Copyright 2002 |
| 8 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 9 | * Marius Groeger <mgroeger@sysgo.de> |
| 10 | * |
| 11 | * (C) Copyright 2002 |
| 12 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 13 | * Alex Zuepke <azu@sysgo.de> |
Jens Scharsig | 9bbaae3 | 2010-02-03 22:47:35 +0100 | [diff] [blame] | 14 | */ |
| 15 | |
Simon Glass | afb0215 | 2019-12-28 10:45:01 -0700 | [diff] [blame] | 16 | #include <cpu_func.h> |
Jens Scharsig | 9bbaae3 | 2010-02-03 22:47:35 +0100 | [diff] [blame] | 17 | #include <asm/io.h> |
| 18 | #include <asm/arch/hardware.h> |
| 19 | #include <asm/arch/at91_st.h> |
| 20 | |
Andreas Bießmann | 470b4b0 | 2010-11-30 09:45:05 +0000 | [diff] [blame] | 21 | void __attribute__((weak)) board_reset(void) |
| 22 | { |
| 23 | /* true empty function for defining weak symbol */ |
| 24 | } |
Jens Scharsig | 9bbaae3 | 2010-02-03 22:47:35 +0100 | [diff] [blame] | 25 | |
Harald Seiler | 6f14d5f | 2020-12-15 16:47:52 +0100 | [diff] [blame] | 26 | void reset_cpu(void) |
Jens Scharsig | 9bbaae3 | 2010-02-03 22:47:35 +0100 | [diff] [blame] | 27 | { |
Jens Scharsig | 58aa563 | 2011-02-19 06:17:02 +0000 | [diff] [blame] | 28 | at91_st_t *st = (at91_st_t *) ATMEL_BASE_ST; |
Jens Scharsig | 9bbaae3 | 2010-02-03 22:47:35 +0100 | [diff] [blame] | 29 | |
Andreas Bießmann | 470b4b0 | 2010-11-30 09:45:05 +0000 | [diff] [blame] | 30 | board_reset(); |
Jens Scharsig | 9bbaae3 | 2010-02-03 22:47:35 +0100 | [diff] [blame] | 31 | |
| 32 | /* Reset the cpu by setting up the watchdog timer */ |
| 33 | writel(AT91_ST_WDMR_RSTEN | AT91_ST_WDMR_EXTEN | AT91_ST_WDMR_WDV(2), |
| 34 | &st->wdmr); |
| 35 | writel(AT91_ST_CR_WDRST, &st->cr); |
| 36 | /* and let it timeout */ |
| 37 | while (1) |
| 38 | ; |
| 39 | /* Never reached */ |
| 40 | } |