1 /* 2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <arch_helpers.h> 8 #include <arm_gic.h> 9 #include <assert.h> 10 #include <bl_common.h> 11 #include <debug.h> 12 #include <delay_timer.h> 13 #include <errno.h> 14 #include <mmio.h> 15 #include <platform.h> 16 #include <xlat_tables.h> 17 #include "hi3798cv200.h" 18 #include "platform_def.h" 19 20 #define MAP_DDR MAP_REGION_FLAT(DDR_BASE, \ 21 DDR_SIZE, \ 22 MT_MEMORY | MT_RW | MT_NS) 23 24 #define MAP_DEVICE MAP_REGION_FLAT(DEVICE_BASE, \ 25 DEVICE_SIZE, \ 26 MT_DEVICE | MT_RW | MT_SECURE) 27 28 #define MAP_TSP_MEM MAP_REGION_FLAT(TSP_SEC_MEM_BASE, \ 29 TSP_SEC_MEM_SIZE, \ 30 MT_MEMORY | MT_RW | MT_SECURE) 31 32 static const mmap_region_t poplar_mmap[] = { 33 MAP_DDR, 34 MAP_DEVICE, 35 MAP_TSP_MEM, 36 {0} 37 }; 38 39 #define DEFINE_CONFIGURE_MMU_EL(_el) \ 40 void plat_configure_mmu_el##_el(unsigned long total_base, \ 41 unsigned long total_size, \ 42 unsigned long ro_start, \ 43 unsigned long ro_limit, \ 44 unsigned long coh_start, \ 45 unsigned long coh_limit) \ 46 { \ 47 mmap_add_region(total_base, total_base, \ 48 total_size, \ 49 MT_MEMORY | MT_RW | MT_SECURE); \ 50 mmap_add_region(ro_start, ro_start, \ 51 ro_limit - ro_start, \ 52 MT_MEMORY | MT_RO | MT_SECURE); \ 53 mmap_add_region(coh_start, coh_start, \ 54 coh_limit - coh_start, \ 55 MT_DEVICE | MT_RW | MT_SECURE); \ 56 mmap_add(poplar_mmap); \ 57 init_xlat_tables(); \ 58 \ 59 enable_mmu_el##_el(0); \ 60 } 61 62 DEFINE_CONFIGURE_MMU_EL(3) 63 DEFINE_CONFIGURE_MMU_EL(1) 64 65 unsigned int plat_get_syscnt_freq2(void) 66 { 67 return SYS_COUNTER_FREQ_IN_TICKS; 68 } 69