2012-10-04 06:46:02 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Altera Corporation <www.altera.com>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2012-10-04 06:46:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _RESET_MANAGER_H_
|
|
|
|
#define _RESET_MANAGER_H_
|
|
|
|
|
|
|
|
void reset_cpu(ulong addr);
|
|
|
|
void reset_deassert_peripherals_handoff(void);
|
|
|
|
|
2014-09-08 12:08:45 +00:00
|
|
|
void socfpga_bridges_reset(int enable);
|
|
|
|
|
2015-07-09 00:45:15 +00:00
|
|
|
void socfpga_per_reset(u32 reset, int set);
|
2015-07-09 02:27:28 +00:00
|
|
|
void socfpga_per_reset_all(void);
|
2015-07-09 00:45:15 +00:00
|
|
|
|
2012-10-04 06:46:02 +00:00
|
|
|
struct socfpga_reset_manager {
|
2013-08-07 15:08:03 +00:00
|
|
|
u32 status;
|
2012-10-04 06:46:02 +00:00
|
|
|
u32 ctrl;
|
2013-08-07 15:08:03 +00:00
|
|
|
u32 counts;
|
|
|
|
u32 padding1;
|
2012-10-04 06:46:02 +00:00
|
|
|
u32 mpu_mod_reset;
|
|
|
|
u32 per_mod_reset;
|
|
|
|
u32 per2_mod_reset;
|
|
|
|
u32 brg_mod_reset;
|
2015-07-09 01:39:06 +00:00
|
|
|
u32 misc_mod_reset;
|
2015-11-12 17:23:10 +00:00
|
|
|
u32 padding2[12];
|
2015-07-09 01:39:06 +00:00
|
|
|
u32 tstscratch;
|
2012-10-04 06:46:02 +00:00
|
|
|
};
|
|
|
|
|
2013-08-07 15:08:03 +00:00
|
|
|
#if defined(CONFIG_SOCFPGA_VIRTUAL_TARGET)
|
|
|
|
#define RSTMGR_CTRL_SWWARMRSTREQ_LSB 2
|
|
|
|
#else
|
2012-10-04 06:46:02 +00:00
|
|
|
#define RSTMGR_CTRL_SWWARMRSTREQ_LSB 1
|
2013-08-07 15:08:03 +00:00
|
|
|
#endif
|
2012-10-04 06:46:02 +00:00
|
|
|
|
2015-07-09 00:30:35 +00:00
|
|
|
/*
|
|
|
|
* Define a reset identifier, from which a permodrst bank ID
|
|
|
|
* and reset ID can be extracted using the subsequent macros
|
|
|
|
* RSTMGR_RESET() and RSTMGR_BANK().
|
|
|
|
*/
|
|
|
|
#define RSTMGR_BANK_OFFSET 8
|
|
|
|
#define RSTMGR_BANK_MASK 0x7
|
|
|
|
#define RSTMGR_RESET_OFFSET 0
|
|
|
|
#define RSTMGR_RESET_MASK 0x1f
|
|
|
|
#define RSTMGR_DEFINE(_bank, _offset) \
|
|
|
|
((_bank) << RSTMGR_BANK_OFFSET) | ((_offset) << RSTMGR_RESET_OFFSET)
|
|
|
|
|
|
|
|
/* Extract reset ID from the reset identifier. */
|
|
|
|
#define RSTMGR_RESET(_reset) \
|
|
|
|
(((_reset) >> RSTMGR_RESET_OFFSET) & RSTMGR_RESET_MASK)
|
|
|
|
|
|
|
|
/* Extract bank ID from the reset identifier. */
|
|
|
|
#define RSTMGR_BANK(_reset) \
|
|
|
|
(((_reset) >> RSTMGR_BANK_OFFSET) & RSTMGR_BANK_MASK)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SocFPGA Cyclone V/Arria V reset IDs, bank mapping is as follows:
|
|
|
|
* 0 ... mpumodrst
|
|
|
|
* 1 ... permodrst
|
|
|
|
* 2 ... per2modrst
|
|
|
|
* 3 ... brgmodrst
|
|
|
|
* 4 ... miscmodrst
|
|
|
|
*/
|
|
|
|
#define RSTMGR_EMAC0 RSTMGR_DEFINE(1, 0)
|
|
|
|
#define RSTMGR_EMAC1 RSTMGR_DEFINE(1, 1)
|
2015-12-20 03:00:41 +00:00
|
|
|
#define RSTMGR_NAND RSTMGR_DEFINE(1, 4)
|
|
|
|
#define RSTMGR_QSPI RSTMGR_DEFINE(1, 5)
|
2015-07-09 00:30:35 +00:00
|
|
|
#define RSTMGR_L4WD0 RSTMGR_DEFINE(1, 6)
|
|
|
|
#define RSTMGR_OSC1TIMER0 RSTMGR_DEFINE(1, 8)
|
|
|
|
#define RSTMGR_UART0 RSTMGR_DEFINE(1, 16)
|
|
|
|
#define RSTMGR_SPIM0 RSTMGR_DEFINE(1, 18)
|
|
|
|
#define RSTMGR_SPIM1 RSTMGR_DEFINE(1, 19)
|
2015-11-02 23:11:21 +00:00
|
|
|
#define RSTMGR_SDMMC RSTMGR_DEFINE(1, 22)
|
|
|
|
#define RSTMGR_DMA RSTMGR_DEFINE(1, 28)
|
2015-07-09 00:30:35 +00:00
|
|
|
#define RSTMGR_SDR RSTMGR_DEFINE(1, 29)
|
|
|
|
|
|
|
|
/* Create a human-readable reference to SoCFPGA reset. */
|
|
|
|
#define SOCFPGA_RESET(_name) RSTMGR_##_name
|
2014-09-09 12:03:28 +00:00
|
|
|
|
2012-10-04 06:46:02 +00:00
|
|
|
#endif /* _RESET_MANAGER_H_ */
|