|
25 | 25 | #ifdef PLATFORM_nxp_p1021 |
26 | 26 | /* NXP P1021 */ |
27 | 27 | #define CPU_NUMCORES 2 |
| 28 | + #define CORE_E500 |
| 29 | + |
28 | 30 | #define CCSRBAR_DEF (0xFF700000) /* P1021RM 4.3 default base */ |
29 | 31 | #define CCSRBAR_SIZE BOOKE_PAGESZ_1M |
30 | | - #define MMU_V1 |
31 | 32 |
|
32 | 33 | #define ENABLE_L1_CACHE |
33 | 34 |
|
|
58 | 59 | #elif defined(PLATFORM_nxp_t2080) |
59 | 60 | /* NXP T0280 */ |
60 | 61 | #define CPU_NUMCORES 4 |
61 | | - #define CCSRBAR_DEF (0xFE000000) /* T2080RM 4.3.1 default base */ |
| 62 | + #define CORE_E6500 |
| 63 | + |
| 64 | + #define CCSRBAR_DEF (0xFE000000) /* T2080RM 4.3.1 default base - 0xFF000000 */ |
62 | 65 | #define CCSRBAR_SIZE BOOKE_PAGESZ_16M |
63 | | - #define MMU_V2 |
| 66 | + |
| 67 | + /* relocate to 64-bit 0xE_ */ |
| 68 | + //#define CCSRBAR_PHYS_HIGH 0xE |
| 69 | + //#define CCSRBAR_PHYS (CCSRBAR_PHYS_HIGH + CCSRBAR_DEF) |
| 70 | + |
64 | 71 | #define ENABLE_L1_CACHE |
65 | 72 | #define ENABLE_L2_CACHE |
66 | | - #define L2SRAM_ADDR (0xFEC20000) /* L2 as SRAM */ |
| 73 | + #define L2SRAM_ADDR (0xF8F80000) /* L2 as SRAM */ |
67 | 74 | #define L2SRAM_SIZE (256 * 1024) |
68 | 75 | #define ENABLE_INTERRUPTS |
69 | 76 |
|
70 | 77 | #define ENABLE_DDR |
71 | 78 |
|
72 | | - /* This flash mapping window is automatically enabled |
73 | | - * T2080RM: 4.3.3 Boot Space Translation: |
74 | | - * default boot window (8 MB at 0x0_FF80_0000 to 0x0_FFFF_FFFF) |
75 | | - */ |
76 | | - #define FLASH_BASE_ADDR 0xEF800000 |
| 79 | + #define FLASH_BASE_ADDR 0xE8000000 |
| 80 | + #define FLASH_BASE_PHYS_HIGH 0x0 |
77 | 81 |
|
| 82 | + #define USE_LONG_JUMP |
78 | 83 | #else |
79 | | - #error Please define MMU version and CCSRBAR for platform |
| 84 | + #error Please define platform PowerPC core version and CCSRBAR |
80 | 85 | #endif |
81 | 86 |
|
| 87 | + |
| 88 | + |
82 | 89 | /* boot address */ |
| 90 | +#ifndef BOOT_ROM_ADDR |
83 | 91 | #define BOOT_ROM_ADDR 0xFFFFF000 |
| 92 | +#endif |
| 93 | +#ifndef BOOT_ROM_SIZE |
84 | 94 | #define BOOT_ROM_SIZE (4*1024) |
| 95 | +#endif |
85 | 96 |
|
| 97 | +/* reset vector */ |
86 | 98 | #define RESET_VECTOR (BOOT_ROM_ADDR + (BOOT_ROM_SIZE - 4)) |
87 | 99 |
|
| 100 | +/* CCSRBAR */ |
88 | 101 | #ifndef CCSRBAR_DEF |
89 | 102 | #define CCSRBAR_DEF 0xFE000000 |
90 | 103 | #endif |
91 | 104 | #ifndef CCSRBAR |
92 | 105 | #define CCSRBAR CCSRBAR_DEF |
93 | 106 | #endif |
| 107 | +#ifndef CCSRBAR_PHYS |
| 108 | +#define CCSRBAR_PHYS CCSRBAR |
| 109 | +#endif |
| 110 | +#ifndef CCSRBAR_PHYS_HIGH |
| 111 | +#define CCSRBAR_PHYS_HIGH 0 |
| 112 | +#endif |
94 | 113 |
|
| 114 | +/* DDR */ |
95 | 115 | #ifndef DDR_ADDRESS |
96 | | -#define DDR_ADDRESS 0x00000000 |
| 116 | +#define DDR_ADDRESS 0x00000000 |
| 117 | +#endif |
| 118 | + |
| 119 | +/* L1 */ |
| 120 | +#ifndef L1_CACHE_ADDR |
| 121 | +#define L1_CACHE_ADDR 0xFFD00000 |
| 122 | +#endif |
| 123 | +#ifndef L1_CACHE_SZ |
| 124 | +#define L1_CACHE_SZ (32 * 1024) |
97 | 125 | #endif |
98 | 126 |
|
99 | | -#ifdef MMU_V1 |
100 | | - /* MMU V1 - e500 */ |
| 127 | + |
| 128 | +#ifdef CORE_E500 |
| 129 | + /* PowerPC e500 */ |
101 | 130 | /* EREF: 7.5.3.2 - TLB Entry Page Size */ |
102 | 131 | #define BOOKE_PAGESZ_4K 1 |
103 | 132 | #define BOOKE_PAGESZ_16K 2 |
|
116 | 145 |
|
117 | 146 | #define L1_CACHE_LINE_SHIFT 5 /* 32 bytes per L1 cache line */ |
118 | 147 |
|
119 | | -#else |
120 | | - /* MMU V2 - e6500 */ |
| 148 | + /* P1021 LAW - Local Access Window (Memory Map) - RM 2.4 */ |
| 149 | + #define LAWBAR_BASE(n) (0xC08 + (n * 0x20)) |
| 150 | + #define LAWBAR(n) ((volatile uint32_t*)(CCSRBAR + LAWBAR_BASE(n) + 0x0)) |
| 151 | + #define LAWAR(n) ((volatile uint32_t*)(CCSRBAR + LAWBAR_BASE(n) + 0x8)) |
| 152 | + |
| 153 | + #define LAWAR_ENABLE (1<<31) |
| 154 | + #define LAWAR_TRGT_ID(id) (id<<20) |
| 155 | + |
| 156 | + /* P1021 Global Source/Target ID Assignments - RM Table 2-7 */ |
| 157 | + #define LAW_TRGT_PCIE2 0x01 |
| 158 | + #define LAW_TRGT_PCIE1 0x02 |
| 159 | + #define LAW_TRGT_ELBC 0x04 /* eLBC (Enhanced Local Bus Controller) */ |
| 160 | + #define LAW_TRGT_DDR 0x0F /* DDR Memory Controller */ |
| 161 | + |
| 162 | + /* P1021 2.4.2 - size is equal to 2^(enum + 1) */ |
| 163 | + #define LAW_SIZE_4KB 0x0B |
| 164 | + #define LAW_SIZE_8KB 0x0C |
| 165 | + #define LAW_SIZE_16KB 0x0D |
| 166 | + #define LAW_SIZE_32KB 0x0E |
| 167 | + #define LAW_SIZE_64KB 0x0F |
| 168 | + #define LAW_SIZE_128KB 0x10 |
| 169 | + #define LAW_SIZE_256KB 0x11 |
| 170 | + #define LAW_SIZE_512KB 0x12 |
| 171 | + #define LAW_SIZE_1MB 0x13 |
| 172 | + #define LAW_SIZE_2MB 0x14 |
| 173 | + #define LAW_SIZE_4MB 0x15 |
| 174 | + #define LAW_SIZE_8MB 0x16 |
| 175 | + #define LAW_SIZE_16MB 0x17 |
| 176 | + #define LAW_SIZE_32MB 0x18 |
| 177 | + #define LAW_SIZE_64MB 0x19 |
| 178 | + #define LAW_SIZE_128MB 0x1A |
| 179 | + #define LAW_SIZE_256MB 0x1B |
| 180 | + #define LAW_SIZE_512MB 0x1C |
| 181 | + #define LAW_SIZE_1GB 0x1D |
| 182 | + #define LAW_SIZE_2GB 0x1E |
| 183 | + #define LAW_SIZE_4GB 0x1F |
| 184 | + #define LAW_SIZE_8GB 0x20 |
| 185 | + #define LAW_SIZE_16GB 0x21 |
| 186 | + #define LAW_SIZE_32GB 0x22 |
| 187 | + |
| 188 | + |
| 189 | +#elif defined(CORE_E6500) |
| 190 | + /* PowerPC e6500 */ |
| 191 | + |
| 192 | + /* CoreNet on-chip interface between the core cluster and rest of SoC */ |
| 193 | + #define USE_CORENET_INTERFACE |
| 194 | + |
121 | 195 | /* EREF 2.0: 6.5.3.2 - TLB Entry Page Size */ |
122 | 196 | #define BOOKE_PAGESZ_4K 2 |
123 | 197 | #define BOOKE_PAGESZ_8K 3 |
|
144 | 218 | #define MAS1_TSIZE_MASK 0x00000F80 |
145 | 219 | #define MAS1_TSIZE(x) (((x) << 7) & MAS1_TSIZE_MASK) |
146 | 220 |
|
147 | | - #define L1_CACHE_LINE_SHIFT 4 /* 64 bytes per L1 cache line */ |
148 | | - #endif /* MMU V1/V2 */ |
| 221 | + #define L1_CACHE_LINE_SHIFT 6 /* 64 bytes per L1 cache line */ |
149 | 222 |
|
150 | | - #ifndef L1_CACHE_ADDR |
151 | | - #define L1_CACHE_ADDR 0xFFD00000 |
152 | | - #endif |
153 | | - #ifndef L1_CACHE_SZ |
154 | | - #define L1_CACHE_SZ (32 * 1024) |
155 | | - #endif |
| 223 | + /* CoreNet Platform Cache Base */ |
| 224 | + #define CPC_BASE (CCSRBAR + 0x10000) |
156 | 225 |
|
157 | | - #ifndef L1_CACHE_LINE_SIZE |
158 | | - #define L1_CACHE_LINE_SIZE (1 << L1_CACHE_LINE_SHIFT) |
| 226 | + /* T2080 LAW - Local Access Window (Memory Map) - RM 2.4 */ |
| 227 | + #define LAWBAR_BASE(n) (0xC00 + (n * 0x10)) |
| 228 | + #define LAWBARH(n) *((volatile uint32_t*)(CCSRBAR + LAWBAR_BASE(n) + 0x0)) |
| 229 | + #define LAWBARL(n) *((volatile uint32_t*)(CCSRBAR + LAWBAR_BASE(n) + 0x4)) |
| 230 | + #define LAWAR(n) *((volatile uint32_t*)(CCSRBAR + LAWBAR_BASE(n) + 0x8)) |
| 231 | + |
| 232 | + #define LAWAR_ENABLE (1<<31) |
| 233 | + #define LAWAR_TRGT_ID(id) (id<<20) |
| 234 | + |
| 235 | + /* T2080 Global Source/Target ID Assignments - RM Table 2-1 */ |
| 236 | + #define LAW_TRGT_DDR_1 0x10 |
| 237 | + #define LAW_TRGT_BMAN 0x18 /* Buffer Manager (BMan) (control) */ |
| 238 | + #define LAW_TRGT_CORENET 0x1E |
| 239 | + #define LAW_TRGT_IFC 0x1F /* Integrated Flash Controller */ |
| 240 | + |
| 241 | + /* T2080 2.4.3 - size is equal to 2^(enum + 1) */ |
| 242 | + #define LAW_SIZE_4KB 0x0B |
| 243 | + #define LAW_SIZE_8KB 0x0C |
| 244 | + #define LAW_SIZE_16KB 0x0D |
| 245 | + #define LAW_SIZE_32KB 0x0E |
| 246 | + #define LAW_SIZE_64KB 0x0F |
| 247 | + #define LAW_SIZE_128KB 0x10 |
| 248 | + #define LAW_SIZE_256KB 0x11 |
| 249 | + #define LAW_SIZE_512KB 0x12 |
| 250 | + #define LAW_SIZE_1MB 0x13 |
| 251 | + #define LAW_SIZE_2MB 0x14 |
| 252 | + #define LAW_SIZE_4MB 0x15 |
| 253 | + #define LAW_SIZE_8MB 0x16 |
| 254 | + #define LAW_SIZE_16MB 0x17 |
| 255 | + #define LAW_SIZE_32MB 0x18 |
| 256 | + #define LAW_SIZE_64MB 0x19 |
| 257 | + #define LAW_SIZE_128MB 0x1A |
| 258 | + #define LAW_SIZE_256MB 0x1B |
| 259 | + #define LAW_SIZE_512MB 0x1C |
| 260 | + #define LAW_SIZE_1GB 0x1D |
| 261 | + #define LAW_SIZE_2GB 0x1E |
| 262 | + #define LAW_SIZE_4GB 0x1F |
| 263 | + #define LAW_SIZE_8GB 0x20 |
| 264 | + #define LAW_SIZE_16GB 0x21 |
| 265 | + #define LAW_SIZE_32GB 0x22 |
| 266 | + #define LAW_SIZE_64GB 0x23 |
| 267 | + #define LAW_SIZE_128GB 0x24 |
| 268 | + #define LAW_SIZE_256GB 0x25 |
| 269 | + #define LAW_SIZE_512GB 0x26 |
| 270 | + #define LAW_SIZE_1TB 0x27 |
159 | 271 |
|
160 | | - #define CPC_BASE (CCSRBAR + 0x10000) |
| 272 | +#endif |
| 273 | + |
| 274 | +#ifndef L1_CACHE_LINE_SIZE |
| 275 | +#define L1_CACHE_LINE_SIZE (1 << L1_CACHE_LINE_SHIFT) |
161 | 276 | #endif |
162 | 277 |
|
163 | 278 |
|
164 | | -/* MMU Assist Registers */ |
| 279 | +/* MMU Assist Registers |
| 280 | + * E6500RM 2.13.10 |
| 281 | + * E500CORERM 2.12.5 |
| 282 | + */ |
165 | 283 | #define MAS0 0x270 |
166 | 284 | #define MAS1 0x271 |
167 | 285 | #define MAS2 0x272 |
|
170 | 288 | #define MAS7 0x3B0 |
171 | 289 | #define MMUCSR0 0x3F4 /* MMU control and status register 0 */ |
172 | 290 |
|
| 291 | +#define MAS0_TLBSEL_MSK 0x30000000 |
| 292 | +#define MAS0_TLBSEL(x) (((x) << 28) & MAS0_TLBSEL_MSK) |
| 293 | +#define MAS0_ESEL_MSK 0x0FFF0000 |
| 294 | +#define MAS0_ESEL(x) (((x) << 16) & MAS0_ESEL_MSK) |
| 295 | +#define MAS0_NV(x) ((x) & 0x00000FFF) |
| 296 | + |
| 297 | +#define MAS1_VALID 0x80000000 |
| 298 | +#define MAS1_IPROT 0x40000000 /* can not be invalidated by tlbivax */ |
| 299 | +#define MAS1_TID(x) (((x) << 16) & 0x3FFF0000) |
| 300 | +#define MAS1_TS 0x00001000 |
| 301 | + |
| 302 | +#define MAS2_EPN 0xFFFFF000 /* Effective page number */ |
| 303 | +#define MAS2_X0 0x00000040 |
| 304 | +#define MAS2_X1 0x00000020 |
| 305 | +#define MAS2_W 0x00000010 /* Write-through */ |
| 306 | +#define MAS2_I 0x00000008 /* Caching-inhibited */ |
| 307 | +#define MAS2_M 0x00000004 /* Memory coherency required */ |
| 308 | +#define MAS2_G 0x00000002 /* Guarded */ |
| 309 | +#define MAS2_E 0x00000001 /* Endianness - 0=big, 1=little */ |
| 310 | + |
| 311 | +#define MAS3_RPN 0xFFFFF000 /* Real page number */ |
| 312 | +/* User attribute bits */ |
| 313 | +#define MAS3_U0 0x00000200 |
| 314 | +#define MAS3_U1 0x00000100 |
| 315 | +#define MAS3_U2 0x00000080 |
| 316 | +#define MAS3_U3 0x00000040 |
| 317 | +#define MAS3_UX 0x00000020 |
| 318 | +/* User and supervisor read, write, and execute permission bits */ |
| 319 | +#define MAS3_SX 0x00000010 |
| 320 | +#define MAS3_UW 0x00000008 |
| 321 | +#define MAS3_SW 0x00000004 |
| 322 | +#define MAS3_UR 0x00000002 |
| 323 | +#define MAS3_SR 0x00000001 |
| 324 | + |
| 325 | +#define MAS7_RPN 0xFF000000 /* Real page number - upper 8-bits */ |
| 326 | + |
| 327 | + |
173 | 328 | /* L1 Cache */ |
174 | 329 | #define L1CFG0 0x203 /* L1 Cache Configuration Register 0 */ |
175 | 330 | #define L1CSR0 0x3F2 /* L1 Data */ |
|
245 | 400 | #define SPRN_TBWL 0x11C /* Time Base Write Lower Register */ |
246 | 401 | #define SPRN_TBWU 0x11D /* Time Base Write Upper Register */ |
247 | 402 |
|
248 | | - |
249 | | -/* MMU Assist Registers |
250 | | - * E6500RM 2.13.10 |
251 | | - * E500CORERM 2.12.5 |
252 | | - */ |
253 | | -#define MAS0_TLBSEL_MSK 0x30000000 |
254 | | -#define MAS0_TLBSEL(x) (((x) << 28) & MAS0_TLBSEL_MSK) |
255 | | -#define MAS0_ESEL_MSK 0x0FFF0000 |
256 | | -#define MAS0_ESEL(x) (((x) << 16) & MAS0_ESEL_MSK) |
257 | | -#define MAS0_NV(x) ((x) & 0x00000FFF) |
258 | | - |
259 | | -#define MAS1_VALID 0x80000000 |
260 | | -#define MAS1_IPROT 0x40000000 /* can not be invalidated by tlbivax */ |
261 | | -#define MAS1_TID(x) (((x) << 16) & 0x3FFF0000) |
262 | | -#define MAS1_TS 0x00001000 |
263 | | - |
264 | | -#define MAS2_EPN 0xFFFFF000 /* Effective page number */ |
265 | | -#define MAS2_X0 0x00000040 |
266 | | -#define MAS2_X1 0x00000020 |
267 | | -#define MAS2_W 0x00000010 /* Write-through */ |
268 | | -#define MAS2_I 0x00000008 /* Caching-inhibited */ |
269 | | -#define MAS2_M 0x00000004 /* Memory coherency required */ |
270 | | -#define MAS2_G 0x00000002 /* Guarded */ |
271 | | -#define MAS2_E 0x00000001 /* Endianness - 0=big, 1=little */ |
272 | | - |
273 | | -#define MAS3_RPN 0xFFFFF000 /* Real page number */ |
274 | | -/* User attribute bits */ |
275 | | -#define MAS3_U0 0x00000200 |
276 | | -#define MAS3_U1 0x00000100 |
277 | | -#define MAS3_U2 0x00000080 |
278 | | -#define MAS3_U3 0x00000040 |
279 | | -#define MAS3_UX 0x00000020 |
280 | | -/* User and supervisor read, write, and execute permission bits */ |
281 | | -#define MAS3_SX 0x00000010 |
282 | | -#define MAS3_UW 0x00000008 |
283 | | -#define MAS3_SW 0x00000004 |
284 | | -#define MAS3_UR 0x00000002 |
285 | | -#define MAS3_SR 0x00000001 |
286 | | - |
287 | | -#define MAS7_RPN 0xFF000000 /* Real page number - upper 8-bits */ |
288 | | - |
289 | 403 | #define SPRN_TLB0CFG 0x2B0 /* TLB 0 Config Register */ |
290 | 404 | #define SPRN_TLB1CFG 0x2B1 /* TLB 1 Config Register */ |
291 | 405 | #define TLBNCFG_NENTRY_MASK 0x00000FFF |
|
0 commit comments