summaryrefslogtreecommitdiff
path: root/arch/arm/mach-socfpga/include/mach/reset_manager_soc64.h
blob: 4b010be9ee8ad175668d3ab86c132bb4090d2059 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* SPDX-License-Identifier: GPL-2.0 */
/*
 *  Copyright (C) 2016-2019 Intel Corporation <www.intel.com>
 *  Copyright (C) 2025 Altera Corporation <www.altera.com>
 */

#ifndef _RESET_MANAGER_SOC64_H_
#define _RESET_MANAGER_SOC64_H_

void reset_deassert_peripherals_handoff(void);
int cpu_has_been_warmreset(void);
void print_reset_info(void);
void socfpga_bridges_reset(int enable, unsigned int mask);

#define RSTMGR_SOC64_STATUS	0x00
#define RSTMGR_SOC64_HDSKEN	0x10
#define RSTMGR_SOC64_HDSKREQ	0x14
#define RSTMGR_SOC64_HDSKACK	0x18
#define RSTMGR_SOC64_MPUMODRST	0x20
#define RSTMGR_SOC64_PER0MODRST	0x24
#define RSTMGR_SOC64_PER1MODRST	0x28
#define RSTMGR_SOC64_BRGMODRST	0x2c

#define RSTMGR_MPUMODRST_CORE0		0
#define RSTMGR_PER0MODRST_OCP_MASK	0x0020bf00

#define RSTMGR_BRGMODRST_SOC2FPGA_MASK		BIT(0)
#define RSTMGR_BRGMODRST_LWSOC2FPGA_MASK	BIT(1)
#define RSTMGR_BRGMODRST_FPGA2SOC_MASK		BIT(2)
#define RSTMGR_BRGMODRST_F2SDRAM0_MASK		BIT(3)
#define RSTMGR_BRGMODRST_F2SDRAM1_MASK		BIT(4)
#define RSTMGR_BRGMODRST_F2SDRAM2_MASK		BIT(5)
#define RSTMGR_BRGMODRST_DDRSCH_MASK		BIT(6)

#define RSTMGR_HDSKEN_FPGAHSEN		BIT(2)
#define RSTMGR_HDSKREQ_FPGAHSREQ	BIT(2)

/* SDM, Watchdogs and MPU warm reset mask */
#define RSTMGR_STAT_SDMWARMRST		0x2
#define RSTMGR_STAT_MPU0RST_BITPOS	8
#define RSTMGR_STAT_L4WD0RST_BITPOS	16
#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
#define RSTMGR_STAT_L4WD0RST_BIT	0x1F0000
#define RSTMGR_L4WD_MPU_WARMRESET_MASK	(RSTMGR_STAT_SDMWARMRST | \
		RSTMGR_STAT_L4WD0RST_BIT)
#else
#define RSTMGR_L4WD_MPU_WARMRESET_MASK	(RSTMGR_STAT_SDMWARMRST | \
		GENMASK(RSTMGR_STAT_MPU0RST_BITPOS + 3, \
			RSTMGR_STAT_MPU0RST_BITPOS) | \
		GENMASK(RSTMGR_STAT_L4WD0RST_BITPOS + 3, \
			RSTMGR_STAT_L4WD0RST_BITPOS))
#endif

/*
 * SocFPGA Stratix10 reset IDs, bank mapping is as follows:
 * 0 ... mpumodrst
 * 1 ... per0modrst
 * 2 ... per1modrst
 * 3 ... brgmodrst
 */
#define RSTMGR_L4WD0		RSTMGR_DEFINE(2, 0)
#define RSTMGR_OSC1TIMER0	RSTMGR_DEFINE(2, 4)
#define RSTMGR_UART0		RSTMGR_DEFINE(2, 16)

#endif /* _RESET_MANAGER_SOC64_H_ */