1*4765ddb0SLey Foon Tan /* SPDX-License-Identifier: GPL-2.0
2*4765ddb0SLey Foon Tan  *
3*4765ddb0SLey Foon Tan  * Copyright (C) 2017-2018 Intel Corporation <www.intel.com>
4*4765ddb0SLey Foon Tan  *
5*4765ddb0SLey Foon Tan  */
6*4765ddb0SLey Foon Tan 
7*4765ddb0SLey Foon Tan #ifndef	_FIREWALL_S10_
8*4765ddb0SLey Foon Tan #define	_FIREWALL_S10_
9*4765ddb0SLey Foon Tan 
10*4765ddb0SLey Foon Tan struct socfpga_firwall_l4_per {
11*4765ddb0SLey Foon Tan 	u32	nand;		/* 0x00 */
12*4765ddb0SLey Foon Tan 	u32	nand_data;
13*4765ddb0SLey Foon Tan 	u32	_pad_0x8;
14*4765ddb0SLey Foon Tan 	u32	usb0;
15*4765ddb0SLey Foon Tan 	u32	usb1;		/* 0x10 */
16*4765ddb0SLey Foon Tan 	u32	_pad_0x14;
17*4765ddb0SLey Foon Tan 	u32	_pad_0x18;
18*4765ddb0SLey Foon Tan 	u32	spim0;
19*4765ddb0SLey Foon Tan 	u32	spim1;		/* 0x20 */
20*4765ddb0SLey Foon Tan 	u32	spis0;
21*4765ddb0SLey Foon Tan 	u32	spis1;
22*4765ddb0SLey Foon Tan 	u32	emac0;
23*4765ddb0SLey Foon Tan 	u32	emac1;		/* 0x30 */
24*4765ddb0SLey Foon Tan 	u32	emac2;
25*4765ddb0SLey Foon Tan 	u32	_pad_0x38;
26*4765ddb0SLey Foon Tan 	u32	_pad_0x3c;
27*4765ddb0SLey Foon Tan 	u32	sdmmc;		/* 0x40 */
28*4765ddb0SLey Foon Tan 	u32	gpio0;
29*4765ddb0SLey Foon Tan 	u32	gpio1;
30*4765ddb0SLey Foon Tan 	u32	_pad_0x4c;
31*4765ddb0SLey Foon Tan 	u32	i2c0;		/* 0x50 */
32*4765ddb0SLey Foon Tan 	u32	i2c1;
33*4765ddb0SLey Foon Tan 	u32	i2c2;
34*4765ddb0SLey Foon Tan 	u32	i2c3;
35*4765ddb0SLey Foon Tan 	u32	i2c4;		/* 0x60 */
36*4765ddb0SLey Foon Tan 	u32	timer0;
37*4765ddb0SLey Foon Tan 	u32	timer1;
38*4765ddb0SLey Foon Tan 	u32	uart0;
39*4765ddb0SLey Foon Tan 	u32	uart1;		/* 0x70 */
40*4765ddb0SLey Foon Tan };
41*4765ddb0SLey Foon Tan 
42*4765ddb0SLey Foon Tan struct socfpga_firwall_l4_sys {
43*4765ddb0SLey Foon Tan 	u32	_pad_0x00;		/* 0x00 */
44*4765ddb0SLey Foon Tan 	u32	_pad_0x04;
45*4765ddb0SLey Foon Tan 	u32	dma_ecc;
46*4765ddb0SLey Foon Tan 	u32	emac0rx_ecc;
47*4765ddb0SLey Foon Tan 	u32	emac0tx_ecc;		/* 0x10 */
48*4765ddb0SLey Foon Tan 	u32	emac1rx_ecc;
49*4765ddb0SLey Foon Tan 	u32	emac1tx_ecc;
50*4765ddb0SLey Foon Tan 	u32	emac2rx_ecc;
51*4765ddb0SLey Foon Tan 	u32	emac2tx_ecc;		/* 0x20 */
52*4765ddb0SLey Foon Tan 	u32	_pad_0x24;
53*4765ddb0SLey Foon Tan 	u32	_pad_0x28;
54*4765ddb0SLey Foon Tan 	u32	nand_ecc;
55*4765ddb0SLey Foon Tan 	u32	nand_read_ecc;		/* 0x30 */
56*4765ddb0SLey Foon Tan 	u32	nand_write_ecc;
57*4765ddb0SLey Foon Tan 	u32	ocram_ecc;
58*4765ddb0SLey Foon Tan 	u32	_pad_0x3c;
59*4765ddb0SLey Foon Tan 	u32	sdmmc_ecc;		/* 0x40 */
60*4765ddb0SLey Foon Tan 	u32	usb0_ecc;
61*4765ddb0SLey Foon Tan 	u32	usb1_ecc;
62*4765ddb0SLey Foon Tan 	u32	clock_manager;
63*4765ddb0SLey Foon Tan 	u32	_pad_0x50;		/* 0x50 */
64*4765ddb0SLey Foon Tan 	u32	io_manager;
65*4765ddb0SLey Foon Tan 	u32	reset_manager;
66*4765ddb0SLey Foon Tan 	u32	system_manager;
67*4765ddb0SLey Foon Tan 	u32	osc0_timer;		/* 0x60 */
68*4765ddb0SLey Foon Tan 	u32	osc1_timer;
69*4765ddb0SLey Foon Tan 	u32	watchdog0;
70*4765ddb0SLey Foon Tan 	u32	watchdog1;
71*4765ddb0SLey Foon Tan 	u32	watchdog2;		/* 0x70 */
72*4765ddb0SLey Foon Tan 	u32	watchdog3;
73*4765ddb0SLey Foon Tan };
74*4765ddb0SLey Foon Tan 
75*4765ddb0SLey Foon Tan #define FIREWALL_L4_DISABLE_ALL		(BIT(0) | BIT(24) | BIT(16))
76*4765ddb0SLey Foon Tan #define FIREWALL_BRIDGE_DISABLE_ALL	(~0)
77*4765ddb0SLey Foon Tan 
78*4765ddb0SLey Foon Tan /* Cache coherency unit (CCU) registers */
79*4765ddb0SLey Foon Tan #define CCU_CPU0_MPRT_ADBASE_DDRREG		0x4400
80*4765ddb0SLey Foon Tan #define CCU_CPU0_MPRT_ADBASE_MEMSPACE0		0x45c0
81*4765ddb0SLey Foon Tan #define CCU_CPU0_MPRT_ADBASE_MEMSPACE1A		0x45e0
82*4765ddb0SLey Foon Tan #define CCU_CPU0_MPRT_ADBASE_MEMSPACE1B		0x4600
83*4765ddb0SLey Foon Tan #define CCU_CPU0_MPRT_ADBASE_MEMSPACE1C		0x4620
84*4765ddb0SLey Foon Tan #define CCU_CPU0_MPRT_ADBASE_MEMSPACE1D		0x4640
85*4765ddb0SLey Foon Tan #define CCU_CPU0_MPRT_ADBASE_MEMSPACE1E		0x4660
86*4765ddb0SLey Foon Tan 
87*4765ddb0SLey Foon Tan #define CCU_CPU0_MPRT_ADMASK_MEM_RAM0		0x4688
88*4765ddb0SLey Foon Tan 
89*4765ddb0SLey Foon Tan #define CCU_IOM_MPRT_ADBASE_MEMSPACE0		0x18560
90*4765ddb0SLey Foon Tan #define CCU_IOM_MPRT_ADBASE_MEMSPACE1A		0x18580
91*4765ddb0SLey Foon Tan #define CCU_IOM_MPRT_ADBASE_MEMSPACE1B		0x185a0
92*4765ddb0SLey Foon Tan #define CCU_IOM_MPRT_ADBASE_MEMSPACE1C		0x185c0
93*4765ddb0SLey Foon Tan #define CCU_IOM_MPRT_ADBASE_MEMSPACE1D		0x185e0
94*4765ddb0SLey Foon Tan #define CCU_IOM_MPRT_ADBASE_MEMSPACE1E		0x18600
95*4765ddb0SLey Foon Tan 
96*4765ddb0SLey Foon Tan #define CCU_IOM_MPRT_ADMASK_MEM_RAM0		0x18628
97*4765ddb0SLey Foon Tan 
98*4765ddb0SLey Foon Tan #define CCU_ADMASK_P_MASK			BIT(0)
99*4765ddb0SLey Foon Tan #define CCU_ADMASK_NS_MASK			BIT(1)
100*4765ddb0SLey Foon Tan 
101*4765ddb0SLey Foon Tan #define CCU_ADBASE_DI_MASK			BIT(4)
102*4765ddb0SLey Foon Tan 
103*4765ddb0SLey Foon Tan #define CCU_REG_ADDR(reg)			\
104*4765ddb0SLey Foon Tan 	(SOCFPGA_CCU_ADDRESS + (reg))
105*4765ddb0SLey Foon Tan 
106*4765ddb0SLey Foon Tan /* Firewall MPU DDR SCR registers */
107*4765ddb0SLey Foon Tan #define FW_MPU_DDR_SCR_EN				0x00
108*4765ddb0SLey Foon Tan #define FW_MPU_DDR_SCR_EN_SET				0x04
109*4765ddb0SLey Foon Tan #define FW_MPU_DDR_SCR_MPUREGION0ADDR_LIMIT		0x18
110*4765ddb0SLey Foon Tan #define FW_MPU_DDR_SCR_MPUREGION0ADDR_LIMITEXT		0x1c
111*4765ddb0SLey Foon Tan #define FW_MPU_DDR_SCR_NONMPUREGION0ADDR_LIMIT		0x98
112*4765ddb0SLey Foon Tan #define FW_MPU_DDR_SCR_NONMPUREGION0ADDR_LIMITEXT	0x9c
113*4765ddb0SLey Foon Tan 
114*4765ddb0SLey Foon Tan #define MPUREGION0_ENABLE				BIT(0)
115*4765ddb0SLey Foon Tan #define NONMPUREGION0_ENABLE				BIT(8)
116*4765ddb0SLey Foon Tan 
117*4765ddb0SLey Foon Tan #define FW_MPU_DDR_SCR_WRITEL(data, reg)		\
118*4765ddb0SLey Foon Tan 	writel(data, SOCFPGA_FW_MPU_DDR_SCR_ADDRESS + (reg))
119*4765ddb0SLey Foon Tan 
120*4765ddb0SLey Foon Tan #endif /* _FIREWALL_S10_ */
121