Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Chin Liang See | 68e1747 | 2013-08-07 10:08:03 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013 Altera Corporation <www.altera.com> |
Chin Liang See | 68e1747 | 2013-08-07 10:08:03 -0500 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <asm/io.h> |
Marek Vasut | 65d372c | 2015-08-24 11:51:46 +0200 | [diff] [blame] | 9 | #include <asm/arch/reset_manager.h> |
Chin Liang See | 68e1747 | 2013-08-07 10:08:03 -0500 | [diff] [blame] | 10 | |
Ley Foon Tan | 3607a80 | 2018-05-18 22:05:23 +0800 | [diff] [blame] | 11 | #if defined(CONFIG_TARGET_SOCFPGA_STRATIX10) |
| 12 | #include <asm/arch/mailbox_s10.h> |
| 13 | #endif |
| 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | #if !defined(CONFIG_TARGET_SOCFPGA_STRATIX10) |
Chin Liang See | 68e1747 | 2013-08-07 10:08:03 -0500 | [diff] [blame] | 18 | static const struct socfpga_reset_manager *reset_manager_base = |
| 19 | (void *)SOCFPGA_RSTMGR_ADDRESS; |
Ley Foon Tan | 3607a80 | 2018-05-18 22:05:23 +0800 | [diff] [blame] | 20 | #endif |
Marek Vasut | 3191611 | 2015-07-09 04:27:28 +0200 | [diff] [blame] | 21 | |
| 22 | /* |
Chin Liang See | 68e1747 | 2013-08-07 10:08:03 -0500 | [diff] [blame] | 23 | * Write the reset manager register to cause reset |
| 24 | */ |
| 25 | void reset_cpu(ulong addr) |
| 26 | { |
| 27 | /* request a warm reset */ |
Ley Foon Tan | 3607a80 | 2018-05-18 22:05:23 +0800 | [diff] [blame] | 28 | #if defined(CONFIG_TARGET_SOCFPGA_STRATIX10) |
| 29 | puts("Mailbox: Issuing mailbox cmd REBOOT_HPS\n"); |
| 30 | mbox_reset_cold(); |
| 31 | #else |
Ley Foon Tan | 2b09ea4 | 2017-04-26 02:44:34 +0800 | [diff] [blame] | 32 | writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB, |
| 33 | &reset_manager_base->ctrl); |
Ley Foon Tan | 3607a80 | 2018-05-18 22:05:23 +0800 | [diff] [blame] | 34 | #endif |
Chin Liang See | 68e1747 | 2013-08-07 10:08:03 -0500 | [diff] [blame] | 35 | /* |
| 36 | * infinite loop here as watchdog will trigger and reset |
| 37 | * the processor |
| 38 | */ |
| 39 | while (1) |
| 40 | ; |
| 41 | } |