2 * Copyright 2014-2015, Freescale Semiconductor
4 * SPDX-License-Identifier: GPL-2.0+
7 #ifndef _FSL_LAYERSCAPE_CPU_H
8 #define _FSL_LAYERSCAPE_CPU_H
10 static struct cpu_type cpu_type_list[] = {
11 CPU_TYPE_ENTRY(LS2080, LS2080, 8),
12 CPU_TYPE_ENTRY(LS2085, LS2085, 8),
13 CPU_TYPE_ENTRY(LS2045, LS2045, 4),
14 CPU_TYPE_ENTRY(LS1043, LS1043, 4),
15 CPU_TYPE_ENTRY(LS2040, LS2040, 4),
18 #ifndef CONFIG_SYS_DCACHE_OFF
20 #define SECTION_SHIFT_L0 39UL
21 #define SECTION_SHIFT_L1 30UL
22 #define SECTION_SHIFT_L2 21UL
23 #define BLOCK_SIZE_L0 0x8000000000
24 #define BLOCK_SIZE_L1 0x40000000
25 #define BLOCK_SIZE_L2 0x200000
26 #define NUM_OF_ENTRY 512
27 #define TCR_EL2_PS_40BIT (2 << 16)
29 #define LAYERSCAPE_VA_BITS (40)
30 #define LAYERSCAPE_TCR (TCR_TG0_4K | \
35 TCR_T0SZ(LAYERSCAPE_VA_BITS))
36 #define LAYERSCAPE_TCR_FINAL (TCR_TG0_4K | \
41 TCR_T0SZ(LAYERSCAPE_VA_BITS))
43 #ifdef CONFIG_FSL_LSCH3
44 #define CONFIG_SYS_FSL_CCSR_BASE 0x00000000
45 #define CONFIG_SYS_FSL_CCSR_SIZE 0x10000000
46 #define CONFIG_SYS_FSL_QSPI_BASE1 0x20000000
47 #define CONFIG_SYS_FSL_QSPI_SIZE1 0x10000000
48 #define CONFIG_SYS_FSL_IFC_BASE1 0x30000000
49 #define CONFIG_SYS_FSL_IFC_SIZE1 0x10000000
50 #define CONFIG_SYS_FSL_IFC_SIZE1_1 0x400000
51 #define CONFIG_SYS_FSL_DRAM_BASE1 0x80000000
52 #define CONFIG_SYS_FSL_DRAM_SIZE1 0x80000000
53 #define CONFIG_SYS_FSL_QSPI_BASE2 0x400000000
54 #define CONFIG_SYS_FSL_QSPI_SIZE2 0x100000000
55 #define CONFIG_SYS_FSL_IFC_BASE2 0x500000000
56 #define CONFIG_SYS_FSL_IFC_SIZE2 0x100000000
57 #define CONFIG_SYS_FSL_DCSR_BASE 0x700000000
58 #define CONFIG_SYS_FSL_DCSR_SIZE 0x40000000
59 #define CONFIG_SYS_FSL_MC_BASE 0x80c000000
60 #define CONFIG_SYS_FSL_MC_SIZE 0x4000000
61 #define CONFIG_SYS_FSL_NI_BASE 0x810000000
62 #define CONFIG_SYS_FSL_NI_SIZE 0x8000000
63 #define CONFIG_SYS_FSL_QBMAN_BASE 0x818000000
64 #define CONFIG_SYS_FSL_QBMAN_SIZE 0x8000000
65 #define CONFIG_SYS_FSL_QBMAN_SIZE_1 0x4000000
66 #define CONFIG_SYS_PCIE1_PHYS_SIZE 0x200000000
67 #define CONFIG_SYS_PCIE2_PHYS_SIZE 0x200000000
68 #define CONFIG_SYS_PCIE3_PHYS_SIZE 0x200000000
69 #define CONFIG_SYS_PCIE4_PHYS_SIZE 0x200000000
70 #define CONFIG_SYS_FSL_WRIOP1_BASE 0x4300000000
71 #define CONFIG_SYS_FSL_WRIOP1_SIZE 0x100000000
72 #define CONFIG_SYS_FSL_AIOP1_BASE 0x4b00000000
73 #define CONFIG_SYS_FSL_AIOP1_SIZE 0x100000000
74 #define CONFIG_SYS_FSL_PEBUF_BASE 0x4c00000000
75 #define CONFIG_SYS_FSL_PEBUF_SIZE 0x400000000
76 #define CONFIG_SYS_FSL_DRAM_BASE2 0x8080000000
77 #define CONFIG_SYS_FSL_DRAM_SIZE2 0x7F80000000
78 #elif defined(CONFIG_FSL_LSCH2)
79 #define CONFIG_SYS_FSL_BOOTROM_BASE 0x0
80 #define CONFIG_SYS_FSL_BOOTROM_SIZE 0x1000000
81 #define CONFIG_SYS_FSL_CCSR_BASE 0x1000000
82 #define CONFIG_SYS_FSL_CCSR_SIZE 0xf000000
83 #define CONFIG_SYS_FSL_DCSR_BASE 0x20000000
84 #define CONFIG_SYS_FSL_DCSR_SIZE 0x4000000
85 #define CONFIG_SYS_FSL_QSPI_BASE 0x40000000
86 #define CONFIG_SYS_FSL_QSPI_SIZE 0x20000000
87 #define CONFIG_SYS_FSL_IFC_BASE 0x60000000
88 #define CONFIG_SYS_FSL_IFC_SIZE 0x20000000
89 #define CONFIG_SYS_FSL_DRAM_BASE1 0x80000000
90 #define CONFIG_SYS_FSL_DRAM_SIZE1 0x80000000
91 #define CONFIG_SYS_FSL_QBMAN_BASE 0x500000000
92 #define CONFIG_SYS_FSL_QBMAN_SIZE 0x10000000
93 #define CONFIG_SYS_FSL_DRAM_BASE2 0x880000000
94 #define CONFIG_SYS_FSL_DRAM_SIZE2 0x780000000 /* 30GB */
95 #define CONFIG_SYS_PCIE1_PHYS_SIZE 0x800000000
96 #define CONFIG_SYS_PCIE2_PHYS_SIZE 0x800000000
97 #define CONFIG_SYS_PCIE3_PHYS_SIZE 0x800000000
98 #define CONFIG_SYS_FSL_DRAM_BASE3 0x8800000000
99 #define CONFIG_SYS_FSL_DRAM_SIZE3 0x7800000000 /* 480GB */
102 struct sys_mmu_table {
116 static const struct sys_mmu_table early_mmu_table[] = {
117 #ifdef CONFIG_FSL_LSCH3
118 { CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
119 CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE,
120 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
121 { CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
122 CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
123 /* For IFC Region #1, only the first 4MB is cache-enabled */
124 { CONFIG_SYS_FSL_IFC_BASE1, CONFIG_SYS_FSL_IFC_BASE1,
125 CONFIG_SYS_FSL_IFC_SIZE1_1, MT_NORMAL, PMD_SECT_NON_SHARE },
126 { CONFIG_SYS_FSL_IFC_BASE1 + CONFIG_SYS_FSL_IFC_SIZE1_1,
127 CONFIG_SYS_FSL_IFC_BASE1 + CONFIG_SYS_FSL_IFC_SIZE1_1,
128 CONFIG_SYS_FSL_IFC_SIZE1 - CONFIG_SYS_FSL_IFC_SIZE1_1,
129 MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
130 { CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FSL_IFC_BASE1,
131 CONFIG_SYS_FSL_IFC_SIZE1, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
132 { CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
133 CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL,
134 PMD_SECT_OUTER_SHARE | PMD_SECT_NS },
135 /* Map IFC region #2 up to CONFIG_SYS_FLASH_BASE for NAND boot */
136 { CONFIG_SYS_FSL_IFC_BASE2, CONFIG_SYS_FSL_IFC_BASE2,
137 CONFIG_SYS_FLASH_BASE - CONFIG_SYS_FSL_IFC_BASE2,
138 MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
139 { CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
140 CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE,
141 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
142 { CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
143 CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL,
144 PMD_SECT_OUTER_SHARE | PMD_SECT_NS },
145 #elif defined(CONFIG_FSL_LSCH2)
146 { CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
147 CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE,
148 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
149 { CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
150 CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
151 { CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
152 CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE,
153 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
154 { CONFIG_SYS_FSL_IFC_BASE, CONFIG_SYS_FSL_IFC_BASE,
155 CONFIG_SYS_FSL_IFC_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
156 { CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
157 CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL, PMD_SECT_OUTER_SHARE },
158 { CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
159 CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
163 static const struct sys_mmu_table final_mmu_table[] = {
164 #ifdef CONFIG_FSL_LSCH3
165 { CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
166 CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE,
167 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
168 { CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
169 CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
170 { CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
171 CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL,
172 PMD_SECT_OUTER_SHARE | PMD_SECT_NS },
173 { CONFIG_SYS_FSL_QSPI_BASE2, CONFIG_SYS_FSL_QSPI_BASE2,
174 CONFIG_SYS_FSL_QSPI_SIZE2, MT_DEVICE_NGNRNE,
175 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
176 { CONFIG_SYS_FSL_IFC_BASE2, CONFIG_SYS_FSL_IFC_BASE2,
177 CONFIG_SYS_FSL_IFC_SIZE2, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
178 { CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
179 CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE,
180 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
181 { CONFIG_SYS_FSL_MC_BASE, CONFIG_SYS_FSL_MC_BASE,
182 CONFIG_SYS_FSL_MC_SIZE, MT_DEVICE_NGNRNE,
183 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
184 { CONFIG_SYS_FSL_NI_BASE, CONFIG_SYS_FSL_NI_BASE,
185 CONFIG_SYS_FSL_NI_SIZE, MT_DEVICE_NGNRNE,
186 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
187 /* For QBMAN portal, only the first 64MB is cache-enabled */
188 { CONFIG_SYS_FSL_QBMAN_BASE, CONFIG_SYS_FSL_QBMAN_BASE,
189 CONFIG_SYS_FSL_QBMAN_SIZE_1, MT_NORMAL,
190 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN | PMD_SECT_NS },
191 { CONFIG_SYS_FSL_QBMAN_BASE + CONFIG_SYS_FSL_QBMAN_SIZE_1,
192 CONFIG_SYS_FSL_QBMAN_BASE + CONFIG_SYS_FSL_QBMAN_SIZE_1,
193 CONFIG_SYS_FSL_QBMAN_SIZE - CONFIG_SYS_FSL_QBMAN_SIZE_1,
194 MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
195 { CONFIG_SYS_PCIE1_PHYS_ADDR, CONFIG_SYS_PCIE1_PHYS_ADDR,
196 CONFIG_SYS_PCIE1_PHYS_SIZE, MT_DEVICE_NGNRNE,
197 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
198 { CONFIG_SYS_PCIE2_PHYS_ADDR, CONFIG_SYS_PCIE2_PHYS_ADDR,
199 CONFIG_SYS_PCIE2_PHYS_SIZE, MT_DEVICE_NGNRNE,
200 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
201 { CONFIG_SYS_PCIE3_PHYS_ADDR, CONFIG_SYS_PCIE3_PHYS_ADDR,
202 CONFIG_SYS_PCIE3_PHYS_SIZE, MT_DEVICE_NGNRNE,
203 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
204 #if defined(CONFIG_LS2080A) || defined(CONFIG_LS2085A)
205 { CONFIG_SYS_PCIE4_PHYS_ADDR, CONFIG_SYS_PCIE4_PHYS_ADDR,
206 CONFIG_SYS_PCIE4_PHYS_SIZE, MT_DEVICE_NGNRNE,
207 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
209 { CONFIG_SYS_FSL_WRIOP1_BASE, CONFIG_SYS_FSL_WRIOP1_BASE,
210 CONFIG_SYS_FSL_WRIOP1_SIZE, MT_DEVICE_NGNRNE,
211 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
212 { CONFIG_SYS_FSL_AIOP1_BASE, CONFIG_SYS_FSL_AIOP1_BASE,
213 CONFIG_SYS_FSL_AIOP1_SIZE, MT_DEVICE_NGNRNE,
214 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
215 { CONFIG_SYS_FSL_PEBUF_BASE, CONFIG_SYS_FSL_PEBUF_BASE,
216 CONFIG_SYS_FSL_PEBUF_SIZE, MT_DEVICE_NGNRNE,
217 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
218 { CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
219 CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL,
220 PMD_SECT_OUTER_SHARE | PMD_SECT_NS },
221 #elif defined(CONFIG_FSL_LSCH2)
222 { CONFIG_SYS_FSL_BOOTROM_BASE, CONFIG_SYS_FSL_BOOTROM_BASE,
223 CONFIG_SYS_FSL_BOOTROM_SIZE, MT_DEVICE_NGNRNE,
224 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
225 { CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
226 CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE,
227 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
228 { CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
229 CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
230 { CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
231 CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE,
232 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
233 { CONFIG_SYS_FSL_QSPI_BASE, CONFIG_SYS_FSL_QSPI_BASE,
234 CONFIG_SYS_FSL_QSPI_SIZE, MT_DEVICE_NGNRNE,
235 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
236 { CONFIG_SYS_FSL_IFC_BASE, CONFIG_SYS_FSL_IFC_BASE,
237 CONFIG_SYS_FSL_IFC_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
238 { CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
239 CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL,
240 PMD_SECT_OUTER_SHARE | PMD_SECT_NS },
241 { CONFIG_SYS_FSL_QBMAN_BASE, CONFIG_SYS_FSL_QBMAN_BASE,
242 CONFIG_SYS_FSL_QBMAN_SIZE, MT_DEVICE_NGNRNE,
243 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
244 { CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
245 CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
246 { CONFIG_SYS_PCIE1_PHYS_ADDR, CONFIG_SYS_PCIE1_PHYS_ADDR,
247 CONFIG_SYS_PCIE1_PHYS_SIZE, MT_DEVICE_NGNRNE,
248 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
249 { CONFIG_SYS_PCIE2_PHYS_ADDR, CONFIG_SYS_PCIE2_PHYS_ADDR,
250 CONFIG_SYS_PCIE2_PHYS_SIZE, MT_DEVICE_NGNRNE,
251 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
252 { CONFIG_SYS_PCIE3_PHYS_ADDR, CONFIG_SYS_PCIE3_PHYS_ADDR,
253 CONFIG_SYS_PCIE3_PHYS_SIZE, MT_DEVICE_NGNRNE,
254 PMD_SECT_NON_SHARE | PMD_SECT_PXN | PMD_SECT_UXN },
255 { CONFIG_SYS_FSL_DRAM_BASE3, CONFIG_SYS_FSL_DRAM_BASE3,
256 CONFIG_SYS_FSL_DRAM_SIZE3, MT_NORMAL, PMD_SECT_OUTER_SHARE },
261 int fsl_qoriq_core_to_cluster(unsigned int core);
263 #endif /* _FSL_LAYERSCAPE_CPU_H */