1*91f16700Schasinglulu /* 2*91f16700Schasinglulu * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. 3*91f16700Schasinglulu * 4*91f16700Schasinglulu * SPDX-License-Identifier: BSD-3-Clause 5*91f16700Schasinglulu */ 6*91f16700Schasinglulu 7*91f16700Schasinglulu #include <platform_def.h> 8*91f16700Schasinglulu 9*91f16700Schasinglulu #include <arch.h> 10*91f16700Schasinglulu #include <drivers/arm/cci.h> 11*91f16700Schasinglulu #include <lib/utils.h> 12*91f16700Schasinglulu #include <plat/arm/common/plat_arm.h> 13*91f16700Schasinglulu 14*91f16700Schasinglulu static const int cci_map[] = { 15*91f16700Schasinglulu PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX, 16*91f16700Schasinglulu PLAT_ARM_CCI_CLUSTER1_SL_IFACE_IX 17*91f16700Schasinglulu }; 18*91f16700Schasinglulu 19*91f16700Schasinglulu /****************************************************************************** 20*91f16700Schasinglulu * The following functions are defined as weak to allow a platform to override 21*91f16700Schasinglulu * the way ARM CCI driver is initialised and used. 22*91f16700Schasinglulu *****************************************************************************/ 23*91f16700Schasinglulu #pragma weak plat_arm_interconnect_init 24*91f16700Schasinglulu #pragma weak plat_arm_interconnect_enter_coherency 25*91f16700Schasinglulu #pragma weak plat_arm_interconnect_exit_coherency 26*91f16700Schasinglulu 27*91f16700Schasinglulu 28*91f16700Schasinglulu /****************************************************************************** 29*91f16700Schasinglulu * Helper function to initialize ARM CCI driver. 30*91f16700Schasinglulu *****************************************************************************/ 31*91f16700Schasinglulu void __init plat_arm_interconnect_init(void) 32*91f16700Schasinglulu { 33*91f16700Schasinglulu cci_init(PLAT_ARM_CCI_BASE, cci_map, ARRAY_SIZE(cci_map)); 34*91f16700Schasinglulu } 35*91f16700Schasinglulu 36*91f16700Schasinglulu /****************************************************************************** 37*91f16700Schasinglulu * Helper function to place current master into coherency 38*91f16700Schasinglulu *****************************************************************************/ 39*91f16700Schasinglulu void plat_arm_interconnect_enter_coherency(void) 40*91f16700Schasinglulu { 41*91f16700Schasinglulu cci_enable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1())); 42*91f16700Schasinglulu } 43*91f16700Schasinglulu 44*91f16700Schasinglulu /****************************************************************************** 45*91f16700Schasinglulu * Helper function to remove current master from coherency 46*91f16700Schasinglulu *****************************************************************************/ 47*91f16700Schasinglulu void plat_arm_interconnect_exit_coherency(void) 48*91f16700Schasinglulu { 49*91f16700Schasinglulu cci_disable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1())); 50*91f16700Schasinglulu } 51