1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright (C) 2012-2017 Altera Corporation <www.altera.com> 4 */ 5 6 #ifndef _RESET_MANAGER_H_ 7 #define _RESET_MANAGER_H_ 8 9 void reset_cpu(ulong addr); 10 11 void socfpga_per_reset(u32 reset, int set); 12 void socfpga_per_reset_all(void); 13 14 #if defined(CONFIG_SOCFPGA_VIRTUAL_TARGET) 15 #define RSTMGR_CTRL_SWWARMRSTREQ_LSB 2 16 #else 17 #define RSTMGR_CTRL_SWWARMRSTREQ_LSB 1 18 #endif 19 20 /* 21 * Define a reset identifier, from which a permodrst bank ID 22 * and reset ID can be extracted using the subsequent macros 23 * RSTMGR_RESET() and RSTMGR_BANK(). 24 */ 25 #define RSTMGR_BANK_OFFSET 8 26 #define RSTMGR_BANK_MASK 0x7 27 #define RSTMGR_RESET_OFFSET 0 28 #define RSTMGR_RESET_MASK 0x1f 29 #define RSTMGR_DEFINE(_bank, _offset) \ 30 ((_bank) << RSTMGR_BANK_OFFSET) | ((_offset) << RSTMGR_RESET_OFFSET) 31 32 /* Extract reset ID from the reset identifier. */ 33 #define RSTMGR_RESET(_reset) \ 34 (((_reset) >> RSTMGR_RESET_OFFSET) & RSTMGR_RESET_MASK) 35 36 /* Extract bank ID from the reset identifier. */ 37 #define RSTMGR_BANK(_reset) \ 38 (((_reset) >> RSTMGR_BANK_OFFSET) & RSTMGR_BANK_MASK) 39 40 /* Create a human-readable reference to SoCFPGA reset. */ 41 #define SOCFPGA_RESET(_name) RSTMGR_##_name 42 43 #if defined(CONFIG_TARGET_SOCFPGA_GEN5) 44 #include <asm/arch/reset_manager_gen5.h> 45 #elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) 46 #include <asm/arch/reset_manager_arria10.h> 47 #endif 48 49 #endif /* _RESET_MANAGER_H_ */ 50