xref: /rk3399_rockchip-uboot/include/fsl-mc/fsl_mc.h (revision 7b3bd9a7988a8b4c8ba22a52b4927e8e59819b12)
1*7b3bd9a7SJ. German Rivera /*
2*7b3bd9a7SJ. German Rivera  * Copyright (C) 2014 Freescale Semiconductor
3*7b3bd9a7SJ. German Rivera  *
4*7b3bd9a7SJ. German Rivera  * SPDX-License-Identifier:	GPL-2.0+
5*7b3bd9a7SJ. German Rivera  */
6*7b3bd9a7SJ. German Rivera 
7*7b3bd9a7SJ. German Rivera #ifndef __FSL_MC_H__
8*7b3bd9a7SJ. German Rivera #define __FSL_MC_H__
9*7b3bd9a7SJ. German Rivera 
10*7b3bd9a7SJ. German Rivera #include <common.h>
11*7b3bd9a7SJ. German Rivera 
12*7b3bd9a7SJ. German Rivera #define MC_CCSR_BASE_ADDR \
13*7b3bd9a7SJ. German Rivera 	((struct mc_ccsr_registers __iomem *)0x8340000)
14*7b3bd9a7SJ. German Rivera 
15*7b3bd9a7SJ. German Rivera #define BIT(x)			(1 << (x))
16*7b3bd9a7SJ. German Rivera #define GCR1_P1_STOP		BIT(31)
17*7b3bd9a7SJ. German Rivera #define GCR1_P2_STOP		BIT(30)
18*7b3bd9a7SJ. German Rivera #define GCR1_P1_DE_RST		BIT(23)
19*7b3bd9a7SJ. German Rivera #define GCR1_P2_DE_RST		BIT(22)
20*7b3bd9a7SJ. German Rivera #define GCR1_M1_DE_RST		BIT(15)
21*7b3bd9a7SJ. German Rivera #define GCR1_M2_DE_RST		BIT(14)
22*7b3bd9a7SJ. German Rivera #define GCR1_M_ALL_DE_RST	(GCR1_M1_DE_RST | GCR1_M2_DE_RST)
23*7b3bd9a7SJ. German Rivera #define GSR_FS_MASK		0x3fffffff
24*7b3bd9a7SJ. German Rivera #define MCFAPR_PL_MASK		(0x1 << 18)
25*7b3bd9a7SJ. German Rivera #define MCFAPR_BMT_MASK		(0x1 << 17)
26*7b3bd9a7SJ. German Rivera #define MCFAPR_BYPASS_ICID_MASK	\
27*7b3bd9a7SJ. German Rivera 	(MCFAPR_PL_MASK | MCFAPR_BMT_MASK)
28*7b3bd9a7SJ. German Rivera 
29*7b3bd9a7SJ. German Rivera #define SOC_MC_PORTALS_BASE_ADDR    ((void __iomem *)0x00080C000000)
30*7b3bd9a7SJ. German Rivera #define SOC_MC_PORTAL_STRIDE	    0x10000
31*7b3bd9a7SJ. German Rivera 
32*7b3bd9a7SJ. German Rivera #define SOC_MC_PORTAL_ADDR(_portal_id) \
33*7b3bd9a7SJ. German Rivera 	((void __iomem *)((uintptr_t)SOC_MC_PORTALS_BASE_ADDR + \
34*7b3bd9a7SJ. German Rivera 	 (_portal_id) * SOC_MC_PORTAL_STRIDE))
35*7b3bd9a7SJ. German Rivera 
36*7b3bd9a7SJ. German Rivera struct mc_ccsr_registers {
37*7b3bd9a7SJ. German Rivera 	u32 reg_gcr1;
38*7b3bd9a7SJ. German Rivera 	u32 reserved1;
39*7b3bd9a7SJ. German Rivera 	u32 reg_gsr;
40*7b3bd9a7SJ. German Rivera 	u32 reserved2;
41*7b3bd9a7SJ. German Rivera 	u32 reg_sicbalr;
42*7b3bd9a7SJ. German Rivera 	u32 reg_sicbahr;
43*7b3bd9a7SJ. German Rivera 	u32 reg_sicapr;
44*7b3bd9a7SJ. German Rivera 	u32 reserved3;
45*7b3bd9a7SJ. German Rivera 	u32 reg_mcfbalr;
46*7b3bd9a7SJ. German Rivera 	u32 reg_mcfbahr;
47*7b3bd9a7SJ. German Rivera 	u32 reg_mcfapr;
48*7b3bd9a7SJ. German Rivera 	u32 reserved4[0x2f1];
49*7b3bd9a7SJ. German Rivera 	u32 reg_psr;
50*7b3bd9a7SJ. German Rivera 	u32 reserved5;
51*7b3bd9a7SJ. German Rivera 	u32 reg_brr[2];
52*7b3bd9a7SJ. German Rivera 	u32 reserved6[0x80];
53*7b3bd9a7SJ. German Rivera 	u32 reg_error[];
54*7b3bd9a7SJ. German Rivera };
55*7b3bd9a7SJ. German Rivera 
56*7b3bd9a7SJ. German Rivera int mc_init(bd_t *bis);
57*7b3bd9a7SJ. German Rivera 
58*7b3bd9a7SJ. German Rivera int get_mc_boot_status(void);
59*7b3bd9a7SJ. German Rivera #endif
60