xref: /rk3399_rockchip-uboot/include/fsl-mc/fsl_mc.h (revision 422cb08acb1bc9a05ffa68ba68b4e196dad1af5b)
17b3bd9a7SJ. German Rivera /*
27b3bd9a7SJ. German Rivera  * Copyright (C) 2014 Freescale Semiconductor
37b3bd9a7SJ. German Rivera  *
47b3bd9a7SJ. German Rivera  * SPDX-License-Identifier:	GPL-2.0+
57b3bd9a7SJ. German Rivera  */
67b3bd9a7SJ. German Rivera 
77b3bd9a7SJ. German Rivera #ifndef __FSL_MC_H__
87b3bd9a7SJ. German Rivera #define __FSL_MC_H__
97b3bd9a7SJ. German Rivera 
107b3bd9a7SJ. German Rivera #include <common.h>
117b3bd9a7SJ. German Rivera 
127b3bd9a7SJ. German Rivera #define MC_CCSR_BASE_ADDR \
137b3bd9a7SJ. German Rivera 	((struct mc_ccsr_registers __iomem *)0x8340000)
147b3bd9a7SJ. German Rivera 
157b3bd9a7SJ. German Rivera #define BIT(x)			(1 << (x))
167b3bd9a7SJ. German Rivera #define GCR1_P1_STOP		BIT(31)
177b3bd9a7SJ. German Rivera #define GCR1_P2_STOP		BIT(30)
187b3bd9a7SJ. German Rivera #define GCR1_P1_DE_RST		BIT(23)
197b3bd9a7SJ. German Rivera #define GCR1_P2_DE_RST		BIT(22)
207b3bd9a7SJ. German Rivera #define GCR1_M1_DE_RST		BIT(15)
217b3bd9a7SJ. German Rivera #define GCR1_M2_DE_RST		BIT(14)
227b3bd9a7SJ. German Rivera #define GCR1_M_ALL_DE_RST	(GCR1_M1_DE_RST | GCR1_M2_DE_RST)
237b3bd9a7SJ. German Rivera #define GSR_FS_MASK		0x3fffffff
247b3bd9a7SJ. German Rivera #define MCFAPR_PL_MASK		(0x1 << 18)
257b3bd9a7SJ. German Rivera #define MCFAPR_BMT_MASK		(0x1 << 17)
267b3bd9a7SJ. German Rivera #define MCFAPR_BYPASS_ICID_MASK	\
277b3bd9a7SJ. German Rivera 	(MCFAPR_PL_MASK | MCFAPR_BMT_MASK)
287b3bd9a7SJ. German Rivera 
297b3bd9a7SJ. German Rivera #define SOC_MC_PORTALS_BASE_ADDR    ((void __iomem *)0x00080C000000)
307b3bd9a7SJ. German Rivera #define SOC_MC_PORTAL_STRIDE	    0x10000
317b3bd9a7SJ. German Rivera 
327b3bd9a7SJ. German Rivera #define SOC_MC_PORTAL_ADDR(_portal_id) \
337b3bd9a7SJ. German Rivera 	((void __iomem *)((uintptr_t)SOC_MC_PORTALS_BASE_ADDR + \
347b3bd9a7SJ. German Rivera 	 (_portal_id) * SOC_MC_PORTAL_STRIDE))
357b3bd9a7SJ. German Rivera 
367b3bd9a7SJ. German Rivera struct mc_ccsr_registers {
377b3bd9a7SJ. German Rivera 	u32 reg_gcr1;
387b3bd9a7SJ. German Rivera 	u32 reserved1;
397b3bd9a7SJ. German Rivera 	u32 reg_gsr;
407b3bd9a7SJ. German Rivera 	u32 reserved2;
417b3bd9a7SJ. German Rivera 	u32 reg_sicbalr;
427b3bd9a7SJ. German Rivera 	u32 reg_sicbahr;
437b3bd9a7SJ. German Rivera 	u32 reg_sicapr;
447b3bd9a7SJ. German Rivera 	u32 reserved3;
457b3bd9a7SJ. German Rivera 	u32 reg_mcfbalr;
467b3bd9a7SJ. German Rivera 	u32 reg_mcfbahr;
477b3bd9a7SJ. German Rivera 	u32 reg_mcfapr;
487b3bd9a7SJ. German Rivera 	u32 reserved4[0x2f1];
497b3bd9a7SJ. German Rivera 	u32 reg_psr;
507b3bd9a7SJ. German Rivera 	u32 reserved5;
517b3bd9a7SJ. German Rivera 	u32 reg_brr[2];
527b3bd9a7SJ. German Rivera 	u32 reserved6[0x80];
537b3bd9a7SJ. German Rivera 	u32 reg_error[];
547b3bd9a7SJ. German Rivera };
557b3bd9a7SJ. German Rivera 
567b3bd9a7SJ. German Rivera int mc_init(bd_t *bis);
577b3bd9a7SJ. German Rivera 
587b3bd9a7SJ. German Rivera int get_mc_boot_status(void);
59*422cb08aSBhupesh Sharma unsigned long mc_get_dram_block_size(void);
607b3bd9a7SJ. German Rivera #endif
61