1 /* 2 * Copyright (c) 2017 Synopsys 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <devicetree.h> 8 #include <soc.h> 9 #include <arch/arc/v2/mpu/arc_mpu.h> 10 #include <linker/linker-defs.h> 11 12 /* 13 * for secure firmware, MPU entries are only set up for secure world. 14 * All regions not listed here are shared by secure world and normal world. 15 */ 16 static struct arc_mpu_region mpu_regions[] = { 17 #if DT_REG_SIZE(DT_INST(0, arc_iccm)) > 0 18 /* Region ICCM */ 19 MPU_REGION_ENTRY("ICCM", 20 DT_REG_ADDR(DT_INST(0, arc_iccm)), 21 DT_REG_SIZE(DT_INST(0, arc_iccm)), 22 REGION_ROM_ATTR), 23 #endif 24 #if DT_REG_SIZE(DT_INST(0, arc_dccm)) > 0 25 /* Region DCCM */ 26 MPU_REGION_ENTRY("DCCM", 27 DT_REG_ADDR(DT_INST(0, arc_dccm)), 28 DT_REG_SIZE(DT_INST(0, arc_dccm)), 29 REGION_KERNEL_RAM_ATTR | REGION_DYNAMIC), 30 #endif 31 32 #if DT_REG_SIZE(DT_INST(0, mmio_sram)) > 0 33 /* Region DDR RAM */ 34 MPU_REGION_ENTRY("DDR RAM", 35 DT_REG_ADDR(DT_INST(0, mmio_sram)), 36 DT_REG_SIZE(DT_INST(0, mmio_sram)), 37 AUX_MPU_ATTR_KW | AUX_MPU_ATTR_KR | AUX_MPU_ATTR_UR | 38 AUX_MPU_ATTR_KE | AUX_MPU_ATTR_UE | REGION_DYNAMIC), 39 #endif 40 41 /* 42 * Region peripheral is shared by secure world and normal world by default, 43 * no need a static mpu entry. If some peripherals belong to secure world, 44 * add it here. 45 */ 46 #ifndef CONFIG_ARC_SECURE_FIRMWARE 47 /* Region Peripheral */ 48 MPU_REGION_ENTRY("PERIPHERAL", 49 0xF0000000, 50 64 * 1024, 51 REGION_KERNEL_RAM_ATTR) 52 #endif 53 }; 54 55 struct arc_mpu_config mpu_config = { 56 .num_regions = ARRAY_SIZE(mpu_regions), 57 .mpu_regions = mpu_regions, 58 }; 59