1 /* 2 * Copyright 2024-2025 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 #include <errno.h> 7 8 #include <common/bl_common.h> 9 #include <lib/xlat_tables/xlat_tables_v2.h> 10 #include <plat/common/platform.h> 11 12 #include <s32cc-bl-common.h> 13 14 int s32cc_bl_mmu_setup(void) 15 { 16 const unsigned long code_start = BL_CODE_BASE; 17 const unsigned long rw_start = BL_CODE_END; 18 unsigned long code_size; 19 unsigned long rw_size; 20 21 if (code_start > BL_CODE_END) { 22 return -EINVAL; 23 } 24 25 if (rw_start > BL_END) { 26 return -EINVAL; 27 } 28 29 code_size = BL_CODE_END - code_start; 30 rw_size = BL_END - rw_start; 31 32 mmap_add_region(code_start, code_start, code_size, 33 MT_RO | MT_MEMORY | MT_SECURE); 34 mmap_add_region(rw_start, rw_start, rw_size, 35 MT_RW | MT_MEMORY | MT_SECURE); 36 37 init_xlat_tables(); 38 enable_mmu_el3(0); 39 40 return 0; 41 } 42 43 unsigned int plat_get_syscnt_freq2(void) 44 { 45 return COUNTER_FREQUENCY; 46 } 47