1 /*
2  * Copyright (C) 2018 Marvell International Ltd.
3  *
4  * SPDX-License-Identifier:     BSD-3-Clause
5  * https://spdx.org/licenses
6  */
7 
8 #include <drivers/arm/cci.h>
9 
10 #include <plat_marvell.h>
11 
12 static const int cci_map[] = {
13 	PLAT_MARVELL_CCI_CLUSTER0_SL_IFACE_IX,
14 	PLAT_MARVELL_CCI_CLUSTER1_SL_IFACE_IX
15 };
16 
17 /****************************************************************************
18  * The following functions are defined as weak to allow a platform to override
19  * the way ARM CCI driver is initialised and used.
20  ****************************************************************************
21  */
22 #pragma weak plat_marvell_interconnect_init
23 #pragma weak plat_marvell_interconnect_enter_coherency
24 #pragma weak plat_marvell_interconnect_exit_coherency
25 
26 
27 /****************************************************************************
28  * Helper function to initialize ARM CCI driver.
29  ****************************************************************************
30  */
plat_marvell_interconnect_init(void)31 void plat_marvell_interconnect_init(void)
32 {
33 	cci_init(PLAT_MARVELL_CCI_BASE, cci_map, ARRAY_SIZE(cci_map));
34 }
35 
36 /****************************************************************************
37  * Helper function to place current master into coherency
38  ****************************************************************************
39  */
plat_marvell_interconnect_enter_coherency(void)40 void plat_marvell_interconnect_enter_coherency(void)
41 {
42 	cci_enable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
43 }
44 
45 /****************************************************************************
46  * Helper function to remove current master from coherency
47  ****************************************************************************
48  */
plat_marvell_interconnect_exit_coherency(void)49 void plat_marvell_interconnect_exit_coherency(void)
50 {
51 	cci_disable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
52 }
53