Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 2 | /* |
Ley Foon Tan | dd5d12d | 2017-04-26 02:44:34 +0800 | [diff] [blame] | 3 | * Copyright (C) 2012-2017 Altera Corporation <www.altera.com> |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
Ley Foon Tan | dd5d12d | 2017-04-26 02:44:34 +0800 | [diff] [blame] | 6 | #ifndef _RESET_MANAGER_H_ |
| 7 | #define _RESET_MANAGER_H_ |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 8 | |
Ley Foon Tan | fed4c95 | 2019-11-08 10:38:19 +0800 | [diff] [blame] | 9 | phys_addr_t socfpga_get_rstmgr_addr(void); |
| 10 | |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 11 | void reset_cpu(ulong addr); |
Marek Vasut | 8d8c648 | 2014-09-08 14:08:45 +0200 | [diff] [blame] | 12 | |
Marek Vasut | 3425eeb | 2015-07-09 02:45:15 +0200 | [diff] [blame] | 13 | void socfpga_per_reset(u32 reset, int set); |
Marek Vasut | 49edbd4 | 2015-07-09 04:27:28 +0200 | [diff] [blame] | 14 | void socfpga_per_reset_all(void); |
Marek Vasut | 3425eeb | 2015-07-09 02:45:15 +0200 | [diff] [blame] | 15 | |
Simon Goldschmidt | b32e1e8 | 2019-07-15 21:47:52 +0200 | [diff] [blame] | 16 | #define RSTMGR_CTRL_SWCOLDRSTREQ_LSB 0 |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 17 | #define RSTMGR_CTRL_SWWARMRSTREQ_LSB 1 |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 18 | |
Marek Vasut | bb1f889 | 2015-07-09 02:30:35 +0200 | [diff] [blame] | 19 | /* |
| 20 | * Define a reset identifier, from which a permodrst bank ID |
| 21 | * and reset ID can be extracted using the subsequent macros |
| 22 | * RSTMGR_RESET() and RSTMGR_BANK(). |
| 23 | */ |
| 24 | #define RSTMGR_BANK_OFFSET 8 |
| 25 | #define RSTMGR_BANK_MASK 0x7 |
| 26 | #define RSTMGR_RESET_OFFSET 0 |
| 27 | #define RSTMGR_RESET_MASK 0x1f |
| 28 | #define RSTMGR_DEFINE(_bank, _offset) \ |
| 29 | ((_bank) << RSTMGR_BANK_OFFSET) | ((_offset) << RSTMGR_RESET_OFFSET) |
| 30 | |
| 31 | /* Extract reset ID from the reset identifier. */ |
| 32 | #define RSTMGR_RESET(_reset) \ |
| 33 | (((_reset) >> RSTMGR_RESET_OFFSET) & RSTMGR_RESET_MASK) |
| 34 | |
| 35 | /* Extract bank ID from the reset identifier. */ |
| 36 | #define RSTMGR_BANK(_reset) \ |
| 37 | (((_reset) >> RSTMGR_BANK_OFFSET) & RSTMGR_BANK_MASK) |
| 38 | |
Marek Vasut | bb1f889 | 2015-07-09 02:30:35 +0200 | [diff] [blame] | 39 | /* Create a human-readable reference to SoCFPGA reset. */ |
| 40 | #define SOCFPGA_RESET(_name) RSTMGR_##_name |
Pavel Machek | 56a00ab | 2014-09-09 14:03:28 +0200 | [diff] [blame] | 41 | |
Ley Foon Tan | dd5d12d | 2017-04-26 02:44:34 +0800 | [diff] [blame] | 42 | #if defined(CONFIG_TARGET_SOCFPGA_GEN5) |
| 43 | #include <asm/arch/reset_manager_gen5.h> |
Ley Foon Tan | 778ed2c | 2017-04-26 02:44:38 +0800 | [diff] [blame] | 44 | #elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) |
| 45 | #include <asm/arch/reset_manager_arria10.h> |
Ley Foon Tan | ef9805a | 2019-11-27 15:55:17 +0800 | [diff] [blame] | 46 | #elif defined(CONFIG_TARGET_SOCFPGA_STRATIX10) || \ |
| 47 | defined(CONFIG_TARGET_SOCFPGA_AGILEX) |
Ley Foon Tan | 89700b4 | 2019-11-27 15:55:16 +0800 | [diff] [blame] | 48 | #include <asm/arch/reset_manager_soc64.h> |
Ley Foon Tan | dd5d12d | 2017-04-26 02:44:34 +0800 | [diff] [blame] | 49 | #endif |
| 50 | |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 51 | #endif /* _RESET_MANAGER_H_ */ |