xref: /rk3399_ARM-atf/plat/socionext/synquacer/sq_ccn.c (revision c3cf06f1a3a9b9ee8ac7a0ae505f95c45f7dca84)
1 /*
2  * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <arch.h>
8 #include <arch_helpers.h>
9 #include <ccn.h>
10 #include <platform_def.h>
11 
12 static const unsigned char master_to_rn_id_map[] = {
13 	PLAT_SQ_CLUSTER_TO_CCN_ID_MAP
14 };
15 
16 static const ccn_desc_t sq_ccn_desc = {
17 	.periphbase = PLAT_SQ_CCN_BASE,
18 	.num_masters = ARRAY_SIZE(master_to_rn_id_map),
19 	.master_to_rn_id_map = master_to_rn_id_map
20 };
21 
22 /******************************************************************************
23  * Helper function to initialize SQ CCN driver.
24  *****************************************************************************/
25 void plat_sq_interconnect_init(void)
26 {
27 	ccn_init(&sq_ccn_desc);
28 }
29 
30 /******************************************************************************
31  * Helper function to place current master into coherency
32  *****************************************************************************/
33 void plat_sq_interconnect_enter_coherency(void)
34 {
35 	ccn_enter_snoop_dvm_domain(1 << MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
36 }
37 
38 /******************************************************************************
39  * Helper function to remove current master from coherency
40  *****************************************************************************/
41 void plat_sq_interconnect_exit_coherency(void)
42 {
43 	ccn_exit_snoop_dvm_domain(1 << MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
44 }
45