1 /*
2  * Copyright 2020 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include <arch.h>
9 #include <cci.h>
10 
11 #include <plat_arm.h>
12 
13 /******************************************************************************
14  * The following functions are defined as weak to allow a platform to override
15  * the way ARM CCI driver is initialised and used.
16  *****************************************************************************/
17 #pragma weak plat_arm_interconnect_enter_coherency
18 #pragma weak plat_arm_interconnect_exit_coherency
19 
20 /******************************************************************************
21  * Helper function to place current master into coherency
22  *****************************************************************************/
plat_ls_interconnect_enter_coherency(unsigned int num_clusters)23 void plat_ls_interconnect_enter_coherency(unsigned int num_clusters)
24 {
25 	cci_enable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
26 
27 	for (uint32_t index = 1U; index < num_clusters; index++) {
28 		cci_enable_snoop_dvm_reqs(index);
29 	}
30 }
31 
32 /******************************************************************************
33  * Helper function to remove current master from coherency
34  *****************************************************************************/
plat_ls_interconnect_exit_coherency(void)35 void plat_ls_interconnect_exit_coherency(void)
36 {
37 	cci_disable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
38 }
39