1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2016, Spreadtrum Communications Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef PLATFORM_CONFIG_H
30 #define PLATFORM_CONFIG_H
31 
32 /* Make stacks aligned to data cache line length */
33 #define STACK_ALIGNMENT		64
34 
35 #ifdef ARM64
36 #ifdef CFG_WITH_PAGER
37 #error "Pager not supported for ARM64"
38 #endif
39 #endif /*ARM64*/
40 
41 #if defined(PLATFORM_FLAVOR_sc9860)
42 
43 #define GIC_BASE		0x12000000
44 #define UART0_BASE		0x70000000
45 #define UART1_BASE		0x70100000
46 #define UART2_BASE		0x70200000
47 #define UART3_BASE		0x70300000
48 
49 #define CONSOLE_UART_BASE	UART1_BASE
50 
51 #define DRAM0_BASE		0x80000000
52 #define DRAM0_SIZE		0x20000000
53 
54 #define TZDRAM_BASE		0x8f600000
55 #define TZDRAM_SIZE		(0x02000000 - TEE_SHMEM_SIZE)
56 
57 #define TEE_SHMEM_START		(TZDRAM_BASE + TZDRAM_SIZE)
58 #define TEE_SHMEM_SIZE		0x200000
59 
60 #define GICC_OFFSET		0x2000
61 #define GICD_OFFSET		0x1000
62 
63 #else
64 #error "Unknown platform flavor"
65 #endif
66 
67 #define TEE_RAM_VA_SIZE		(1024 * 1024)
68 
69 #ifdef CFG_TEE_LOAD_ADDR
70 #define TEE_LOAD_ADDR			CFG_TEE_LOAD_ADDR
71 #else
72 #define TEE_LOAD_ADDR			TEE_RAM_START
73 #endif
74 /*
75  * +------------------+
76  * |        | TEE_RAM |
77  * + TZDRAM +---------+
78  * |        | TA_RAM  |
79  * +--------+---------+
80  */
81 #define TEE_RAM_PH_SIZE		TEE_RAM_VA_SIZE
82 #define TEE_RAM_START		TZDRAM_BASE
83 #define TA_RAM_START		ROUNDUP((TZDRAM_BASE + TEE_RAM_VA_SIZE), \
84 					CORE_MMU_PGDIR_SIZE)
85 #define TA_RAM_SIZE		ROUNDDOWN((TZDRAM_SIZE - TEE_RAM_VA_SIZE), \
86 					  CORE_MMU_PGDIR_SIZE)
87 
88 #endif /*PLATFORM_CONFIG_H*/
89