1 /* 2 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <platform_def.h> 8 9 #include <arch.h> 10 #include <drivers/arm/ccn.h> 11 #include <plat/arm/common/plat_arm.h> 12 13 static const unsigned char master_to_rn_id_map[] = { 14 PLAT_ARM_CLUSTER_TO_CCN_ID_MAP 15 }; 16 17 static const ccn_desc_t arm_ccn_desc = { 18 .periphbase = PLAT_ARM_CCN_BASE, 19 .num_masters = ARRAY_SIZE(master_to_rn_id_map), 20 .master_to_rn_id_map = master_to_rn_id_map 21 }; 22 23 CASSERT(PLAT_ARM_CLUSTER_COUNT == ARRAY_SIZE(master_to_rn_id_map), 24 assert_invalid_cluster_count_for_ccn_variant); 25 26 /****************************************************************************** 27 * Helper function to initialize ARM CCN driver. 28 *****************************************************************************/ 29 void __init plat_arm_interconnect_init(void) 30 { 31 ccn_init(&arm_ccn_desc); 32 } 33 34 /****************************************************************************** 35 * Helper function to place current master into coherency 36 *****************************************************************************/ 37 void plat_arm_interconnect_enter_coherency(void) 38 { 39 ccn_enter_snoop_dvm_domain(1 << MPIDR_AFFLVL1_VAL(read_mpidr_el1())); 40 } 41 42 /****************************************************************************** 43 * Helper function to remove current master from coherency 44 *****************************************************************************/ 45 void plat_arm_interconnect_exit_coherency(void) 46 { 47 ccn_exit_snoop_dvm_domain(1 << MPIDR_AFFLVL1_VAL(read_mpidr_el1())); 48 } 49