xref: /rk3399_ARM-atf/include/plat/arm/board/common/board_css_def.h (revision aa61368eb554e9910c503f78560153805a2d6859)
1 /*
2  * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * Neither the name of ARM nor the names of its contributors may be used
15  * to endorse or promote products derived from this software without specific
16  * prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef __BOARD_CSS_DEF_H__
32 #define __BOARD_CSS_DEF_H__
33 
34 #include <common_def.h>
35 #include <soc_css_def.h>
36 #include <utils.h>
37 #include <v2m_def.h>
38 
39 /*
40  * Definitions common to all ARM CSS-based development platforms
41  */
42 
43 /* Platform ID address */
44 #define BOARD_CSS_PLAT_ID_REG_ADDR		0x7ffe00e0
45 
46 /* Platform ID related accessors */
47 #define BOARD_CSS_PLAT_ID_REG_ID_MASK		0x0f
48 #define BOARD_CSS_PLAT_ID_REG_ID_SHIFT		0x0
49 #define BOARD_CSS_PLAT_ID_REG_VERSION_MASK	0xf00
50 #define BOARD_CSS_PLAT_ID_REG_VERSION_SHIFT	0x8
51 #define BOARD_CSS_PLAT_TYPE_RTL			0x00
52 #define BOARD_CSS_PLAT_TYPE_FPGA		0x01
53 #define BOARD_CSS_PLAT_TYPE_EMULATOR		0x02
54 #define BOARD_CSS_PLAT_TYPE_FVP			0x03
55 
56 #ifndef __ASSEMBLY__
57 
58 #include <mmio.h>
59 
60 #define BOARD_CSS_GET_PLAT_TYPE(addr)					\
61 	((mmio_read_32(addr) & BOARD_CSS_PLAT_ID_REG_ID_MASK)		\
62 	>> BOARD_CSS_PLAT_ID_REG_ID_SHIFT)
63 
64 #endif /* __ASSEMBLY__ */
65 
66 
67 /*
68  * Required platform porting definitions common to all ARM CSS-based
69  * development platforms
70  */
71 
72 #define PLAT_ARM_DRAM2_SIZE			ULL(0x180000000)
73 
74 /* UART related constants */
75 #define PLAT_ARM_BOOT_UART_BASE			SOC_CSS_UART0_BASE
76 #define PLAT_ARM_BOOT_UART_CLK_IN_HZ		SOC_CSS_UART0_CLK_IN_HZ
77 
78 #define PLAT_ARM_BL31_RUN_UART_BASE		SOC_CSS_UART1_BASE
79 #define PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ	SOC_CSS_UART1_CLK_IN_HZ
80 
81 #define PLAT_ARM_CRASH_UART_BASE		PLAT_ARM_BL31_RUN_UART_BASE
82 #define PLAT_ARM_CRASH_UART_CLK_IN_HZ		PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ
83 
84 #define PLAT_ARM_TSP_UART_BASE			V2M_IOFPGA_UART0_BASE
85 #define PLAT_ARM_TSP_UART_CLK_IN_HZ		V2M_IOFPGA_UART0_CLK_IN_HZ
86 
87 
88 #endif /* __BOARD_CSS_DEF_H__ */
89 
90